Skip to content

chore: bump to typescript 5.9 #2808

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"lint": "prettier --check ."
},
"dependencies": {
"typescript": "^5.8.2"
"typescript": "^5.9.2"
},
"devDependencies": {
"cross-env": "^7.0.2",
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.4.0",
"svelte": "^4.2.19",
"svelte2tsx": "workspace:~",
"typescript": "^5.8.2",
"typescript": "^5.9.2",
"typescript-auto-import-cache": "^0.3.6",
"vscode-css-languageservice": "~6.3.5",
"vscode-html-languageservice": "~5.4.0",
Expand Down
24 changes: 20 additions & 4 deletions packages/language-server/src/ls-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,10 @@ export interface TSUserConfig {
workspaceSymbols?: TsWorkspaceSymbolsConfig;
}

interface TsJsSharedConfig {
hover?: { maximumLength?: number };
}

/**
* A subset of the JS/TS VS Code settings which
* are transformed to ts.UserPreferences.
Expand Down Expand Up @@ -291,6 +295,12 @@ export interface TsWorkspaceSymbolsConfig {

export type TsUserConfigLang = 'typescript' | 'javascript';

interface TsUserConfigLangMap {
typescript?: TSUserConfig;
javascript?: TSUserConfig;
'js/ts'?: TsJsSharedConfig;
}

/**
* The config as the vscode-css-languageservice understands it
*/
Expand Down Expand Up @@ -434,10 +444,11 @@ export class LSConfigManager {
);
}

updateTsJsUserPreferences(config: Record<TsUserConfigLang, TSUserConfig>): void {
updateTsJsUserPreferences(config: TsUserConfigLangMap): void {
const shared = config['js/ts'];
(['typescript', 'javascript'] as const).forEach((lang) => {
if (config[lang]) {
this._updateTsUserPreferences(lang, config[lang]);
this._updateTsUserPreferences(lang, config[lang], shared);
this.rawTsUserConfig[lang] = config[lang];
}
});
Expand All @@ -458,7 +469,11 @@ export class LSConfigManager {
this.notifyListeners();
}

private _updateTsUserPreferences(lang: TsUserConfigLang, config: TSUserConfig) {
private _updateTsUserPreferences(
lang: TsUserConfigLang,
config: TSUserConfig,
shared?: TsJsSharedConfig
) {
const { inlayHints } = config;

this.tsUserPreferences[lang] = {
Expand All @@ -482,6 +497,7 @@ export class LSConfigManager {
includeCompletionsWithObjectLiteralMethodSnippets:
config.suggest?.objectLiteralMethodSnippets?.enabled ?? true,
preferTypeOnlyAutoImports: config.preferences?.preferTypeOnlyAutoImports,
maximumHoverLength: shared?.hover?.maximumLength,

// Although we don't support incompletion cache.
// But this will make ts resolve the module specifier more aggressively
Expand Down Expand Up @@ -618,7 +634,7 @@ export class LSConfigManager {
return this.htmlConfig;
}

updateTsJsFormateConfig(config: Record<TsUserConfigLang, TSUserConfig>): void {
updateTsJsFormateConfig(config: TsUserConfigLangMap): void {
(['typescript', 'javascript'] as const).forEach((lang) => {
if (config[lang]) {
this._updateTsFormatConfig(lang, config[lang]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,19 @@ export class HoverProviderImpl implements HoverProvider {
constructor(private readonly lsAndTsDocResolver: LSAndTSDocResolver) {}

async doHover(document: Document, position: Position): Promise<Hover | null> {
const { lang, tsDoc } = await this.getLSAndTSDoc(document);
const { lang, tsDoc, userPreferences } = await this.getLSAndTSDoc(document);

const eventHoverInfo = this.getEventHoverInfo(lang, document, tsDoc, position);
if (eventHoverInfo) {
return eventHoverInfo;
}

const offset = tsDoc.offsetAt(tsDoc.getGeneratedPosition(position));
const info = lang.getQuickInfoAtPosition(tsDoc.filePath, offset);
const info = lang.getQuickInfoAtPosition(
tsDoc.filePath,
offset,
userPreferences.maximumHoverLength
);
if (!info) {
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
"value": "MouseEvent",
"location": {
"range": {
"start": { "line": 16546, "character": 10 },
"end": { "line": 16546, "character": 20 }
"start": { "line": 20928, "character": 10 },
"end": { "line": 20928, "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": 16546, "character": 10 },
"end": { "line": 16546, "character": 20 }
"start": { "line": 20928, "character": 10 },
"end": { "line": 20928, "character": 20 }
},
"uri": "<node_modules>/typescript/lib/lib.dom.d.ts"
}
Expand All @@ -21,8 +21,8 @@
"value": "EventTarget",
"location": {
"range": {
"start": { "line": 8857, "character": 10 },
"end": { "line": 8857, "character": 21 }
"start": { "line": 11562, "character": 10 },
"end": { "line": 11562, "character": 21 }
},
"uri": "<node_modules>/typescript/lib/lib.dom.d.ts"
}
Expand All @@ -32,8 +32,8 @@
"value": "HTMLButtonElement",
"location": {
"range": {
"start": { "line": 10333, "character": 10 },
"end": { "line": 10333, "character": 27 }
"start": { "line": 13261, "character": 10 },
"end": { "line": 13261, "character": 27 }
},
"uri": "<node_modules>/typescript/lib/lib.dom.d.ts"
}
Expand Down
2 changes: 1 addition & 1 deletion packages/svelte-check/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"rollup-plugin-copy": "^3.4.0",
"svelte": "^4.2.19",
"svelte-language-server": "workspace:*",
"typescript": "^5.8.2",
"typescript": "^5.9.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 @@ -746,7 +746,7 @@
"js-yaml": "^3.14.0",
"semver": "^7.7.2",
"tslib": "^2.4.0",
"typescript": "^5.8.2",
"typescript": "^5.9.2",
"vitest": "^3.2.4",
"vscode-tmgrammar-test": "^0.0.11"
},
Expand Down
2 changes: 2 additions & 0 deletions packages/svelte-vscode/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ export function activateSvelteLanguageServer(context: ExtensionContext) {
'emmet',
'javascript',
'typescript',
'js/ts',
'css',
'less',
'scss',
Expand All @@ -188,6 +189,7 @@ export function activateSvelteLanguageServer(context: ExtensionContext) {
emmet: workspace.getConfiguration('emmet'),
typescript: workspace.getConfiguration('typescript'),
javascript: workspace.getConfiguration('javascript'),
'js/ts': workspace.getConfiguration('js/ts'),
css: workspace.getConfiguration('css'),
less: workspace.getConfiguration('less'),
scss: workspace.getConfiguration('scss'),
Expand Down
2 changes: 1 addition & 1 deletion packages/svelte2tsx/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"svelte": "~4.2.19",
"tiny-glob": "^0.2.6",
"tslib": "^2.4.0",
"typescript": "^5.8.2"
"typescript": "^5.9.2"
},
"peerDependencies": {
"svelte": "^3.55 || ^4.0.0-next.0 || ^4.0 || ^5.0.0-next.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
export default class TestNoScript extends SvelteComponentTyped<{
[x: string]: never;
}, {
click: MouseEvent;
click: PointerEvent;
} & {
[evt: string]: CustomEvent<any>;
}, {
Expand All @@ -20,7 +20,7 @@ declare const __propDef: {
[x: string]: never;
};
events: {
click: MouseEvent;
click: PointerEvent;
} & {
[evt: string]: CustomEvent<any>;
};
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.8.2"
"typescript": "^5.9.2"
},
"dependencies": {
"@jridgewell/sourcemap-codec": "^1.5.0",
Expand Down
6 changes: 3 additions & 3 deletions packages/typescript-plugin/src/language-service/hover.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ export function decorateHover(
): void {
const getQuickInfoAtPosition = ls.getQuickInfoAtPosition;

ls.getQuickInfoAtPosition = (fileName: string, position: number) => {
ls.getQuickInfoAtPosition = (fileName: string, position: number, ...rest) => {
const result = getVirtualLS(fileName, info, ts);
if (!result) return getQuickInfoAtPosition(fileName, position);
if (!result) return getQuickInfoAtPosition(fileName, position, ...rest);

const { languageService, toOriginalPos, toVirtualPos } = result;
const virtualPos = toVirtualPos(position);
const quickInfo = languageService.getQuickInfoAtPosition(fileName, virtualPos);
const quickInfo = languageService.getQuickInfoAtPosition(fileName, virtualPos, ...rest);
if (!quickInfo) return quickInfo;

const source = languageService.getProgram()?.getSourceFile(fileName);
Expand Down
46 changes: 23 additions & 23 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.