Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] Support for TypeScript AST nodes #10

Open
xeho91 opened this issue Jul 11, 2024 · 1 comment
Open

[FEATURE] Support for TypeScript AST nodes #10

xeho91 opened this issue Jul 11, 2024 · 1 comment

Comments

@xeho91
Copy link

xeho91 commented Jul 11, 2024

I'm creating a package - svelte-ast-print, which under the hood uses this awesome package. Thank you for it! 馃檹

I'm attempting to achieve a momentum where I can support TypeScript syntax as well, so the ecosystem (especially for Svelte) can write codemods.
I personally have this need while contributing to @storybook/addon-svelte-csf - on an experimental support for Svelte v5. We want to improve developer's experience of migration from legacy syntax to modern. Currently, my printer (svelte-ast-print) will strip out all of the TypeScript syntax.

I know that Svelte parse does output AST nodes related to TypeScript syntax using typescript-acorn.

Possible blockers

  1. typescript-acorn doesn't provide public types (interfaces) for AST nodes, nor there's any known to me a public/official ESTree TypeScript AST specification.

    If there's an agreement to help support TypeScript AST nodes with this package - esrap. Then I can help contributing to this package with exposing types of AST nodes related to TypeScript which typescript-acorn spills out.

@dummdidumm
Copy link
Collaborator

If we agree that it's too "dangerous" to add first class support for typescript-acorn nodes, I'm wondering if instead there's a way to create somewhat of a plugin API, where devs can contribute AST node->string participants that esrap then uses in a certain manner.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants