-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
fix: error at compile time on unsupported TypeScript language features #12982
Conversation
🦋 Changeset detectedLatest commit: 8f44b58 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
It seems that What other language features do we need to consider? |
|
oh wait i mean |
Also I misspoke when I said Acorn parses decorators — it's actually acorn-typescript doing that. There is an effort underway to add TS support to esrap, which would include decorators and everything else. If that landed, would it in fact make sense to just support the features in question? |
I mean theoretically yes, but it would certainly be a non-trivial effort. The transformations that TS does under the hood are somewhat involved (you can look at the JS output tab in their playground). |
I'm not suggesting we transform TypeScript syntax, just that we understand it enough that it doesn't mess up the analysis, and then we emit TS rather than JS |
Oh so you're saying that whatever comes after Svelte has to then know "ok this is a typescript file now so I'm gonna transform it using esbuild/tsc/whatever"? @dominikg how would that impact the toolchain? |
allowing the svelte compiler to emit ts that then has to be postprocessed is going to create a lot of effort. even if it works in vite, what about all the other bundlers or even just our repl? |
Unfortunately this is the kind of thing the bundler designers of the world didn't anticipate — everything is more or less based on file extensions, so you'd need to configure the downstream transformers to keep an eye out for Have thought for a while that the ecosystem would be more robust if instead of just returning |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added validation for all features we can validate (i.e. everything that came to my mind except using
which ts-acorn doesn't parse yet). This should be a good stop gap solution until we figure out the next steps (or decide that this is the end state, which I would also be good with, given that changing toolchains is a big effort)
part of #11502 - to close it completely, we also need to look at
using
and possibly implement heuristics within bundler plugins to give more detailsBefore submitting the PR, please make sure you do the following
feat:
,fix:
,chore:
, ordocs:
.Tests and linting
pnpm test
and lint the project withpnpm lint