Skip to content

fix: typescript 6.0 compatibility#2988

Merged
jasonlyu123 merged 2 commits into
masterfrom
ts_6_0_runtime
Mar 26, 2026
Merged

fix: typescript 6.0 compatibility#2988
jasonlyu123 merged 2 commits into
masterfrom
ts_6_0_runtime

Conversation

@jasonlyu123
Copy link
Copy Markdown
Member

extracted from #2985. This is the only runtime compatibility problem I found with TypeScript 6.0. Extracted out so we can release this separately.

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Mar 24, 2026

🦋 Changeset detected

Latest commit: d43d6e9

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

This PR includes changesets to release 2 packages
Name Type
svelte-language-server Patch
svelte-check 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 on lines +74 to +79
const factory =
major === 5 && minor < 3
? createProject50
: major === 5 && minor < 5
? createProject53
: createProject55;
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.

The original double ternary was already kind of difficult to read, would it be too much to refactor to an IIFE

const factory = (() => {
    if (major === 5 && minor < 3) return createProject50;
    if (major === 5 && minor < 5) return createProject53;
    return createProject55;
})();

Which is probably more friendly to future additions, e.g. a hypothetical

const factory = (() => {
    if (major === 5 && minor < 3) return createProject50;
    if (major === 5 && minor < 5) return createProject53;
    if (major === 5 && minor <= 9) return createProject55;
    return createProject60;
})();

And would have made it easier to spot the initial issue, as it would have been like this:

const factory = (() => {
    if (minor < 3) return createProject50;
    if (minor < 5) return createProject53;
    return createProject55;
    // clearly not checking major
})();

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Tweaked. This might be the last time we touch this 😆. There most likely won't be a new version anyway.

@jasonlyu123 jasonlyu123 merged commit 8fc3d43 into master Mar 26, 2026
3 checks passed
@jasonlyu123 jasonlyu123 deleted the ts_6_0_runtime branch March 26, 2026 00:56
@github-actions github-actions Bot mentioned this pull request Mar 26, 2026
@teemingc teemingc mentioned this pull request Mar 27, 2026
11 tasks
bdarcus added a commit to citum/citum-hub that referenced this pull request Mar 28, 2026
Raise svelte-check to the newest published release and patch its\nproject factory selection at install time until upstream ships the\nTypeScript 6 compatibility fix from sveltejs/language-tools#2988.\n\nAlso fix the remaining client-side TypeScript 6 inference regressions\nin wizard and style pages so lint, format, check, and build pass on the\nupgraded branch.
bdarcus added a commit to citum/citum-hub that referenced this pull request Mar 28, 2026
Raise svelte-check to the newest published release and patch its
project factory selection at install time until upstream ships the
TypeScript 6 compatibility fix from sveltejs/language-tools#2988.

Pin svelte-check to the patched release and make the postinstall
workaround non-fatal when the upstream file no longer matches the
expected snippet so installs do not break on already-fixed packages or
minor internal drift.

Also fix the remaining client-side TypeScript 6 inference regressions
in wizard and style pages so lint, format, check, and build pass on the
upgraded branch.
bdarcus added a commit to citum/citum-hub that referenced this pull request Mar 28, 2026
Raise svelte-check to the newest published release and patch its
project factory selection at install time until upstream ships the
TypeScript 6 compatibility fix from sveltejs/language-tools#2988.

Pin svelte-check to the patched release and make the postinstall
workaround non-fatal when the upstream file no longer matches the
expected snippet so installs do not break on already-fixed packages or
minor internal drift.

Also fix the remaining client-side TypeScript 6 inference regressions
in wizard and style pages so lint, format, check, and build pass on the
upgraded branch.
teemingc added a commit to sveltejs/kit that referenced this pull request Apr 1, 2026
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.
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.

2 participants