{"id":28523512,"url":"https://github.com/tyrealhu/acorn-typescript","last_synced_at":"2025-07-06T05:31:43.583Z","repository":{"id":65231587,"uuid":"556148630","full_name":"TyrealHu/acorn-typescript","owner":"TyrealHu","description":"Alternative, TypeScript parser","archived":false,"fork":false,"pushed_at":"2024-06-28T19:30:25.000Z","size":1237,"stargazers_count":146,"open_issues_count":17,"forks_count":15,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-06-09T10:09:10.221Z","etag":null,"topics":["acorn","ast","babel","browser","javascript","nodejs","parse","parser","typescript"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/acorn-typescript?activeTab=readme","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/TyrealHu.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}},"created_at":"2022-10-23T06:52:45.000Z","updated_at":"2025-06-04T08:01:42.000Z","dependencies_parsed_at":"2023-02-10T04:01:07.043Z","dependency_job_id":"2ed5c3dd-ed50-4dd5-aabf-91826a597491","html_url":"https://github.com/TyrealHu/acorn-typescript","commit_stats":null,"previous_names":[],"tags_count":47,"template":false,"template_full_name":null,"purl":"pkg:github/TyrealHu/acorn-typescript","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TyrealHu%2Facorn-typescript","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TyrealHu%2Facorn-typescript/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TyrealHu%2Facorn-typescript/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TyrealHu%2Facorn-typescript/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TyrealHu","download_url":"https://codeload.github.com/TyrealHu/acorn-typescript/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TyrealHu%2Facorn-typescript/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263853291,"owners_count":23520118,"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":["acorn","ast","babel","browser","javascript","nodejs","parse","parser","typescript"],"created_at":"2025-06-09T10:08:46.959Z","updated_at":"2025-07-06T05:31:43.578Z","avatar_url":"https://github.com/TyrealHu.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# acorn-typescript\n[![npm version](https://img.shields.io/npm/v/acorn-typescript.svg?style=flat)](https://www.npmjs.com/package/acorn-typescript)[![Coverage Status](https://codecov.io/gh/TyrealHu/acorn-typescript/branch/master/graph/badge.svg)](https://codecov.io/gh/TyrealHu/acorn-typescript)\n---\n\nThis is plugin for [Acorn](http://marijnhaverbeke.nl/acorn/) - a tiny, fast JavaScript parser, written completely in JavaScript.\n\nIt was created as an experimental alternative, faster [TypeScript](https://www.typescriptlang.org/) parser. It will help you to parse\ntypescript script into typeScript AST.\n\n## Usage\n\nRequiring this module provides you with an Acorn plugin that you can use like this:\n\n```typescript\nimport * as acorn from 'acorn'\nimport tsPlugin from 'acorn-typescript'\n\n/*\n*\n* */\nconst node = acorn.Parser.extend(tsPlugin()).parse(`\nconst a = 1\ntype A = number\nexport {\n  a,\n  type A as B\n}\n`, {\n  sourceType: 'module',\n  ecmaVersion: 'latest',\n  locations: true\n})\n```\n\nIf you want to enable parsing within a TypeScript ambient context, where certain syntax have different rules (like .d.ts files and inside [declare module blocks](https://www.typescriptlang.org/docs/handbook/declaration-files/introduction.html)).\n```typescript\nimport * as acorn from 'acorn'\nimport tsPlugin from 'acorn-typescript'\n\n/*\n*\n* */\nconst node = acorn.Parser.extend(tsPlugin({ dts: true })).parse(`\nconst a = 1\ntype A = number\nexport {\n  a,\n  type A as B\n}\n`, {\n  sourceType: 'module',\n  ecmaVersion: 'latest',\n  locations: true\n})\n```\n\n## Notice\n- You have to enable options.locations while using acorn-typescript\n```ts\nacorn.parse(input, {\n    sourceType: 'module',\n    ecmaVersion: 'latest',\n    // here\n    locations: true\n  })\n```\n\n## SUPPORTED\n- Typescript normal syntax\n- Support to parse TypeScript [Decorators](https://www.typescriptlang.org/docs/handbook/decorators.html)\n- Support to parse JSX \u0026 TSX\n\n## CHANGELOG\n\n[click](./CHANGELOG.md)\n\n## RoadMap\n- support import-assertions\n\n## License\n[MIT](https://couto.mit-license.org/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftyrealhu%2Facorn-typescript","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftyrealhu%2Facorn-typescript","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftyrealhu%2Facorn-typescript/lists"}