Skip to content

fix: support TypeScript 7 under npm alias#3073

Open
jasonlyu123 wants to merge 11 commits into
masterfrom
ts7rc
Open

fix: support TypeScript 7 under npm alias#3073
jasonlyu123 wants to merge 11 commits into
masterfrom
ts7rc

Conversation

@jasonlyu123

@jasonlyu123 jasonlyu123 commented Jul 1, 2026

Copy link
Copy Markdown
Member

#3063 This PR adds a version check in bin/svelte-check before importing the main entry point. This way, we can throw an error about TypeScript 7 without having to remove all the top-level ts import just yet.

This also allows loading TypeScript 7 through an npm alias. i.e. install TypeScript 7 as "typescript-7": "npm:typescript@rc". This is mostly preparing for TypeScript 7 stable. According to the TypeScript RC announcement, once the stable version is released, the nightly version will also be released under "typescript" instead of "@typescript/native-preview".

I was originally considering moving all top-level imports to a few dynamic imports. And we try to load TypeScript 6 from @typescript/typescript-6. But even if we do that, people might still run into issues with svelte-kit sync and typescript-eslint

@changeset-bot

changeset-bot Bot commented Jul 1, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 51114db

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

This PR includes changesets to release 2 packages
Name Type
svelte-check Patch
svelte2tsx Patch

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

Comment thread packages/svelte-check/README.md Outdated
Comment thread packages/svelte2tsx/src/emitDts.ts
@jasonlyu123 jasonlyu123 changed the title fix: support TypeScript 7 rc under npm alias fix: support TypeScript 7 RC under npm alias Jul 1, 2026
@jasonlyu123 jasonlyu123 changed the title fix: support TypeScript 7 RC under npm alias fix: support TypeScript 7 under npm alias Jul 9, 2026

@dummdidumm dummdidumm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Some stylistic comments otherwise looks good - now that TS7 is out and we know that they will not release it under the preview anymore is there anything we need to adjust in this PR?

Comment thread packages/svelte-check/bin/ts-version-check.js Outdated
Comment thread packages/svelte-check/bin/ts-version-check.js Outdated
Comment thread packages/svelte-check/bin/ts-version-check.js Outdated
Comment thread packages/svelte-check/bin/ts-version-check.js Outdated
Comment thread packages/svelte-check/src/tsgo.ts Outdated
Comment thread packages/svelte-check/README.md Outdated
Comment thread packages/svelte-check/README.md Outdated
Comment thread packages/svelte2tsx/src/emitDts.ts Outdated
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
@Suya1671

Suya1671 commented Jul 9, 2026

Copy link
Copy Markdown

It seems the typescript devs want the reverse to happen, since the put typescript 6 under a namespace. Maybe the repo should move to instead?

@jasonlyu123

Copy link
Copy Markdown
Member Author

now that TS7 is out and we know that they will not release it under the preview anymore is there anything we need to adjust in this PR?

Just checked it again. I think that is all I can think of right now. We prioritise typescript-7 over @typescript/native-preview. And the one error message that mentioned @typescript/native-preview is checking for 7.0 nightly; people using 7.1 won't see it.

@jasonlyu123

Copy link
Copy Markdown
Member Author

It seems the typescript devs want the reverse to happen, since the put typescript 6 under a namespace. Maybe the repo should move to instead?

It's explained here.

I was originally considering moving all top-level imports to a few dynamic imports. And we try to load TypeScript 6 from @typescript/typescript-6. But even if we do that, people might still run into issues with svelte-kit sync and typescript-eslint

@jasonlyu123

jasonlyu123 commented Jul 9, 2026

Copy link
Copy Markdown
Member Author

Seems like they updated the blog to replace the typescript-7 alias with @typescript/native. It's because npm prioritises "typescript" over "typescript-7" when resolving the bin name conflict. I'll change it to that as well.

@1Kanan1

This comment was marked as duplicate.

@zsh

This comment was marked as duplicate.

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.

5 participants