Skip to content

Commit 9a8978b

Browse files
authored
V2: Bump supported version of TypeScript to 4.9.5 (#805)
1 parent f4bb5e1 commit 9a8978b

23 files changed

Lines changed: 17 additions & 298 deletions

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ You should now see a generated file at `src/gen/example_pb.ts` that contains a c
124124

125125
## TypeScript
126126

127-
The generated code is compatible with TypeScript **v4.1.2** or later, with the default compiler settings.
127+
The generated code is compatible with TypeScript **v4.9.5** or later, with the default compiler settings.
128128

129129

130130
## Copyright

package-lock.json

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

packages/protobuf-test/src/binary.test.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,18 @@ import {
2020
toBinary,
2121
fromBinary,
2222
} from "@bufbuild/protobuf";
23-
import type { MessageInitShape } from "@bufbuild/protobuf";
23+
import {
24+
type MessageInitShape,
25+
type DescMessage,
26+
protoInt64,
27+
} from "@bufbuild/protobuf";
28+
import { StructDesc, ValueDesc } from "@bufbuild/protobuf/wkt";
2429
import {
2530
RepeatedScalarValuesMessageDesc,
2631
ScalarValuesMessageDesc,
2732
} from "./gen/ts/extra/msg-scalar_pb.js";
28-
import { protoInt64 } from "@bufbuild/protobuf";
2933
import { MapsMessageDesc } from "./gen/ts/extra/msg-maps_pb.js";
3034
import { MessageFieldMessageDesc } from "./gen/ts/extra/msg-message_pb.js";
31-
import type { DescMessage } from "@bufbuild/protobuf";
3235

3336
import {
3437
Proto2ExtendeeDesc,
@@ -37,7 +40,6 @@ import {
3740
import { OneofMessageDesc } from "./gen/ts/extra/msg-oneof_pb.js";
3841
import { JsonNamesMessageDesc } from "./gen/ts/extra/msg-json-names_pb.js";
3942
import { JSTypeProto2NormalMessageDesc } from "./gen/ts/extra/jstype-proto2_pb.js";
40-
import { StructDesc, ValueDesc } from "@bufbuild/protobuf/wkt";
4143

4244
describe(`binary serialization`, () => {
4345
testBinary(ScalarValuesMessageDesc, {

packages/protobuf-test/src/create.test.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -671,15 +671,14 @@ describe("create()", () => {
671671
// @ts-expect-error expected type error
672672
repeatedInt64JsStringField: [protoInt64.parse(6)],
673673
either: {
674-
// @ts-ignore -- required for older TS
675674
case: "oneofInt64Field",
676-
// @ts-ignore -- required for older TS
675+
// @ts-expect-error expected type error
677676
value: 7,
678677
},
679678
mapInt64Int64Field: {
680-
// @ts-ignore -- required for older TS
679+
// @ts-expect-error expected type error
681680
"1": 8,
682-
// @ts-ignore -- required for older TS
681+
// @ts-expect-error expected type error
683682
"2": 9,
684683
},
685684
});
@@ -714,9 +713,8 @@ describe("create()", () => {
714713
[0xde, 0xad, 0xbe, 0xef],
715714
],
716715
either: {
717-
// @ts-ignore -- number array is still a type error
718716
case: "oneofBytesField",
719-
// @ts-ignore -- number array is still a type error
717+
// @ts-expect-error -- number array is still a type error
720718
value: [0xde, 0xad, 0xbe, 0xef],
721719
},
722720
});
@@ -798,7 +796,7 @@ describe("create()", () => {
798796
describe("enum field", () => {
799797
test("accepts proto3 enum value out of range", () => {
800798
const msg = create(proto3_ts.Proto3MessageDesc, {
801-
// @ts-ignore -- cannot use ts-expect-error, not an error in older TS
799+
// @ts-ignore -- required for older TS
802800
singularEnumField: 99,
803801
});
804802
expect(msg.singularEnumField).toBe(99);

packages/protobuf/src/wire/base64-encoding.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ export function base64Decode(base64Str: string) {
4141
b = table[base64Str.charCodeAt(i)];
4242
if (b === undefined) {
4343
switch (base64Str[i]) {
44-
// @ts-ignore TS7029: Fallthrough case in switch
44+
// @ts-expect-error TS7029: Fallthrough case in switch
4545
case "=":
4646
groupPos = 0; // reset state when padding found
47-
// @ts-ignore TS7029: Fallthrough case in switch
47+
// eslint-disable-next-line no-fallthrough
4848
case "\n":
4949
case "\r":
5050
case "\t":

packages/protobuf/src/wire/binary-encoding.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -386,11 +386,10 @@ export class BinaryReader {
386386
}
387387
break;
388388
// eslint-disable-next-line
389-
// @ts-ignore TS7029: Fallthrough case in switch
389+
// @ts-expect-error TS7029: Fallthrough case in switch
390390
case WireType.Bit64:
391391
this.pos += 4;
392-
// eslint-disable-next-line
393-
// @ts-ignore TS7029: Fallthrough case in switch
392+
// eslint-disable-next-line no-fallthrough
394393
case WireType.Bit32:
395394
this.pos += 4;
396395
break;

packages/typescript-compat/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ respective to that version of TypeScript.
1212

1313
### Which versions are tested
1414

15-
- the earliest TypeScript version we support (4.1.2).
15+
- the earliest TypeScript version we support.
1616
- the latest patch release of all minor versions up to the current release.
1717

1818
### Adding a new version

packages/typescript-compat/v4.1.x/package.json

Lines changed: 0 additions & 11 deletions
This file was deleted.

packages/typescript-compat/v4.1.x/tsconfig.json

Lines changed: 0 additions & 25 deletions
This file was deleted.

packages/typescript-compat/v4.2.x/package.json

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)