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

Generate TypeScript declarations files for TypeScript projects with isolatedDeclarations enabled #3775

Open
MichaelMitchell-at opened this issue May 21, 2024 · 0 comments

Comments

@MichaelMitchell-at
Copy link

MichaelMitchell-at commented May 21, 2024

Based on @evanw's comment here, it sounded like ESBuild supporting declaration files is something that's not out of the question, so I'm formally raising a feature request.

Why now
Isolated declarations has been implemented in TypeScript 5.5, currently in beta. The nightly build of TypeScript also supports a new compiler API to emit declaration files without performing typechecking, which could be used as a reference. Some aspects of the behavior are still under consideration, like what are and aren't code patterns that a non-type-aware tool could reasonably generate types for. I think it would be valuable for tool developers like @evanw to provide input, especially early on in the process, to help solidify the specification and minimize the chance for backward incompatibles changes needed to be made after TypeScript 5.5 is generally available.

Who benefits
Large, composite TypeScript projects benefit from isolated declarations. We've been testing this API at Airtable and I think we can now say that this functionality is usable in a production environment, albeit with some rough edges. We've already started integrating isolated declarations into our CI pipeline, and using a custom parallel TypeScript runner, have seen a ~20% reduction in typechecking times, which will only grow as we enable isolated declarations for more projects. I'm aware of a handful of companies so far that have expressed interest in using and or have already started contributing to isolated declarations: Airtable, Figma, Bloomberg, Google, and Shopify(?).

Why ESBuild
Using the tsc-based API to emit declaration files still takes on the order of seconds for larger TypeScript projects, which can add up. ESBuild has proven itself to be a fast and well-tested tool and there isn't really any other tool we'd rather use.

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

1 participant