-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
feat: upgrade to TypeScript 5 #9435
Conversation
🦋 Changeset detectedLatest commit: ec85974 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 |
🦋 Changeset detectedLatest commit: 175fb60 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 |
should we do sveltejs/cli#204 as part of this, or in a follow-up? |
I'm still against doing sveltejs/cli#204 either way, it's just too uncommon, everybody will be confused by this. |
@@ -9,6 +9,6 @@ | |||
"skipLibCheck": true, | |||
"sourceMap": true, | |||
"strict": true, | |||
"moduleResolution": "NodeNext" | |||
"moduleResolution": "bundler" |
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.
Not sure we can change this - for people who author packages and then publish them, the .js
file endings still are necessary if regular node should be able to resolve it. Then again, this is not the case for Svelte libraries since they are noExternal'd and therefore loaded through bundlers which probably can deal with it - we need to test this.
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.
@dummdidumm You're saying consumers should use moduleResolution": "bundler"
but projects published to NPM should stick with "moduleResolution": "NodeNext"
?
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 think so, yes
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 don't understand the subtleties here but what about packages that are both consumed by others and depend on other packages? Still "NodeNext"
?
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.
Ok, I've reverted that part for now. Maybe we should set it in the generated tsconfig.json
file? But we'd have to somehow detect which version of TypeScript the user has, so I'm not quite sure how we'd handle it. Maybe we leave that for a separate change
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 don't understand the subtleties here but what about packages that are both consumed by others and depend on other packages? Still "NodeNext"?
Yes. As soon as you make something that's consumable by others and which should be loaded through Node, it needs the .js
file endings because of ESM resolution mode - strictly speaking, at least. It could be that when you have a Svelte library which you can only consume via a bundler anway, that it doesn't matter then, because the bundler knows how to deal with the imports without file endings.
woohoo!