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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeScript Support #2

Open
Swatinem opened this issue Sep 20, 2019 · 3 comments
Open

TypeScript Support #2

Swatinem opened this issue Sep 20, 2019 · 3 comments
Labels
enhancement New feature or request

Comments

@Swatinem
Copy link

So this will be used for the codegen in svelte soon, and the generated code quality looks promising :-)

I am having a look at https://graphql-code-generator.com/ which primarily outputs TS code and the codegen code itself looks quite horrible. My own https://github.com/eversport/intl-codegen outputting both JS and TS separately also is not that pretty.

So anyway, what I wanted to ask is: Is TS support possible with the architecture? Is it planned? Would be really awesome if I could use the same convenience to generate type annotations, and interface declarations, etc…

@Rich-Harris
Copy link
Owner

Ha, interesting — the code generation is one of the things I plan to change! It's using astring at the moment, which is excellent, but there are a few things I'd like to do slightly differently in the name of readability (collapsing objects and arrays onto a single line where appropriate, adding newline padding around multiline statements, enforcing shorthand/method properties where possible, etc).

Anyway, that's by the by. For TS, what I was imagining was that we'd generate a .d.ts file separately, rather than including type annotations in the generated code. I'll confess I haven't spent a lot of time thinking about this, so don't honestly know if it'll work or not.

@Swatinem
Copy link
Author

Swatinem commented Sep 20, 2019 via email

@marcus-sa
Copy link

Why not just use the TS compiler API to generate code instead of estree?

@Conduitry Conduitry added the enhancement New feature or request label May 9, 2020
tanhauhau pushed a commit to tanhauhau/code-red that referenced this issue Sep 13, 2022
…-svelte

make Scope methods the same as svelte's
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants