Skip to content
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
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";
Comment on lines +23 to +27
Copy link
Member Author

Choose a reason for hiding this comment

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

We can not use type-only specifiers in imports, a feature added by TS v4.5.

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
Copy link
Member Author

Choose a reason for hiding this comment

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

In tests, we can replace some @ts-ignore annotations with @ts-expect-error, since all supported versions of TS produce an error here.

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