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

type-stripping in Node.js recommendations? #287

Open
marcomuser opened this issue Dec 13, 2024 · 10 comments · May be fixed by #297
Open

type-stripping in Node.js recommendations? #287

marcomuser opened this issue Dec 13, 2024 · 10 comments · May be fixed by #297

Comments

@marcomuser
Copy link

Node.js is adding native ts support. It would be great if the Node.js tsconfigs would follow the official recommendations: https://nodejs.org/docs/latest/api/typescript.html#type-stripping

@orta
Copy link
Member

orta commented Dec 14, 2024

I think we'd need a separate one for that, the type-stripping in node is experimental and requires flagging

@orta orta changed the title Follow Node.js recommendations type-stripping in Node.js recommendations? Dec 14, 2024
@jakebailey
Copy link

I'm not sure those are options that one should be enabling without understanding what you're doing already; those flags are also incomplete until TS adds the ability to block bad syntax and require .ts in imports as well.

@marcomuser
Copy link
Author

A separate tsconfig sounds reasonable! Would you then wait for the tsconfig option mentioned (reference for others: microsoft/TypeScript#59601), or could we go ahead and provide a “strip-types” tsconfig that could be kept in sync with the Node.js recommendations for this mode going forward?

@kachkaev
Copy link

kachkaev commented Jan 30, 2025

TypeScript 5.8 beta was just released with a new erasableSyntaxOnly option:
https://devblogs.microsoft.com/typescript/announcing-typescript-5-8-beta/#the---erasablesyntaxonly-option

It'd be great to see erasableSyntaxOnly as part of @tsconfig/strictest.

@vladshcherbin
Copy link

Would be so nice to have a config with nodejs recommendations and erasableSyntaxOnly

@kachkaev
Copy link

TypeScript 5.8.2 is out!
https://devblogs.microsoft.com/typescript/announcing-typescript-5-8/

What are the downsides of adding erasableSyntaxOnly to @tsconfig/strictest?

@jakebailey
Copy link

They have nothing to do with type error level strictness, and only about limiting the syntax to be able to run in type-erasing transformers (Node's amaro, ts-blank-space). People might be pretty unsatisfied if they're using enums, namespaces, etc.

There's a config mixin for this in #293 though, if you want it (wasn't linked here, oops).

@kachkaev
Copy link

kachkaev commented Feb 28, 2025

Oh I did not know about @tsconfig/node-ts. Great stuff! I believe that this issue can be closed as resolved (in #293).

@vladshcherbin
Copy link

Would be nice to see this config mixin in readme table of contents otherwise the issue is resolved. Thank you!

@jakebailey
Copy link

Sent #297.

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

Successfully merging a pull request may close this issue.

5 participants