Skip to content

Commit

Permalink
V2: Bump supported version of TypeScript to 4.9.5 (#805)
Browse files Browse the repository at this point in the history
  • Loading branch information
timostamm authored Apr 23, 2024
1 parent f4bb5e1 commit 9a8978b
Show file tree
Hide file tree
Showing 23 changed files with 17 additions and 298 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ You should now see a generated file at `src/gen/example_pb.ts` that contains a c

## TypeScript

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


## Copyright
Expand Down
32 changes: 0 additions & 32 deletions package-lock.json

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

10 changes: 6 additions & 4 deletions packages/protobuf-test/src/binary.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,18 @@ import {
toBinary,
fromBinary,
} from "@bufbuild/protobuf";
import type { MessageInitShape } from "@bufbuild/protobuf";
import {
type MessageInitShape,
type DescMessage,
protoInt64,
} from "@bufbuild/protobuf";
import { StructDesc, ValueDesc } from "@bufbuild/protobuf/wkt";
import {
RepeatedScalarValuesMessageDesc,
ScalarValuesMessageDesc,
} from "./gen/ts/extra/msg-scalar_pb.js";
import { protoInt64 } from "@bufbuild/protobuf";
import { MapsMessageDesc } from "./gen/ts/extra/msg-maps_pb.js";
import { MessageFieldMessageDesc } from "./gen/ts/extra/msg-message_pb.js";
import type { DescMessage } from "@bufbuild/protobuf";

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

describe(`binary serialization`, () => {
testBinary(ScalarValuesMessageDesc, {
Expand Down
12 changes: 5 additions & 7 deletions packages/protobuf-test/src/create.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -671,15 +671,14 @@ describe("create()", () => {
// @ts-expect-error expected type error
repeatedInt64JsStringField: [protoInt64.parse(6)],
either: {
// @ts-ignore -- required for older TS
case: "oneofInt64Field",
// @ts-ignore -- required for older TS
// @ts-expect-error expected type error
value: 7,
},
mapInt64Int64Field: {
// @ts-ignore -- required for older TS
// @ts-expect-error expected type error
"1": 8,
// @ts-ignore -- required for older TS
// @ts-expect-error expected type error
"2": 9,
},
});
Expand Down Expand Up @@ -714,9 +713,8 @@ describe("create()", () => {
[0xde, 0xad, 0xbe, 0xef],
],
either: {
// @ts-ignore -- number array is still a type error
case: "oneofBytesField",
// @ts-ignore -- number array is still a type error
// @ts-expect-error -- number array is still a type error
value: [0xde, 0xad, 0xbe, 0xef],
},
});
Expand Down Expand Up @@ -798,7 +796,7 @@ describe("create()", () => {
describe("enum field", () => {
test("accepts proto3 enum value out of range", () => {
const msg = create(proto3_ts.Proto3MessageDesc, {
// @ts-ignore -- cannot use ts-expect-error, not an error in older TS
// @ts-ignore -- required for older TS
singularEnumField: 99,
});
expect(msg.singularEnumField).toBe(99);
Expand Down
4 changes: 2 additions & 2 deletions packages/protobuf/src/wire/base64-encoding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ export function base64Decode(base64Str: string) {
b = table[base64Str.charCodeAt(i)];
if (b === undefined) {
switch (base64Str[i]) {
// @ts-ignore TS7029: Fallthrough case in switch
// @ts-expect-error TS7029: Fallthrough case in switch
case "=":
groupPos = 0; // reset state when padding found
// @ts-ignore TS7029: Fallthrough case in switch
// eslint-disable-next-line no-fallthrough
case "\n":
case "\r":
case "\t":
Expand Down
5 changes: 2 additions & 3 deletions packages/protobuf/src/wire/binary-encoding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -386,11 +386,10 @@ export class BinaryReader {
}
break;
// eslint-disable-next-line
// @ts-ignore TS7029: Fallthrough case in switch
// @ts-expect-error TS7029: Fallthrough case in switch
case WireType.Bit64:
this.pos += 4;
// eslint-disable-next-line
// @ts-ignore TS7029: Fallthrough case in switch
// eslint-disable-next-line no-fallthrough
case WireType.Bit32:
this.pos += 4;
break;
Expand Down
2 changes: 1 addition & 1 deletion packages/typescript-compat/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ respective to that version of TypeScript.

### Which versions are tested

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

### Adding a new version
Expand Down
11 changes: 0 additions & 11 deletions packages/typescript-compat/v4.1.x/package.json

This file was deleted.

25 changes: 0 additions & 25 deletions packages/typescript-compat/v4.1.x/tsconfig.json

This file was deleted.

11 changes: 0 additions & 11 deletions packages/typescript-compat/v4.2.x/package.json

This file was deleted.

25 changes: 0 additions & 25 deletions packages/typescript-compat/v4.2.x/tsconfig.json

This file was deleted.

11 changes: 0 additions & 11 deletions packages/typescript-compat/v4.3.x/package.json

This file was deleted.

17 changes: 0 additions & 17 deletions packages/typescript-compat/v4.3.x/tsconfig.json

This file was deleted.

11 changes: 0 additions & 11 deletions packages/typescript-compat/v4.4.x/package.json

This file was deleted.

17 changes: 0 additions & 17 deletions packages/typescript-compat/v4.4.x/tsconfig.json

This file was deleted.

11 changes: 0 additions & 11 deletions packages/typescript-compat/v4.5.x/package.json

This file was deleted.

19 changes: 0 additions & 19 deletions packages/typescript-compat/v4.5.x/tsconfig.json

This file was deleted.

11 changes: 0 additions & 11 deletions packages/typescript-compat/v4.6.x/package.json

This file was deleted.

19 changes: 0 additions & 19 deletions packages/typescript-compat/v4.6.x/tsconfig.json

This file was deleted.

11 changes: 0 additions & 11 deletions packages/typescript-compat/v4.7.x/package.json

This file was deleted.

19 changes: 0 additions & 19 deletions packages/typescript-compat/v4.7.x/tsconfig.json

This file was deleted.

11 changes: 0 additions & 11 deletions packages/typescript-compat/v4.8.x/package.json

This file was deleted.

Loading

0 comments on commit 9a8978b

Please sign in to comment.