Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
10 changes: 10 additions & 0 deletions .changeset/typescript-v6.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
'@astrojs/language-server': patch
'@astrojs/ts-plugin': patch
'@astrojs/yaml2ts': patch
'@astrojs/netlify': patch
'@astrojs/db': patch
'astro': patch
---

Updates `typescript` to v6. No changes are needed from users.
3 changes: 1 addition & 2 deletions configs/tsconfig.language-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
"target": "ES2021",
"lib": ["WebWorker", "ES2021"],
"module": "commonjs",
// TODO: when upgrading to TS 6, will need to be set to "bundler"
"moduleResolution": "node",
"moduleResolution": "bundler",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🙌

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.

Can somehow explain why this change and why it's good?

@ocavue ocavue May 15, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

TLDR:

  1. We use commonjs output for language tool packages.
  2. In TS 5.x, to use --module commonjs, you have to use --moduleResolution node (AKA --moduleResolution node10).
  3. Since TS 6.x, --moduleResolution node is deprecated and not allowed to be used anymore by default.
  4. In TS 6.x, to use --module commonjs, we need to use --moduleResolution bundler.

More to read:

"verbatimModuleSyntax": false,
"erasableSyntaxOnly": false
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
"publint": "^0.3.17",
"tinyglobby": "^0.2.16",
"turbo": "^2.8.15",
"typescript": "~5.9.3",
"typescript": "~6.0.3",
"typescript-eslint": "^8.59.1",
"valibot": "^1.2.0"
}
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/e2e/fixtures/actions-blog/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
"astro": "workspace:*",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"typescript": "^5.9.3"
"typescript": "^6.0.3"
}
}
2 changes: 1 addition & 1 deletion packages/astro/e2e/fixtures/actions-react-19/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"astro": "workspace:*",
"react": "19.2.4",
"react-dom": "19.2.4",
"typescript": "^5.9.3"
"typescript": "^6.0.3"
},
"overrides": {
"@types/react": "npm:types-react",
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@
"remark-code-titles": "^0.1.2",
"rollup": "^4.58.0",
"sass": "^1.98.0",
"typescript": "^5.9.3",
"typescript": "^6.0.3",
"undici": "^7.22.0",
"unified": "^11.0.5",
"vitest": "^4.1.0"
Expand Down
9 changes: 7 additions & 2 deletions packages/astro/test/astro-sync.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,13 @@ const createFixture = () => {
},
});
assert.equal(
result.outputText,
'',
result.outputText.trim(),
// Since TypeScript v6.0, all code will be assumed to be in
// JavaScript strict mode, thus the "use strict" directive
// is always emitted.
//
// See https://www.typescriptlang.org/docs/handbook/release-notes/typescript-6-0.html#deprecated---alwaysstrict-false
'"use strict";',
`${path} should be valid TypeScript. Output: ${result.outputText}`,
);
} catch (error) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
"dependencies": {
"astro": "workspace:*",
"@astrojs/check": "workspace:*",
"typescript": "^5.9.3"
"typescript": "^6.0.3"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
"dependencies": {
"astro": "workspace:*",
"@astrojs/check": "workspace:*",
"typescript": "^5.9.3"
"typescript": "^6.0.3"
}
}
2 changes: 1 addition & 1 deletion packages/astro/test/types/session-data.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import './session-env';
import './session-env.d.ts';
import { describe, it } from 'node:test';
import { expectTypeOf } from 'expect-type';
import { AstroSession } from '../../dist/core/session/runtime.js';
Expand Down
2 changes: 1 addition & 1 deletion packages/db/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
"astro-scripts": "workspace:*",
"cheerio": "1.2.0",
"expect-type": "^1.3.0",
"typescript": "^5.9.3",
"typescript": "^6.0.3",
"vite": "^7.3.2"
}
}
2 changes: 1 addition & 1 deletion packages/integrations/netlify/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"astro-scripts": "workspace:*",
"cheerio": "1.2.0",
"devalue": "^5.6.3",
"typescript": "^5.9.3"
"typescript": "^6.0.3"
},
"astro": {
"external": true
Expand Down
2 changes: 1 addition & 1 deletion packages/language-tools/language-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"@volar/typescript": "~2.4.28",
"astro-scripts": "workspace:*",
"tsx": "^4.21.0",
"typescript": "^5.9.3",
"typescript": "^6.0.3",
"vscode-languageserver-protocol": "^3.17.5",
"vscode-languageserver-textdocument": "^1.0.12"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
root = true

[*]
# Scoped to editorConfig.astro. Ensure other files are not affected by this configuration.
[editorConfig.astro]
end_of_line = crlf
8 changes: 7 additions & 1 deletion packages/language-tools/language-server/test/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { startLanguageServer } from '@volar/test-utils';
import * as protocol from 'vscode-languageserver-protocol/node.js';
import type { TextDocument } from 'vscode-languageserver-textdocument';
import { URI } from 'vscode-uri';
import { fixtureDir } from './test-utils.ts';

let serverHandle: LanguageServerHandle | undefined;
let initializeResult: protocol.InitializeResult | undefined;
Expand Down Expand Up @@ -66,7 +67,12 @@ export async function getLanguageServer(): Promise<LanguageServer> {
initializeResult: initializeResult,
openFakeDocument: async (content: string, languageId: string) => {
const hash = createHash('sha256').update(content).digest('base64url');
const uri = URI.file(`does-not-exists-${hash}-.astro`).toString();
// The path must live inside the fixture directory so that TypeScript's
// module resolution can walk up to `fixture/node_modules/astro/jsx-runtime.d.ts`
// when resolving the `@jsxImportSource astro` pragma in the generated TSX.
// Under TS6, an unresolvable pragma cascades into TS7026 errors on every
// intrinsic JSX element (`<div>`, `<script>`, ...).
const uri = URI.file(path.join(fixtureDir, `does-not-exists-${hash}-.astro`)).toString();
const textDocument = await serverHandle!.openInMemoryDocument(uri, languageId, content);

return textDocument;
Expand Down
2 changes: 1 addition & 1 deletion packages/language-tools/ts-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"@vscode/test-electron": "^2.5.2",
"mocha": "^11.7.5",
"tsx": "^4.21.0",
"typescript": "^5.9.3",
"typescript": "^6.0.3",
"vscode-uri": "^3.1.0"
}
}
2 changes: 1 addition & 1 deletion packages/language-tools/yaml2ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@
},
"devDependencies": {
"@volar/language-core": "~2.4.28",
"typescript": "^5.9.3"
"typescript": "^6.0.3"
}
}
Loading
Loading