feat: typescript 6.0 support#2985
Conversation
🦋 Changeset detectedLatest commit: 0f1ce0b The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
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 |
| "svelte": "^4.2.19", | ||
| "svelte2tsx": "workspace:~", | ||
| "typescript": "^5.9.2", | ||
| "typescript": "^5.9.2 || ^6.0.2", |
There was a problem hiding this comment.
I'm not sure if the || syntax works here. Is the intention to provide support for both? It might be better to specify this as a peerDep instead 🤔 though I'm not sure how that works with VS Code extensions
There was a problem hiding this comment.
Yeah, it's meant to support both. I tested by installing a git repository, and it seems to be working as I intended: By default, it installs 6.0 and can be manually overridden to be 5.9. I think we can also move it to peerDep and mark it a breaking change?
There was a problem hiding this comment.
peer dep sounds good, though we gotta do language-server package as a minor then
|
About the failed test. I narrowed down the problem to Edit: Just noticed TypeScript team has updated the README with a merge criteria for the old codebase. Guess we have missed the beta/RC phase to get this fixed 😅. |
|
Draft until the next release. Wanted to release the current patches before we update the extension to use TypeScript 6. |
it might have run too fast
closes #15372 This PR extends the SvelteKit peerDep range to include TS 6.0. It also upgrades our apps/packages using TS purely as a devDependency to use 6.0 (this excludes `kit` because we use TS to generate public types and that can be a breaking change. `package` is also excluded because it can't support TS6 until svelte2tsx does). ### TODOs - [x] update `svelte-check` sveltejs/language-tools#2988 Required for `@sveltejs/package` if we want to support TS6 in the future: - [ ] update `svelte2tsx` sveltejs/language-tools#2985 - [ ] update `svelte-preprocess` sveltejs/svelte-preprocess#675 Required for SvelteKit 3 when we switch over to TS6 completely - [x] update `@sveltejs/eslint-config` sveltejs/eslint-config#67 - [ ] update `dts-buddy` sveltejs/dts-buddy#123 --- ### Please don't delete this checklist! Before submitting the PR, please make sure you do the following: - [ ] It's really useful if your PR references an issue where it is discussed ahead of time. In many cases, features are absent for a reason. For large changes, please create an RFC: https://github.com/sveltejs/rfcs - [ ] This message body should clearly illustrate what problems it solves. - [ ] Ideally, include a test that fails without this PR but passes with it. ### Tests - [ ] Run the tests with `pnpm test` and lint the project with `pnpm lint` and `pnpm check` ### Changesets - [ ] If your PR makes a change that should be noted in one or more packages' changelogs, generate a changeset by running `pnpm changeset` and following the prompts. Changesets that add features should be `minor` and those that fix bugs should be `patch`. Please prefix changeset messages with `feat:`, `fix:`, or `chore:`. ### Edits - [ ] Please ensure that 'Allow edits from maintainers' is checked. PRs without this option may be closed.
| @@ -1,5 +1,6 @@ | |||
| { | |||
| "compilerOptions": { | |||
| "strict": false, | |||
There was a problem hiding this comment.
one day we will mark this strict and fight all the errors that come from it 😆
Mhhhm can we adjust the type in a way that it's not that costly anymore? Feels kinda bad that it will regress this much per keystroke. |
Maybe we could still try our luck to open an issue. Not entirely sure why it does that. |
|
Pretty weird that the performance problem also happened in typescript go on another PC. I created |
|
Hmm. It actually isn't caused by runtime code changes in TypeScript 6, but the DOM definition update. Might be an existing problem that gets triggered by the DOM update. TypeScript 6 is also noticeably faster in some areas. Besides the performance test, our language server test is reliably faster with TypeScript 6. I also just noticed that the benchmark in the performance test is faster, so part of the reason it failed is that the target time has also decreased. |
shouldn't matter in most cases but still restore the original logic
|
I'll merge this next week if there's no objection. The upstream issue for the |
… branch 'master' of https://github.com/sveltejs/language-tools into ts-6.0
User Migration Guide
TypeScript is now a peerDependency
For users manually installing the language server, this includes VSCode users using the "svelte.language-server.ls-path" config. You also need to install TypeScript for the language server if it's not automatically installed.
TypeScript 6
See https://devblogs.microsoft.com/typescript/announcing-typescript-6-0/#breaking-changes-and-deprecations-in-typescript-6.0
Most notably:
strict: falseto your tsconfig.json/jsconfig.json.PR details
This changes our moduleResolution config to node16 or bundler. It's mostly just some config changes. Only problem is
estree-walker. The types forestree-walkerv2 can't be resolved undernode16, but v3 is ESM only, so copying the type for now.As for bundling TypeScript 6, this is definitely a breaking change for the extension. Is there any other breaking change we want to ship with this?
And what about language-server? Is this considered a breaking change if both are allowed? Actually don't know ifThis will also move typescript to||works independencies.peerDependency, so it'll be a breaking change.