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

feat: upgrade to TypeScript 5 #9435

Merged
merged 4 commits into from
Mar 20, 2023
Merged

feat: upgrade to TypeScript 5 #9435

merged 4 commits into from
Mar 20, 2023

Conversation

benmccann
Copy link
Member

woohoo!

@changeset-bot
Copy link

changeset-bot bot commented Mar 17, 2023

🦋 Changeset detected

Latest commit: ec85974

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
create-svelte Minor

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-bot
Copy link

changeset-bot bot commented Mar 17, 2023

🦋 Changeset detected

Latest commit: 175fb60

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
create-svelte Minor

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

@Rich-Harris
Copy link
Member

should we do #8337 as part of this, or in a follow-up?

@dummdidumm
Copy link
Member

I'm still against doing #8337 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"
Copy link
Member

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.

Copy link
Contributor

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"?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think so, yes

Copy link
Contributor

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"?

Copy link
Member Author

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

Copy link
Member

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.

@Rich-Harris Rich-Harris merged commit 031868c into master Mar 20, 2023
@Rich-Harris Rich-Harris deleted the ts-5 branch March 20, 2023 18:52
@github-actions github-actions bot mentioned this pull request Mar 20, 2023
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 this pull request may close these issues.

None yet

4 participants