Skip to content

feat: support TypeScript 6#675

Merged
dummdidumm merged 10 commits into
sveltejs:mainfrom
teemingc:feat-ts6
May 22, 2026
Merged

feat: support TypeScript 6#675
dummdidumm merged 10 commits into
sveltejs:mainfrom
teemingc:feat-ts6

Conversation

@teemingc

@teemingc teemingc commented Mar 31, 2026

Copy link
Copy Markdown
Member

This PR adds TS6 support by ensuring source files adhere to TS6 rules and updating one of the tests to expect the appropriate contents for a module: NodeNext output

Before submitting the PR, please make sure you do the following

  • It's really useful if your PR relates to an outstanding issue, so please reference it in your PR, or create an explanatory one for discussion. In many cases features are absent for a reason.
  • This message body should clearly illustrate what problems it solves. If there are related issues, remember to reference them.
  • Ideally, include a test that fails without this PR but passes with it. PRs will only be merged once they pass CI. (Remember to run pnpm lint!)

Tests

  • Run the tests with npm test or pnpm test

@teemingc teemingc marked this pull request as draft March 31, 2026 10:04
@teemingc teemingc marked this pull request as ready for review March 31, 2026 10:12
@teemingc teemingc mentioned this pull request Mar 31, 2026
11 tasks
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.
@Keavon

Keavon commented Apr 1, 2026

Copy link
Copy Markdown

Thank you for this patch, I look forward to it landing and releasing to npm so it resolves the peer dependency resolution issue blocking our project's upgrade to TS 6. ❤️

Comment thread src/transformers/typescript.ts
Comment thread src/autoProcess.ts
aliases,
markupTagName = 'template',
sourceMap = process?.env?.NODE_ENV === 'development' ?? false,
sourceMap = process?.env?.NODE_ENV === 'development' || false,

@teemingc teemingc May 21, 2026

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.

Fixes this TypeScript error

Right operand of ?? is unreachable because the left operand is never nullish.


expect(code).toBe(`<script lang="ts" context="module"></script>`);
expect(code).toBe(
`<script lang="ts" context="module">export {};\n</script>`,

@teemingc teemingc May 21, 2026

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.

Empty modules created with NodeNext always have export {} while ESNext simply has "use strict"

@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.

thank you!

@dummdidumm dummdidumm merged commit ae1a288 into sveltejs:main May 22, 2026
10 checks passed
@github-actions github-actions Bot mentioned this pull request May 22, 2026
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.

3 participants