-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
[transpileDeclaration API][5.5] More missing type-only imports #58511
Comments
I'm somewhat worried that trying to adapt checker.ts to also be able to purely emit declarations will lead to more problems like these to continue to arise. It seems harder to reason about than the behavior we'd expect with isolated declarations - a mostly syntactic transformation. I'm concerned that these discrepancies will lead to compatibility issues when migrating to alternative implementations such as likely ones like ESBuild. |
This is partially fixed by #58522 - the |
@MichaelMitchell-at We have the same concerns, and we are working to mitigate them. While the errors for isolated declarations have been merged, we are still working on:
To elaborate on the second item, we are planning to extract a lot of the type reuse logic from checker.ts. This extracted type node builder (that will only use syntactic information) together with some other pieces we have already extracted (name resolution, evaluator) and other pieces we still need to extract (visibility checks) will be used to build a test declaration emitter that will not depend on checker.ts. This can be use to both prove that TS does not use any forbidden knowledge when emitting d.ts files in isolated declaration mode and it can serve as a blueprint for what other implementations need to reimplement in order to produce a similar emit (without needing to reason about the whole checker) |
Awesome! These changes continuing to be driven by folks at Bloomberg give us more confidence that isolated declarations will converge to be practical and impactful in large composite projects. At Airtable we're gradually migrating more projects to isolated declarations, which is helping to uncover bugs/edge cases and we'll continue to do so, though if there's anything we can contribute code-wise, we might be able to allocate some engineering time towards that. Please, let us know if there are any areas of opportunity for that. In particular, we'd be very interested in anything we can do to leverage isolated declarations to improve TSServer performance in VSCode. Editor performance has been the top pain point for our developers when it comes to our TypeScript usage. |
π Search Terms
transpiledeclaration api emit missing import
π Version & Regression Information
transpileDeclaration
API methodΒ #58261 @weswighamβ― Playground Link
https://www.typescriptlang.org/dev/bug-workbench/?target=7&ts=5.5.0-dev.20240512#code/PTAEAEGcBcCcEsDG0Bco4FcCmAoEEATLRAGwENYzp4B7AOzU13ygAsaB3AUQFt5o8YNp179oWAgDF4JLGjIA6AguiRBESO259o4qTLmgARkpVr14AGYG6ZHocWqcWAB4AHGrGih4dcbEsyRCxQAEk6UABvHFBQAG0AaywATzQYBDoAcwBdNAw6BLpOOgBuHABfZ3dPb19-QODQAHkMb2jYxJS0uF8cvIKijlKKqo8vdGS3EIAhMkgQgF5QAHIyZdAAHxWjZbKLa1lbezQTJ3geMbaJqbC6ABprkJboB+hJmbmQ8tBLWBoeUAAIgUwDIgL2rkuoEQ9BgoBoRgAVsRvEt2qACDQACqsXoAHixoFc4joBEgoFm8wAfAAKAD6qFAWIedN8aHCcSx2QAlGhnpzslEYrFQLAsNAMLBhrFyncKmUgA
π» Code
π Actual behavior
When using the API,
b.d.ts
is emitted aswhile when using
tsc
it gets emitted as(interestingly the Debug tab of the workbench link shows something that's partially wrong)
π Expected behavior
Using the API should emit
Additional information about the issue
No response
The text was updated successfully, but these errors were encountered: