Skip to content

Commit 0017146

Browse files
committed
Upgrade to TypeScript 6
- Adjust module and target settings to allow more flexibility for adapting ES Modules in the future - Adjust source code to new behaviour from the above change - Disable a few compiler errors for now Fixes #4486 Signed-off-by: David Thompson <davthomp@redhat.com>
1 parent 2bb0519 commit 0017146

11 files changed

Lines changed: 53 additions & 41 deletions

File tree

package-lock.json

Lines changed: 26 additions & 23 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1333,11 +1333,11 @@
13331333
"default": false,
13341334
"scope": "window"
13351335
},
1336-
"java.codeGeneration.generateCommentsInMarkdown": {
1337-
"type": "boolean",
1338-
"description": "Generate Javadoc comments in Markdown style (requires source compliance >= 23).",
1339-
"default": false
1340-
},
1336+
"java.codeGeneration.generateCommentsInMarkdown": {
1337+
"type": "boolean",
1338+
"description": "Generate Javadoc comments in Markdown style (requires source compliance >= 23).",
1339+
"default": false
1340+
},
13411341
"java.codeGeneration.toString.template": {
13421342
"type": "string",
13431343
"description": "The template for generating the toString method.",
@@ -2175,7 +2175,7 @@
21752175
"sinon": "^14.0.0",
21762176
"tar": "^7.5.11",
21772177
"ts-loader": "^9.4.2",
2178-
"typescript": "^4.6.4",
2178+
"typescript": "^6.0.3",
21792179
"typescript-eslint": "^8.65.0",
21802180
"webpack": "^5.105.0",
21812181
"webpack-cli": "^7.2.1"
@@ -2200,9 +2200,6 @@
22002200
"winston": "^3.2.1",
22012201
"winston-daily-rotate-file": "^4.7.1"
22022202
},
2203-
"overrides": {
2204-
"vscode-languageserver-protocol": "3.17.6-next.1"
2205-
},
22062203
"segmentWriteKey": "Y7Y5Xk8dKEhVZHTmAkFZkqgdN4d7c4lt",
22072204
"segmentWriteKeyDebug": "BflPll7uuKOCm3y0g7JpfXLVBVFBivDE"
22082205
}

src/javaServerStarter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ export function getUnicodeLocaleEnv(): { [key: string]: string } {
128128
return env;
129129
}
130130

131-
export function awaitServerConnection(port): Thenable<StreamInfo> {
131+
export function awaitServerConnection(port): Promise<StreamInfo> {
132132
const addr = parseInt(port);
133133
return new Promise((res, rej) => {
134134
const server = net.createServer(stream => {

src/log.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { createLogger, format, transports } from 'winston';
2-
import * as DailyRotateFile from 'winston-daily-rotate-file';
2+
import DailyRotateFile from 'winston-daily-rotate-file';
33

44
export function initializeLogFile(filename: string) {
55
logger.add(new DailyRotateFile({

src/requirements.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict';
22

3-
import * as expandHomeDir from 'expand-home-dir';
3+
import expandHomeDir from 'expand-home-dir';
44
import * as fse from 'fs-extra';
55
import { getRuntime, getSources, JAVAC_FILENAME, JAVA_FILENAME } from 'jdk-utils';
66
import * as path from 'path';

src/webview/globals.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/* silence warnings from typescript about not being able to analyse sideeffects of css imports */
2+
declare module "*.css" {}

test/lightweight-mode-suite/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
// a possible error to the callback or null if none.
1212

1313
import * as path from 'path';
14-
import * as Mocha from 'mocha';
14+
import Mocha from 'mocha';
1515
import { glob } from 'glob';
1616

1717
export async function run(testsRoot: string): Promise<void> {

test/standard-mode-suite/extension.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import * as assert from 'assert';
1+
import assert from 'assert';
22
import * as fs from 'fs';
33
import * as path from 'path';
44
import { env } from 'process';

test/standard-mode-suite/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
// a possible error to the callback or null if none.
1212

1313
import * as path from 'path';
14-
import * as Mocha from 'mocha';
14+
import Mocha from 'mocha';
1515
import { glob } from 'glob';
1616

1717
export async function run(testsRoot: string): Promise<void> {

tsconfig.base.json

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,23 @@
11
{
22
"compilerOptions": {
3-
"target": "es6",
4-
"moduleResolution": "node",
3+
4+
"target": "es2020",
5+
"module": "nodenext",
6+
"moduleResolution": "bundler",
7+
58
"outDir": "out",
69
"sourceMap": true,
710
"skipLibCheck": true,
11+
"strictFunctionTypes": false,
12+
"strictNullChecks": false,
13+
"noImplicitAny": false,
14+
"noImplicitThis": false,
15+
"useUnknownInCatchVariables": false,
816
"plugins": [
917
{
1018
"name": "eslint"
1119
}
1220
],
13-
}
21+
"types": ["node", "vscode", "mocha"]
22+
},
1423
}

0 commit comments

Comments
 (0)