Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/calm-birds-show.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'svelte-language-server': patch
'svelte-check': patch
'svelte2tsx': patch
---

feat: typescript 6.0 support
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"changeset:publish": "changeset publish"
},
"dependencies": {
"typescript": "^5.9.2"
"typescript": "^6.0.2"
},
"devDependencies": {
"@changesets/cli": "^2.29.7",
Expand Down
2 changes: 1 addition & 1 deletion packages/language-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"prettier-plugin-svelte": "^3.5.0",
"svelte": "^4.2.19",
"svelte2tsx": "workspace:~",
"typescript": "^5.9.2",
"typescript": "^5.9.2 || ^6.0.2",
Copy link
Copy Markdown
Member

@teemingc teemingc Mar 24, 2026

Choose a reason for hiding this comment

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

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

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.

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?

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.

peer dep sounds good, though we gotta do language-server package as a minor then

"typescript-auto-import-cache": "^0.3.6",
"vscode-css-languageservice": "~6.3.5",
"vscode-html-languageservice": "~5.4.0",
Expand Down
34 changes: 34 additions & 0 deletions packages/language-server/src/ambient.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
declare module 'estree-walker' {
export function walk(
ast: import('estree').BaseNode,
{
enter,
leave
}: {
enter?: (
this: {
skip: () => void;
remove: () => void;
replace: (node: import('estree').BaseNode) => void;
},
node: import('estree').BaseNode,
parent: import('estree').BaseNode,
key: string,
index: number
) => void;
leave?: (
this: {
skip: () => void;
remove: () => void;
replace: (node: import('estree').BaseNode) => void;
},
node: import('estree').BaseNode,
parent: import('estree').BaseNode,
key: string,
index: number
) => void;
}
): import('estree').BaseNode;

export type BaseNode = import('estree').BaseNode;
}
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,12 @@ export function createProject(
return undefined;
}

const factory = minor < 3 ? createProject50 : minor < 5 ? createProject53 : createProject55;
const factory =
major === 5 && minor < 3
? createProject50
: major === 5 && minor < 5
? createProject53
: createProject55;
const project = factory(ts, host, createLanguageService, options);

const proxyMethods: (keyof typeof project)[] = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
},
"severity": 1,
"source": "ts",
"message": "Type 'Component' is not assignable to type 'OtherComponent'.\n Type '{ prop: boolean; }' is not assignable to type '{ prop: string; }'.\n Types of property 'prop' are incompatible.\n Type 'boolean' is not assignable to type 'string'.",
"message": "Type 'Component' is not assignable to type 'OtherComponent'.\n The types of '$$prop_def.prop' are incompatible between these types.\n Type 'boolean' is not assignable to type 'string'.",
"code": 2322,
"tags": []
},
Expand Down Expand Up @@ -69,7 +69,7 @@
},
"severity": 1,
"source": "ts",
"message": "Type 'Component' is not assignable to type 'OtherComponent'.\n Type '{ prop: boolean; }' is not assignable to type '{ prop: string; }'.\n Types of property 'prop' are incompatible.\n Type 'boolean' is not assignable to type 'string'.",
"message": "Type 'Component' is not assignable to type 'OtherComponent'.\n The types of '$$prop_def.prop' are incompatible between these types.\n Type 'boolean' is not assignable to type 'string'.",
"code": 2322,
"tags": []
},
Expand All @@ -80,7 +80,7 @@
},
"severity": 1,
"source": "ts",
"message": "Type 'ComponentWithGeneric<boolean>' is not assignable to type 'ComponentWithGeneric<string>'.\n Type 'boolean' is not assignable to type 'string'.",
"message": "Type 'ComponentWithGeneric<boolean>' is not assignable to type 'ComponentWithGeneric<string>'.\n The types of '$$prop_def.prop' are incompatible between these types.\n Type 'boolean' is not assignable to type 'string'.",
"code": 2322,
"tags": []
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"compilerOptions": {
"checkJs": true,
"strict": false,
/**
This is actually not needed, but makes the tests faster
because TS does not look up other types.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"compilerOptions": {
"strict": false,
/**
This is actually not needed, but makes the tests faster
because TS does not look up other types.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
"value": "MouseEvent",
"location": {
"range": {
"start": { "line": 20928, "character": 10 },
"end": { "line": 20928, "character": 20 }
"start": { "line": 25013, "character": 10 },
"end": { "line": 25013, "character": 20 }
},
"uri": "<node_modules>/typescript/lib/lib.dom.d.ts"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"value": "MouseEvent",
"location": {
"range": {
"start": { "line": 20928, "character": 10 },
"end": { "line": 20928, "character": 20 }
"start": { "line": 25013, "character": 10 },
"end": { "line": 25013, "character": 20 }
},
"uri": "<node_modules>/typescript/lib/lib.dom.d.ts"
}
Expand All @@ -21,8 +21,8 @@
"value": "EventTarget",
"location": {
"range": {
"start": { "line": 11562, "character": 10 },
"end": { "line": 11562, "character": 21 }
"start": { "line": 14373, "character": 10 },
"end": { "line": 14373, "character": 21 }
},
"uri": "<node_modules>/typescript/lib/lib.dom.d.ts"
}
Expand All @@ -32,8 +32,8 @@
"value": "HTMLButtonElement",
"location": {
"range": {
"start": { "line": 13261, "character": 10 },
"end": { "line": 13261, "character": 27 }
"start": { "line": 17284, "character": 10 },
"end": { "line": 17284, "character": 27 }
},
"uri": "<node_modules>/typescript/lib/lib.dom.d.ts"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -632,6 +632,7 @@ describe('service', () => {
compilerOptions: {
composite: true,
strict: true,
module: 'NodeNext',
moduleResolution: 'NodeNext'
},
files: ['index.ts']
Expand Down
8 changes: 5 additions & 3 deletions packages/language-server/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"compilerOptions": {
"lib": ["es2021"],
"target": "es2021",
"moduleResolution": "node",
"module": "CommonJS",
"moduleResolution": "node16",
"module": "node16",

"outDir": "dist",
"strict": true,
Expand All @@ -12,6 +12,8 @@
"sourceMap": true,
"composite": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true
"rootDir": ".",
"forceConsistentCasingInFileNames": true,
"types": ["@types/mocha"]
Comment thread
teemingc marked this conversation as resolved.
Outdated
}
}
2 changes: 1 addition & 1 deletion packages/svelte-check/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"svelte2tsx": "workspace:*",
"svelte": "^4.2.19",
"svelte-language-server": "workspace:*",
"typescript": "^5.9.2",
"typescript": "^6.0.2",
"vscode-languageserver": "8.0.2",
"vscode-languageserver-protocol": "3.17.2",
"vscode-languageserver-types": "3.17.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/svelte-vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -760,7 +760,7 @@
"js-yaml": "^3.14.0",
"semver": "^7.7.2",
"tslib": "^2.4.0",
"typescript": "^5.9.2",
"typescript": "^6.0.2",
"vitest": "^3.2.4",
"textmate-grammar-test": "^0.6.0"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/svelte-vscode/test/sveltekit/utils.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ describe('checkProjectKind', () => {
it(name, async () => {
setupMocks(config);

const utils = await import('../../src/sveltekit/utils');
const utils = await import('../../src/sveltekit/utils.js');
const result = await utils.checkProjectKind('/test/path');

expect(result[ex]).toBe(toBe);
Expand Down
4 changes: 2 additions & 2 deletions packages/svelte-vscode/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"compilerOptions": {
"lib": ["es2021"],
"module": "CommonJS",
"module": "node16",
"target": "es2021",
"moduleResolution": "node",
"moduleResolution": "node16",

"outDir": "dist",
"strict": true,
Expand Down
4 changes: 2 additions & 2 deletions packages/svelte2tsx/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@
"svelte": "~4.2.19",
"tiny-glob": "^0.2.6",
"tslib": "^2.4.0",
"typescript": "^5.9.2"
"typescript": "^6.0.2"
},
"peerDependencies": {
"svelte": "^3.55 || ^4.0.0-next.0 || ^4.0 || ^5.0.0-next.0",
"typescript": "^4.9.4 || ^5.0.0"
"typescript": "^4.9.4 || ^5.0.0 || ^6.0.0"
},
"scripts": {
"build": "rollup -c",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"compilerOptions": {
"strict": false,
"checkJs": true
},
"include": ["./src/**/*.d.ts", "./src/**/*.js", "./src/**/*.ts", "./src/**/*.svelte"]
Expand Down
7 changes: 4 additions & 3 deletions packages/svelte2tsx/test/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
"compilerOptions": {
"types": ["@types/node", "@types/mocha"],
"target": "es6",
"module": "commonjs",
"moduleResolution": "node",
"esModuleInterop": true
"module": "nodenext",
"moduleResolution": "nodenext",
"esModuleInterop": true,
"rootDir": "."
Comment thread
teemingc marked this conversation as resolved.
},
"exclude": ["samples/**"],
"include": ["*.ts"]
Expand Down
8 changes: 7 additions & 1 deletion packages/svelte2tsx/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"compilerOptions": {
"strict": false,
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.

one day we will mark this strict and fight all the errors that come from it 😆

"target": "es2018",
"lib": ["ES2018"],
"rootDir": "src",
Expand All @@ -12,14 +13,19 @@
//let rollup handle these
"module": "esnext",
"moduleResolution": "node",

// rollup typescript plugin currently override moduleResolution to node
"ignoreDeprecations": "6.0",
"resolveJsonModule": true,
"allowSyntheticDefaultImports": true,
"forceConsistentCasingInFileNames": true,

"noImplicitThis": true,
"noUnusedLocals": true,
"noUnusedParameters": true
"noUnusedParameters": true,
"types": ["node"]
},
"include": ["src/*"],
"paths": {
"@/*": ["src/*"]
},
Expand Down
2 changes: 1 addition & 1 deletion packages/typescript-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"devDependencies": {
"@types/node": "^18.0.0",
"svelte": "^4.2.19",
"typescript": "^5.9.2"
"typescript": "^6.0.2"
},
"dependencies": {
"@jridgewell/sourcemap-codec": "^1.5.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/typescript-plugin/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"compilerOptions": {
"lib": ["es2021"],
"target": "es2021",
"moduleResolution": "node",
"module": "CommonJS",
"moduleResolution": "node16",
"module": "node16",

"outDir": "dist",
"esModuleInterop": true,
Expand Down
Loading
Loading