Skip to content

Commit

Permalink
refactor: update to typescript 4.7.4 (stephenh#603)
Browse files Browse the repository at this point in the history
Updates to TypeScript 4.7.x (latest).

This requires an update to ts-proto-descriptors, to release:

 1. Release ts-proto-descriptors version 1.7.0.
 2. Update package.json with ts-proto-descriptors version.
 3. Publish ts-proto update.

Additionally, some other minor fixes:

 - Cast _unknownFields to any to fix build errors.
 - Update docker-compose to v2: uses plugin: "docker compose"

Fixes stephenh#607

Signed-off-by: Christian Stewart <christian@paral.in>
  • Loading branch information
paralin authored Jul 1, 2022
1 parent 6eb996e commit e2323b6
Show file tree
Hide file tree
Showing 9 changed files with 203 additions and 100 deletions.
2 changes: 1 addition & 1 deletion integration/simple-esmodule-interop/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"author": "",
"license": "ISC",
"dependencies": {
"typescript": "^4.2.3",
"typescript": "^4.7.4",
"jest": "^26.6.3"
}
}
8 changes: 4 additions & 4 deletions integration/simple-esmodule-interop/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3211,10 +3211,10 @@ typedarray-to-buffer@^3.1.5:
dependencies:
is-typedarray "^1.0.0"

typescript@^4.2.3:
version "4.6.3"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.6.3.tgz#eefeafa6afdd31d725584c67a0eaba80f6fc6c6c"
integrity sha512-yNIatDa5iaofVozS/uQJEl3JRWLKKGJKh6Yaiv0GLGSuhpFJe7P3SbHZ8/yjAHRQwKRoA6YZqlfjXWmVzoVSMw==
typescript@^4.7.4:
version "4.7.4"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.7.4.tgz#1a88596d1cf47d59507a1bcdfb5b9dfe4d488235"
integrity sha512-C0WQT0gezHuw6AdY1M2jxUO83Rjf0HP7Sk1DtXj6j1EwkQNZrHAg2XPWlq62oqEhYvONq5pkC2Y9oPljWToLmQ==

