Skip to content
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

Update to TypeScript 5.6.3 #1013

Merged
merged 1 commit into from
Nov 5, 2024
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
102 changes: 89 additions & 13 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
2 changes: 1 addition & 1 deletion packages/protobuf-example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
6 changes: 3 additions & 3 deletions packages/protobuf/src/reflect/reflect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -370,12 +370,12 @@ class ReflectMapImpl<K, V> implements ReflectMap<K, V> {
has(key: K) {
return Object.prototype.hasOwnProperty.call(this.obj, mapKeyToLocal(key));
}
*keys() {
*keys(): MapIterator<K> {
Copy link
Member Author

Choose a reason for hiding this comment

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

The inferred generator type no longer matches the built-in ReadonlyMap. We have to add an explicit return type. Same as a couple of other places. This is unlikely to cause issues, and should be covered by the typescript-compat tests.

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,
Expand All @@ -389,7 +389,7 @@ class ReflectMapImpl<K, V> implements ReflectMap<K, V> {
get size() {
return Object.keys(this.obj).length;
}
*values() {
*values(): MapIterator<V> {
for (const val of Object.values(this.obj)) {
yield mapValueToReflect(this._field, val, this.check) as V;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/protobuf/src/wire/size-delimited.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export async function* sizeDelimitedDecodeStream<Desc extends DescMessage>(
messageDesc: Desc,
iterable: AsyncIterable<Uint8Array>,
options?: BinaryReadOptions,
) {
): AsyncIterableIterator<MessageShape<Desc>> {
// append chunk to buffer, returning updated buffer
function append(buffer: Uint8Array, chunk: Uint8Array): Uint8Array {
const n = new Uint8Array(buffer.byteLength + chunk.byteLength);
Expand Down
2 changes: 1 addition & 1 deletion packages/protoplugin-example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand Down
2 changes: 1 addition & 1 deletion packages/typescript-compat/v4.9.x/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
},
"dependencies": {
"@bufbuild/protobuf-test": "*",
"@types/node": "22.8.7",
"@types/node": "22.9.0",
"typescript": "4.9.x"
}
}
2 changes: 1 addition & 1 deletion packages/typescript-compat/v5.0.x/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
},
"dependencies": {
"@bufbuild/protobuf-test": "*",
"@types/node": "22.8.7",
"@types/node": "22.9.0",
"typescript": "5.0.x"
}
}
2 changes: 1 addition & 1 deletion packages/typescript-compat/v5.1.x/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
},
"dependencies": {
"@bufbuild/protobuf-test": "*",
"@types/node": "^22.8.7",
"@types/node": "22.9.0",
"typescript": "5.1.x"
}
}
2 changes: 1 addition & 1 deletion packages/typescript-compat/v5.2.x/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
},
"dependencies": {
"@bufbuild/protobuf-test": "*",
"@types/node": "^22.8.7",
"@types/node": "22.9.0",
"typescript": "5.2.x"
}
}
11 changes: 11 additions & 0 deletions packages/typescript-compat/v5.3.x/package.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
20 changes: 20 additions & 0 deletions packages/typescript-compat/v5.3.x/tsconfig.json
Original file line number Diff line number Diff line change
@@ -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
}
}
11 changes: 11 additions & 0 deletions packages/typescript-compat/v5.4.x/package.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
20 changes: 20 additions & 0 deletions packages/typescript-compat/v5.4.x/tsconfig.json
Original file line number Diff line number Diff line change
@@ -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
}
}
11 changes: 11 additions & 0 deletions packages/typescript-compat/v5.5.x/package.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
20 changes: 20 additions & 0 deletions packages/typescript-compat/v5.5.x/tsconfig.json
Original file line number Diff line number Diff line change
@@ -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
}
}