{"id":13727430,"url":"https://github.com/ajafff/tsutils","last_synced_at":"2025-05-15T01:09:49.944Z","repository":{"id":47160025,"uuid":"81121966","full_name":"ajafff/tsutils","owner":"ajafff","description":"utility functions for working with typescript's AST","archived":false,"fork":false,"pushed_at":"2024-03-10T22:14:58.000Z","size":1274,"stargazers_count":326,"open_issues_count":26,"forks_count":28,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-15T08:46:07.212Z","etag":null,"topics":["ast","typescript","typescript-ast","utilities"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ajafff.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-02-06T19:12:54.000Z","updated_at":"2025-04-06T13:54:27.000Z","dependencies_parsed_at":"2024-06-18T12:29:25.315Z","dependency_job_id":null,"html_url":"https://github.com/ajafff/tsutils","commit_stats":{"total_commits":429,"total_committers":8,"mean_commits":53.625,"dds":0.05128205128205132,"last_synced_commit":"03b4df15d14702f9c7a128ac3fae77171778d613"},"previous_names":[],"tags_count":93,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajafff%2Ftsutils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajafff%2Ftsutils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajafff%2Ftsutils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajafff%2Ftsutils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ajafff","download_url":"https://codeload.github.com/ajafff/tsutils/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250147555,"owners_count":21382650,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ast","typescript","typescript-ast","utilities"],"created_at":"2024-08-03T01:03:55.722Z","updated_at":"2025-05-15T01:09:44.936Z","avatar_url":"https://github.com/ajafff.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"# Utility functions for working with typescript's AST\n\n[![Greenkeeper badge](https://badges.greenkeeper.io/ajafff/tsutils.svg)](https://greenkeeper.io/)\n\n## Usage\n\nThis package consists of two major parts: utilities and typeguard functions.\nBy importing the project you will get both of them.\n```js\nimport * as utils from \"tsutils\";\nutils.isIdentifier(node); // typeguard\nutils.getLineRanges(sourceFile); // utilities\n```\n\nIf you don't need everything offered by this package, you can select what should be imported. The parts that are not imported are never read from disk and may save some startup time and reduce memory consumtion.\n\nIf you only need typeguards you can explicitly import them:\n```js\nimport { isIdentifier } from \"tsutils/typeguard\";\n// You can even distiguish between typeguards for nodes and types\nimport { isUnionTypeNode } from \"tsutils/typeguard/node\";\nimport { isUnionType } from \"tsutils/typeguard/type\";\n```\n\nIf you only need the utilities you can also explicitly import them:\n```js\nimport { forEachComment, forEachToken } from \"tsutils/util\";\n```\n\n### Typescript version dependency\n\nThis package is backwards compatible with typescript 2.8.0 at runtime although compiling might need a newer version of typescript installed.\n\nUsing `typescript@next` might work, but it's not officially supported. If you encounter any bugs, please open an issue.\n\nFor compatibility with older versions of TypeScript typeguard functions are separated by TypeScript version. If you are stuck on `typescript@2.8`, you should import directly from the submodule for that version:\n\n```js\n// all typeguards compatible with typescript@2.8\nimport { isIdentifier } from \"tsutils/typeguard/2.8\";\n// you can even use nested submodules\nimport { isIdentifier } from \"tsutils/typeguard/2.8/node\";\n\n// all typeguards compatible with typescript@2.9 (includes those of 2.8)\nimport { isIdentifier } from \"tsutils/typeguard/2.9\";\n\n// always points to the latest stable version (2.9 as of writing this)\nimport { isIdentifier } from \"tsutils/typeguard\";\nimport { isIdentifier } from \"tsutils\";\n\n// always points to the typeguards for the next TypeScript version (3.0 as of writing this)\nimport { isIdentifier } from \"tsutils/typeguard/next\";\n```\n\nNote that if you are also using utility functions, you should prefer the relevant submodule:\n\n```js\n// importing directly from 'tsutils' would pull in the latest typeguards\nimport { forEachToken } from 'tsutils/util';\nimport { isIdentifier } from 'tsutils/typeguard/2.8';\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fajafff%2Ftsutils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fajafff%2Ftsutils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fajafff%2Ftsutils/lists"}