union-value@^1.0.0:
version "1.0.1"
Expand Down
20 changes: 12 additions & 8 deletions integration/unknown-fields/google/protobuf/compiler/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,9 @@ export const Version = {
writer.uint32(34).string(message.suffix);
}
if ('_unknownFields' in message) {
for (const key of Object.keys(message['_unknownFields'])) {
const values = message['_unknownFields'][key] as Uint8Array[];
const msgUnknownFields: any = (message as any)['_unknownFields'];
for (const key of Object.keys(msgUnknownFields)) {
const values = msgUnknownFields[key] as Uint8Array[];
for (const value of values) {
writer.uint32(parseInt(key, 10));
(writer as any)['_push'](
Expand Down Expand Up @@ -229,8 +230,9 @@ export const CodeGeneratorRequest = {
Version.encode(message.compilerVersion, writer.uint32(26).fork()).ldelim();
}
if ('_unknownFields' in message) {
for (const key of Object.keys(message['_unknownFields'])) {
const values = message['_unknownFields'][key] as Uint8Array[];
const msgUnknownFields: any = (message as any)['_unknownFields'];
for (const key of Object.keys(msgUnknownFields)) {
const values = msgUnknownFields[key] as Uint8Array[];
for (const value of values) {
writer.uint32(parseInt(key, 10));
(writer as any)['_push'](
Expand Down Expand Up @@ -294,8 +296,9 @@ export const CodeGeneratorResponse = {
CodeGeneratorResponse_File.encode(v!, writer.uint32(122).fork()).ldelim();
}
if ('_unknownFields' in message) {
for (const key of Object.keys(message['_unknownFields'])) {
const values = message['_unknownFields'][key] as Uint8Array[];
const msgUnknownFields: any = (message as any)['_unknownFields'];
for (const key of Object.keys(msgUnknownFields)) {
const values = msgUnknownFields[key] as Uint8Array[];
for (const value of values) {
writer.uint32(parseInt(key, 10));
(writer as any)['_push'](
Expand Down Expand Up @@ -359,8 +362,9 @@ export const CodeGeneratorResponse_File = {
GeneratedCodeInfo.encode(message.generatedCodeInfo, writer.uint32(130).fork()).ldelim();
}
if ('_unknownFields' in message) {
for (const key of Object.keys(message['_unknownFields'])) {
const values = message['_unknownFields'][key] as Uint8Array[];
const msgUnknownFields: any = (message as any)['_unknownFields'];
for (const key of Object.keys(msgUnknownFields)) {
const values = msgUnknownFields[key] as Uint8Array[];
for (const value of values) {
writer.uint32(parseInt(key, 10));
(writer as any)['_push'](
Expand Down
135 changes: 81 additions & 54 deletions integration/unknown-fields/google/protobuf/descriptor.ts

Large diffs are not rendered by default.

15 changes: 9 additions & 6 deletions integration/unknown-fields/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@ export const MyMessage = {
writer.uint32(34).string(message.quux);
}
if ('_unknownFields' in message) {
for (const key of Object.keys(message['_unknownFields'])) {
const values = message['_unknownFields'][key] as Uint8Array[];
const msgUnknownFields: any = (message as any)['_unknownFields'];
for (const key of Object.keys(msgUnknownFields)) {
const values = msgUnknownFields[key] as Uint8Array[];
for (const value of values) {
writer.uint32(parseInt(key, 10));
(writer as any)['_push'](
Expand Down Expand Up @@ -95,8 +96,9 @@ function createBaseRequestType(): RequestType {
export const RequestType = {
encode(message: RequestType, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
if ('_unknownFields' in message) {
for (const key of Object.keys(message['_unknownFields'])) {
const values = message['_unknownFields'][key] as Uint8Array[];
const msgUnknownFields: any = (message as any)['_unknownFields'];
for (const key of Object.keys(msgUnknownFields)) {
const values = msgUnknownFields[key] as Uint8Array[];
for (const value of values) {
writer.uint32(parseInt(key, 10));
(writer as any)['_push'](
Expand Down Expand Up @@ -139,8 +141,9 @@ function createBaseResponseType(): ResponseType {
export const ResponseType = {
encode(message: ResponseType, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
if ('_unknownFields' in message) {
for (const key of Object.keys(message['_unknownFields'])) {
const values = message['_unknownFields'][key] as Uint8Array[];
const msgUnknownFields: any = (message as any)['_unknownFields'];
for (const key of Object.keys(msgUnknownFields)) {
const values = msgUnknownFields[key] as Uint8Array[];
for (const value of values) {
writer.uint32(parseInt(key, 10));
(writer as any)['_push'](
Expand Down
5 changes: 3 additions & 2 deletions integration/unknown-fields/something/something.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ export const Something = {
}
writer.ldelim();
if ('_unknownFields' in message) {
for (const key of Object.keys(message['_unknownFields'])) {
const values = message['_unknownFields'][key] as Uint8Array[];
const msgUnknownFields: any = (message as any)['_unknownFields'];
for (const key of Object.keys(msgUnknownFields)) {
const values = msgUnknownFields[key] as Uint8Array[];
for (const value of values) {
writer.uint32(parseInt(key, 10));
(writer as any)['_push'](
Expand Down
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@
"build:test": "yarn proto2bin && yarn proto2pbjs && yarn bin2ts",
"build:test:local": "yarn proto2bin:local && yarn proto2pbjs:local && yarn bin2ts:local",
"prepare": "yarn build",
"proto2bin": "docker-compose run --rm protoc update-bins.sh",
"proto2bin-node": "docker-compose run --rm node update-bins.sh",
"proto2pbjs": "docker-compose run --rm protoc pbjs.sh",
"bin2ts": "docker-compose run --rm protoc codegen.sh",
"proto2bin": "docker compose run --rm protoc update-bins.sh",
"proto2bin-node": "docker compose run --rm node update-bins.sh",
"proto2pbjs": "docker compose run --rm protoc pbjs.sh",
"bin2ts": "docker compose run --rm protoc codegen.sh",
"proto2bin:local": "integration/update-bins.sh",
"proto2pbjs:local": "integration/pbjs.sh",
"bin2ts:local": "integration/codegen.sh",
"test": "yarn jest -c jest.config.js --maxWorkers=2",
"prettier": "prettier --write {src,tests}/**/*.ts integration/*.ts",
"prettier:check": "prettier --list-different {src,tests}/**/*.ts",
"setup:docker": "docker-compose build",
"setup:docker": "docker compose build",
"watch": "ts-node integration/watch.ts"
},
"files": [
Expand Down Expand Up @@ -57,8 +57,8 @@
"rxjs": "^7.4.0",
"semantic-release": "^17.4.2",
"ts-jest": "^26.5.4",
"ts-node": "^9.1.1",
"typescript": "^4.2.3",
"ts-node": "^10.8.1",
"typescript": "^4.7.4",
"uglify-js": "^3.13.3"
},
"dependencies": {
Expand All @@ -67,6 +67,6 @@
"object-hash": "^1.3.1",
"protobufjs": "^6.11.3",
"ts-poet": "^4.11.0",
"ts-proto-descriptors": "1.6.0"
"ts-proto-descriptors": "1.7.0"
}
}
5 changes: 3 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1107,8 +1107,9 @@ function generateEncode(ctx: Context, fullName: string, messageDesc: DescriptorP

if (options.unknownFields) {
chunks.push(code`if ('_unknownFields' in message) {
for (const key of Object.keys(message['_unknownFields'])) {
const values = message['_unknownFields'][key] as Uint8Array[];
const msgUnknownFields: any = (message as any)['_unknownFields']
for (const key of Object.keys(msgUnknownFields)) {
const values = msgUnknownFields[key] as Uint8Array[];
for (const value of values) {
writer.uint32(parseInt(key, 10));
(writer as any)['_push'](
Expand Down
97 changes: 82 additions & 15 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,13 @@
exec-sh "^0.3.2"
minimist "^1.2.0"

"@cspotcode/source-map-support@^0.8.0":
version "0.8.1"
resolved "https://registry.yarnpkg.com/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz#00629c35a688e05a88b1cda684fb9d5e73f000a1"
integrity sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==
dependencies:
"@jridgewell/trace-mapping" "0.3.9"

"@grpc/grpc-js@^1.2.12":
version "1.2.12"
resolved "https://registry.npmjs.org/@grpc/grpc-js/-/grpc-js-1.2.12.tgz"
Expand Down Expand Up @@ -514,6 +521,24 @@
"@types/yargs" "^15.0.0"
chalk "^4.0.0"

"@jridgewell/resolve-uri@^3.0.3":
version "3.0.8"
resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.0.8.tgz#687cc2bbf243f4e9a868ecf2262318e2658873a1"
integrity sha512-YK5G9LaddzGbcucK4c8h5tWFmMPBvRZ/uyWmN1/SbBdIvqGUdWGkJ5BAaccgs6XbzVLsqbPJrBSFwKv3kT9i7w==

"@jridgewell/sourcemap-codec@^1.4.10":
version "1.4.14"
resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz#add4c98d341472a289190b424efbdb096991bb24"
integrity sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==

"@jridgewell/trace-mapping@0.3.9":
version "0.3.9"
resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz#6534fd5933a53ba7cbf3a17615e273a0d1273ff9"
integrity sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==
dependencies:
"@jridgewell/resolve-uri" "^3.0.3"
"@jridgewell/sourcemap-codec" "^1.4.10"

"@nestjs/common@^8.2.2":
version "8.2.2"
resolved "https://registry.npmjs.org/@nestjs/common/-/common-8.2.2.tgz"
Expand Down Expand Up @@ -1001,6 +1026,26 @@
resolved "https://registry.npmjs.org/@tootallnate/once/-/once-1.1.2.tgz"
integrity sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw==

"@tsconfig/node10@^1.0.7":
version "1.0.9"
resolved "https://registry.yarnpkg.com/@tsconfig/node10/-/node10-1.0.9.tgz#df4907fc07a886922637b15e02d4cebc4c0021b2"
integrity sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==

"@tsconfig/node12@^1.0.7":
version "1.0.11"
resolved "https://registry.yarnpkg.com/@tsconfig/node12/-/node12-1.0.11.tgz#ee3def1f27d9ed66dac6e46a295cffb0152e058d"
integrity sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==

"@tsconfig/node14@^1.0.0":
version "1.0.3"
resolved "https://registry.yarnpkg.com/@tsconfig/node14/-/node14-1.0.3.tgz#e4386316284f00b98435bf40f72f75a09dabf6c1"
integrity sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==

"@tsconfig/node16@^1.0.2":
version "1.0.3"
resolved "https://registry.yarnpkg.com/@tsconfig/node16/-/node16-1.0.3.tgz#472eaab5f15c1ffdd7f8628bd4c4f753995ec79e"
integrity sha512-yOlFc+7UtL/89t2ZhjPvvB/DeAr3r+Dq58IgzsFkOAvVC6NMJXmCGjbptdXdR9qsX7pKcTL+s87FtYREi2dEEQ==

"@types/babel__core@^7.0.0", "@types/babel__core@^7.1.7":
version "7.1.7"
resolved "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.1.7.tgz"
Expand Down Expand Up @@ -1198,6 +1243,11 @@ acorn-walk@^7.1.1:
resolved "https://registry.npmjs.org/acorn-walk/-/acorn-walk-7.2.0.tgz"
integrity sha512-OPdCF6GsMIP+Az+aWfAAOEt2/+iVDKE7oy6lJ098aoe59oAmK76qV6Gw60SbZ8jHuG2wH058GF4pLFbYamYrVA==

acorn-walk@^8.1.1:
version "8.2.0"
resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-8.2.0.tgz#741210f2e2426454508853a2f44d0ab83b7f69c1"
integrity sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==

acorn@^7.1.1:
version "7.4.1"
resolved "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz"
Expand All @@ -1208,6 +1258,11 @@ acorn@^8.1.0:
resolved "https://registry.npmjs.org/acorn/-/acorn-8.1.0.tgz"
integrity sha512-LWCF/Wn0nfHOmJ9rzQApGnxnvgfROzGilS8936rqN/lfcYkY9MYZzdMqN+2NJ4SlTc+m5HiSa+kNfDtI64dwUA==

acorn@^8.4.1:
version "8.7.1"
resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.7.1.tgz#0197122c843d1bf6d0a5e83220a788f278f63c30"
integrity sha512-Xx54uLJQZ19lKygFXOWsscKUbsBZW0CPykPhVQdhIeIwrbPmJzqeASDInc8nKBnp/JT6igTs82qPXz069H8I/A==

agent-base@6:
version "6.0.2"
resolved "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz"
Expand Down Expand Up @@ -5901,7 +5956,7 @@ source-map-resolve@^0.5.0:
source-map-url "^0.4.0"
urix "^0.1.0"

source-map-support@^0.5.17, source-map-support@^0.5.6:
source-map-support@^0.5.6:
version "0.5.19"
resolved "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.19.tgz"
integrity sha512-Wonm7zOCIJzBGQdB+thsPar0kYuCIzYvxZwlBa87yi/Mdjv7Tip2cyVbLj5o0cFPN4EVkuTwb3GDDyUx2DGnGw==
Expand Down Expand Up @@ -6380,16 +6435,23 @@ ts-jest@^26.5.4:
semver "7.x"
yargs-parser "20.x"

ts-node@^9.1.1:
version "9.1.1"
resolved "https://registry.npmjs.org/ts-node/-/ts-node-9.1.1.tgz"
integrity sha512-hPlt7ZACERQGf03M253ytLY3dHbGNGrAq9qIHWUY9XHYl1z7wYngSr3OQ5xmui8o2AaxsONxIzjafLUiWBo1Fg==
dependencies:
ts-node@^10.8.1:
version "10.8.1"
resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-10.8.1.tgz#ea2bd3459011b52699d7e88daa55a45a1af4f066"
integrity sha512-Wwsnao4DQoJsN034wePSg5nZiw4YKXf56mPIAeD6wVmiv+RytNSWqc2f3fKvcUoV+Yn2+yocD71VOfQHbmVX4g==
dependencies:
"@cspotcode/source-map-support" "^0.8.0"
"@tsconfig/node10" "^1.0.7"
"@tsconfig/node12" "^1.0.7"
"@tsconfig/node14" "^1.0.0"
"@tsconfig/node16" "^1.0.2"
acorn "^8.4.1"
acorn-walk "^8.1.1"
arg "^4.1.0"
create-require "^1.1.0"
diff "^4.0.1"
make-error "^1.1.1"
source-map-support "^0.5.17"
v8-compile-cache-lib "^3.0.1"
yn "3.1.1"

ts-poet@^4.11.0:
Expand All @@ -6400,10 +6462,10 @@ ts-poet@^4.11.0:
lodash "^4.17.15"
prettier "^2.5.1"

ts-proto-descriptors@1.6.0:
version "1.6.0"
resolved "https://registry.yarnpkg.com/ts-proto-descriptors/-/ts-proto-descriptors-1.6.0.tgz#ca6eafc882495a2e920da5b981d7b181b4e49c38"
integrity sha512-Vrhue2Ti99us/o76mGy28nF3W/Uanl1/8detyJw2yyRwiBC5yxy+hEZqQ/ZX2PbZ1vyCpJ51A9L4PnCCnkBMTQ==
ts-proto-descriptors@1.7.0:
version "1.7.0"
resolved "https://registry.yarnpkg.com/ts-proto-descriptors/-/ts-proto-descriptors-1.7.0.tgz#bd465a17642b23747c21a2442a2ec379446cd18b"
integrity sha512-FydY8jv+V/y48LNGy/UX1H5p2z6mV/dP8kgn+4VqZ6VI7pw/JTgWaxF3SRuCPxEhzDFB5WaLVLlnbDXrPzyHWQ==
dependencies:
long "^4.0.0"
protobufjs "^6.8.8"
Expand Down Expand Up @@ -6474,10 +6536,10 @@ typedarray-to-buffer@^3.1.5:
dependencies:
is-typedarray "^1.0.0"

typescript@^4.2.3:
version "4.2.3"
resolved "https://registry.npmjs.org/typescript/-/typescript-4.2.3.tgz"
integrity sha512-qOcYwxaByStAWrBf4x0fibwZvMRG+r4cQoTjbPtUlrWjBHbmCAww1i448U0GJ+3cNNEtebDteo/cHOR3xJ4wEw==
typescript@^4.7.4:
version "4.7.4"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.7.4.tgz#1a88596d1cf47d59507a1bcdfb5b9dfe4d488235"
integrity sha512-C0WQT0gezHuw6AdY1M2jxUO83Rjf0HP7Sk1DtXj6j1EwkQNZrHAg2XPWlq62oqEhYvONq5pkC2Y9oPljWToLmQ==

uglify-js@^3.1.4, uglify-js@^3.13.3:
version "3.13.3"
Expand Down Expand Up @@ -6575,6 +6637,11 @@ uuid@^3.3.2:
resolved "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz"
integrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==

v8-compile-cache-lib@^3.0.1:
version "3.0.1"
resolved "https://registry.yarnpkg.com/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz#6336e8d71965cb3d35a1bbb7868445a7c05264bf"
integrity sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==

v8-to-istanbul@^7.0.0:
version "7.1.1"
resolved "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-7.1.1.tgz"
Expand Down

0 comments on commit e2323b6

Please sign in to comment.