From 025d6d68bbbc8cc8d3deabae20e05e93c47c02fb Mon Sep 17 00:00:00 2001 From: Timo Stamm Date: Tue, 5 Nov 2024 11:08:22 +0100 Subject: [PATCH] Update to TypeScript 5.6.3 --- package-lock.json | 102 +++++++++++++++--- package.json | 2 +- packages/protobuf-example/package.json | 2 +- packages/protobuf/src/reflect/reflect.ts | 6 +- packages/protobuf/src/wire/size-delimited.ts | 2 +- packages/protoplugin-example/package.json | 2 +- .../typescript-compat/v4.9.x/package.json | 2 +- .../typescript-compat/v5.0.x/package.json | 2 +- .../typescript-compat/v5.1.x/package.json | 2 +- .../typescript-compat/v5.2.x/package.json | 2 +- .../typescript-compat/v5.3.x/package.json | 11 ++ .../typescript-compat/v5.3.x/tsconfig.json | 20 ++++ .../typescript-compat/v5.4.x/package.json | 11 ++ .../typescript-compat/v5.4.x/tsconfig.json | 20 ++++ .../typescript-compat/v5.5.x/package.json | 11 ++ .../typescript-compat/v5.5.x/tsconfig.json | 20 ++++ 16 files changed, 193 insertions(+), 24 deletions(-) create mode 100644 packages/typescript-compat/v5.3.x/package.json create mode 100644 packages/typescript-compat/v5.3.x/tsconfig.json create mode 100644 packages/typescript-compat/v5.4.x/package.json create mode 100644 packages/typescript-compat/v5.4.x/tsconfig.json create mode 100644 packages/typescript-compat/v5.5.x/package.json create mode 100644 packages/typescript-compat/v5.5.x/tsconfig.json diff --git a/package-lock.json b/package-lock.json index d44e3e14e..791459ad1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -34,7 +34,7 @@ "jest": "^29.7.0", "prettier": "^3.3.3", "turbo": "^2.2.3", - "typescript": "^5.5.4" + "typescript": "^5.6.3" }, "engines": { "node": ">=18", @@ -1985,9 +1985,9 @@ } }, "node_modules/@types/node": { - "version": "22.8.7", - "resolved": "https://registry.npmjs.org/@types/node/-/node-22.8.7.tgz", - "integrity": "sha512-LidcG+2UeYIWcMuMUpBKOnryBWG/rnmOHQR5apjn8myTQcx3rinFRn7DcIFhMnS0PPFSC6OafdIKEad0lj6U0Q==", + "version": "22.9.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.9.0.tgz", + "integrity": "sha512-vuyHg81vvWA1Z1ELfvLko2c8f34gyA0zaic0+Rllc5lbCnbSyuvb2Oxpm6TAUAC/2xZN3QGqxBNggD1nNR2AfQ==", "license": "MIT", "dependencies": { "undici-types": "~6.19.8" @@ -8954,6 +8954,18 @@ "resolved": "packages/typescript-compat/v5.2.x", "link": true }, + "node_modules/ts5.3": { + "resolved": "packages/typescript-compat/v5.3.x", + "link": true + }, + "node_modules/ts5.4": { + "resolved": "packages/typescript-compat/v5.4.x", + "link": true + }, + "node_modules/ts5.5": { + "resolved": "packages/typescript-compat/v5.5.x", + "link": true + }, "node_modules/tsconfig-paths": { "version": "3.15.0", "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.15.0.tgz", @@ -9654,9 +9666,10 @@ "integrity": "sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA==" }, "node_modules/typescript": { - "version": "5.5.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.5.4.tgz", - "integrity": "sha512-Mtq29sKDAEYP7aljRgtPOpTvOfbwRWlS6dPRzwjdE+C0R4brX/GUyhHSecbHMFLNBLcJIPt9nl9yG5TZ1weH+Q==", + "version": "5.6.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.6.3.tgz", + "integrity": "sha512-hjcS1mhfuyi4WW8IWtjP7brDrG2cuDZukyrYrSauoXGNgx0S7zceP07adYkJycEr56BOUTNPzbInooiN3fn1qw==", + "license": "Apache-2.0", "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" @@ -10053,7 +10066,7 @@ "@bufbuild/protobuf": "2.2.2", "@bufbuild/protoc-gen-es": "2.2.2", "tsx": "^4.19.2", - "typescript": "^5.5.4" + "typescript": "^5.6.3" } }, "packages/protobuf-test": { @@ -10116,7 +10129,7 @@ "@bufbuild/protoplugin": "^2.2.2", "@types/node": "^22.8.7", "tsx": "^4.19.2", - "typescript": "^5.5.4" + "typescript": "^5.6.3" } }, "packages/protoplugin-test": { @@ -10153,7 +10166,7 @@ "name": "ts4.9", "dependencies": { "@bufbuild/protobuf-test": "*", - "@types/node": "22.8.7", + "@types/node": "22.9.0", "typescript": "4.9.x" } }, @@ -10173,7 +10186,7 @@ "name": "ts5.0", "dependencies": { "@bufbuild/protobuf-test": "*", - "@types/node": "22.8.7", + "@types/node": "22.9.0", "typescript": "5.0.x" } }, @@ -10193,7 +10206,7 @@ "name": "ts5.1", "dependencies": { "@bufbuild/protobuf-test": "*", - "@types/node": "^22.8.7", + "@types/node": "22.9.0", "typescript": "5.1.x" } }, @@ -10213,7 +10226,7 @@ "name": "ts5.2", "dependencies": { "@bufbuild/protobuf-test": "*", - "@types/node": "^22.8.7", + "@types/node": "22.9.0", "typescript": "5.2.x" } }, @@ -10229,6 +10242,69 @@ "node": ">=14.17" } }, + "packages/typescript-compat/v5.3.x": { + "name": "ts5.3", + "dependencies": { + "@bufbuild/protobuf-test": "*", + "@types/node": "22.9.0", + "typescript": "5.3.x" + } + }, + "packages/typescript-compat/v5.3.x/node_modules/typescript": { + "version": "5.3.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz", + "integrity": "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==", + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "packages/typescript-compat/v5.4.x": { + "name": "ts5.4", + "dependencies": { + "@bufbuild/protobuf-test": "*", + "@types/node": "22.9.0", + "typescript": "5.4.x" + } + }, + "packages/typescript-compat/v5.4.x/node_modules/typescript": { + "version": "5.4.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.5.tgz", + "integrity": "sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ==", + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "packages/typescript-compat/v5.5.x": { + "name": "ts5.5", + "dependencies": { + "@bufbuild/protobuf-test": "*", + "@types/node": "22.9.0", + "typescript": "5.5.x" + } + }, + "packages/typescript-compat/v5.5.x/node_modules/typescript": { + "version": "5.5.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.5.4.tgz", + "integrity": "sha512-Mtq29sKDAEYP7aljRgtPOpTvOfbwRWlS6dPRzwjdE+C0R4brX/GUyhHSecbHMFLNBLcJIPt9nl9yG5TZ1weH+Q==", + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, "packages/upstream-protobuf": { "dependencies": { "fflate": "^0.8.1", diff --git a/package.json b/package.json index e3383a380..9f085c4b9 100644 --- a/package.json +++ b/package.json @@ -49,7 +49,7 @@ "jest": "^29.7.0", "prettier": "^3.3.3", "turbo": "^2.2.3", - "typescript": "^5.5.4" + "typescript": "^5.6.3" }, "//": "avoid hoisting of @typescript/vfs, see packages/protoplugin/src/transpile.ts", "dependencies": { diff --git a/packages/protobuf-example/package.json b/packages/protobuf-example/package.json index 2f0657f5d..6bca0696b 100644 --- a/packages/protobuf-example/package.json +++ b/packages/protobuf-example/package.json @@ -18,6 +18,6 @@ "@bufbuild/protobuf": "2.2.2", "@bufbuild/protoc-gen-es": "2.2.2", "tsx": "^4.19.2", - "typescript": "^5.5.4" + "typescript": "^5.6.3" } } diff --git a/packages/protobuf/src/reflect/reflect.ts b/packages/protobuf/src/reflect/reflect.ts index 8be535efe..21ccebe9b 100644 --- a/packages/protobuf/src/reflect/reflect.ts +++ b/packages/protobuf/src/reflect/reflect.ts @@ -370,12 +370,12 @@ class ReflectMapImpl implements ReflectMap { has(key: K) { return Object.prototype.hasOwnProperty.call(this.obj, mapKeyToLocal(key)); } - *keys() { + *keys(): MapIterator { for (const objKey of Object.keys(this.obj)) { yield mapKeyToReflect(objKey, this._field.mapKey) as K; } } - *entries(): IterableIterator<[K, V]> { + *entries(): MapIterator<[K, V]> { for (const objEntry of Object.entries(this.obj)) { yield [ mapKeyToReflect(objEntry[0], this._field.mapKey) as K, @@ -389,7 +389,7 @@ class ReflectMapImpl implements ReflectMap { get size() { return Object.keys(this.obj).length; } - *values() { + *values(): MapIterator { for (const val of Object.values(this.obj)) { yield mapValueToReflect(this._field, val, this.check) as V; } diff --git a/packages/protobuf/src/wire/size-delimited.ts b/packages/protobuf/src/wire/size-delimited.ts index 7e94d832e..4ce39ff56 100644 --- a/packages/protobuf/src/wire/size-delimited.ts +++ b/packages/protobuf/src/wire/size-delimited.ts @@ -52,7 +52,7 @@ export async function* sizeDelimitedDecodeStream( messageDesc: Desc, iterable: AsyncIterable, options?: BinaryReadOptions, -) { +): AsyncIterableIterator> { // append chunk to buffer, returning updated buffer function append(buffer: Uint8Array, chunk: Uint8Array): Uint8Array { const n = new Uint8Array(buffer.byteLength + chunk.byteLength); diff --git a/packages/protoplugin-example/package.json b/packages/protoplugin-example/package.json index ca3bbcc0d..5e29021da 100644 --- a/packages/protoplugin-example/package.json +++ b/packages/protoplugin-example/package.json @@ -17,7 +17,7 @@ "@bufbuild/protobuf": "^2.2.2", "@bufbuild/protoc-gen-es": "^2.2.2", "@bufbuild/protoplugin": "^2.2.2", - "typescript": "^5.5.4", + "typescript": "^5.6.3", "tsx": "^4.19.2", "@types/node": "^22.8.7" } diff --git a/packages/typescript-compat/v4.9.x/package.json b/packages/typescript-compat/v4.9.x/package.json index 5cd9be8ec..a98514f47 100644 --- a/packages/typescript-compat/v4.9.x/package.json +++ b/packages/typescript-compat/v4.9.x/package.json @@ -5,7 +5,7 @@ }, "dependencies": { "@bufbuild/protobuf-test": "*", - "@types/node": "22.8.7", + "@types/node": "22.9.0", "typescript": "4.9.x" } } diff --git a/packages/typescript-compat/v5.0.x/package.json b/packages/typescript-compat/v5.0.x/package.json index d313ad150..3f40b0012 100644 --- a/packages/typescript-compat/v5.0.x/package.json +++ b/packages/typescript-compat/v5.0.x/package.json @@ -5,7 +5,7 @@ }, "dependencies": { "@bufbuild/protobuf-test": "*", - "@types/node": "22.8.7", + "@types/node": "22.9.0", "typescript": "5.0.x" } } diff --git a/packages/typescript-compat/v5.1.x/package.json b/packages/typescript-compat/v5.1.x/package.json index eb46eaf69..967217766 100644 --- a/packages/typescript-compat/v5.1.x/package.json +++ b/packages/typescript-compat/v5.1.x/package.json @@ -5,7 +5,7 @@ }, "dependencies": { "@bufbuild/protobuf-test": "*", - "@types/node": "^22.8.7", + "@types/node": "22.9.0", "typescript": "5.1.x" } } diff --git a/packages/typescript-compat/v5.2.x/package.json b/packages/typescript-compat/v5.2.x/package.json index abc8697b2..6dec09565 100644 --- a/packages/typescript-compat/v5.2.x/package.json +++ b/packages/typescript-compat/v5.2.x/package.json @@ -5,7 +5,7 @@ }, "dependencies": { "@bufbuild/protobuf-test": "*", - "@types/node": "^22.8.7", + "@types/node": "22.9.0", "typescript": "5.2.x" } } diff --git a/packages/typescript-compat/v5.3.x/package.json b/packages/typescript-compat/v5.3.x/package.json new file mode 100644 index 000000000..b0ef3f2c6 --- /dev/null +++ b/packages/typescript-compat/v5.3.x/package.json @@ -0,0 +1,11 @@ +{ + "name": "ts5.3", + "scripts": { + "test": "node_modules/.bin/tsc --outDir dist" + }, + "dependencies": { + "@bufbuild/protobuf-test": "*", + "@types/node": "22.9.0", + "typescript": "5.3.x" + } +} diff --git a/packages/typescript-compat/v5.3.x/tsconfig.json b/packages/typescript-compat/v5.3.x/tsconfig.json new file mode 100644 index 000000000..1a12f5441 --- /dev/null +++ b/packages/typescript-compat/v5.3.x/tsconfig.json @@ -0,0 +1,20 @@ +{ + "include": ["../../protobuf-test/src/**/*"], + "exclude": ["../../protobuf-test/src/perf.ts"], + // These are the default compiler options for TypeScript v5.3.x, created + // with `tsc --init` (except where noted in comments below) + "compilerOptions": { + "target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ + "module": "commonjs", /* Specify what module code is generated. */ + "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */ + "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */ + "strict": true, /* Enable all strict type-checking options. */ + // To guard against regression and ensure we are remaining backwards + // compatible, set the skipLibCheck flag to false explicitly. + "skipLibCheck": false, + // Certain errors are only triggered by actually emitting declaration files, + // see https://github.com/bufbuild/protobuf-es/pull/398 + "declaration": true, + "declarationMap": true + } +} diff --git a/packages/typescript-compat/v5.4.x/package.json b/packages/typescript-compat/v5.4.x/package.json new file mode 100644 index 000000000..639d4a06c --- /dev/null +++ b/packages/typescript-compat/v5.4.x/package.json @@ -0,0 +1,11 @@ +{ + "name": "ts5.4", + "scripts": { + "test": "node_modules/.bin/tsc --outDir dist" + }, + "dependencies": { + "@bufbuild/protobuf-test": "*", + "@types/node": "22.9.0", + "typescript": "5.4.x" + } +} diff --git a/packages/typescript-compat/v5.4.x/tsconfig.json b/packages/typescript-compat/v5.4.x/tsconfig.json new file mode 100644 index 000000000..390fcd185 --- /dev/null +++ b/packages/typescript-compat/v5.4.x/tsconfig.json @@ -0,0 +1,20 @@ +{ + "include": ["../../protobuf-test/src/**/*"], + "exclude": ["../../protobuf-test/src/perf.ts"], + // These are the default compiler options for TypeScript v5.4.x, created + // with `tsc --init` (except where noted in comments below) + "compilerOptions": { + "target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ + "module": "commonjs", /* Specify what module code is generated. */ + "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */ + "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */ + "strict": true, /* Enable all strict type-checking options. */ + // To guard against regression and ensure we are remaining backwards + // compatible, set the skipLibCheck flag to false explicitly. + "skipLibCheck": false, + // Certain errors are only triggered by actually emitting declaration files, + // see https://github.com/bufbuild/protobuf-es/pull/398 + "declaration": true, + "declarationMap": true + } +} diff --git a/packages/typescript-compat/v5.5.x/package.json b/packages/typescript-compat/v5.5.x/package.json new file mode 100644 index 000000000..e054423f1 --- /dev/null +++ b/packages/typescript-compat/v5.5.x/package.json @@ -0,0 +1,11 @@ +{ + "name": "ts5.5", + "scripts": { + "test": "node_modules/.bin/tsc --outDir dist" + }, + "dependencies": { + "@bufbuild/protobuf-test": "*", + "@types/node": "22.9.0", + "typescript": "5.5.x" + } +} diff --git a/packages/typescript-compat/v5.5.x/tsconfig.json b/packages/typescript-compat/v5.5.x/tsconfig.json new file mode 100644 index 000000000..c79b0d0e7 --- /dev/null +++ b/packages/typescript-compat/v5.5.x/tsconfig.json @@ -0,0 +1,20 @@ +{ + "include": ["../../protobuf-test/src/**/*"], + "exclude": ["../../protobuf-test/src/perf.ts"], + // These are the default compiler options for TypeScript v5.5.x, created + // with `tsc --init` (except where noted in comments below) + "compilerOptions": { + "target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ + "module": "commonjs", /* Specify what module code is generated. */ + "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */ + "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */ + "strict": true, /* Enable all strict type-checking options. */ + // To guard against regression and ensure we are remaining backwards + // compatible, set the skipLibCheck flag to false explicitly. + "skipLibCheck": false, + // Certain errors are only triggered by actually emitting declaration files, + // see https://github.com/bufbuild/protobuf-es/pull/398 + "declaration": true, + "declarationMap": true + } +}