From 58dc10c61ec5a76d4b54ba9eddf34021979dd4aa Mon Sep 17 00:00:00 2001 From: "Masahiro Miyashiro (3846masa)" <3846masahiro@gmail.com> Date: Wed, 22 Jun 2022 22:43:38 +0900 Subject: [PATCH] fix: remove Long import statement when Long was unused (#599) * use conditional output to detect that Long is used * yarn build:test * add comment --- integration/angular/simple-message.ts | 8 ------ integration/avoid-import-conflicts/simple.ts | 10 +------- integration/avoid-import-conflicts/simple2.ts | 8 ------ integration/barrel-imports/bar.ts | 8 ------ integration/barrel-imports/foo.ts | 10 +------- integration/batching-with-context/batching.ts | 10 +------- integration/batching/batching.ts | 8 ------ integration/bytes-as-base64/message.ts | 10 -------- integration/bytes-node/point.ts | 8 ------ integration/const-enum/const-enum.ts | 8 ------ .../enums-as-literals-with-string-enums.ts | 8 ------ .../enums-as-literals/enums-as-literals.ts | 8 ------ integration/fieldmask/fieldmask.ts | 8 ------ .../fieldmask/google/protobuf/field_mask.ts | 8 ------ integration/file-suffix/child.pb.ts | 8 ------ integration/file-suffix/parent.pb.ts | 10 +------- integration/generic-metadata/hero.ts | 10 +------- .../simple.ts | 8 ------ .../generic-service-definitions/simple.ts | 8 ------ integration/global-this/global-this.ts | 8 ------ integration/grpc-js/google/protobuf/empty.ts | 8 ------ integration/grpc-js/google/protobuf/struct.ts | 8 ------ integration/grpc-js/simple.ts | 10 +------- integration/grpc-web-go-server/example.ts | 10 +------- .../example.ts | 10 +------- integration/grpc-web-no-streaming/example.ts | 10 +------- integration/grpc-web/example.ts | 10 +------- integration/lower-case-svc-methods/math.ts | 10 +------- integration/meta-typings/google/type/date.ts | 8 ------ integration/meta-typings/import_dir/thing.ts | 10 +------- integration/meta-typings/simple.ts | 4 +-- integration/nestjs-metadata-grpc-js/hero.ts | 9 ------- .../nestjs-metadata-observables/hero.ts | 9 ------- .../nestjs-metadata-restparameters/hero.ts | 9 ------- integration/nestjs-metadata/hero.ts | 9 ------- integration/nestjs-restparameters/hero.ts | 9 ------- integration/nestjs-simple-observables/hero.ts | 9 ------- .../google/protobuf/empty.ts | 10 -------- .../nestjs-simple-restparameters/hero.ts | 9 ------- .../nestjs-simple/google/protobuf/empty.ts | 10 -------- .../google/protobuf/timestamp.ts | 10 -------- integration/nestjs-simple/hero.ts | 9 ------- .../nice-grpc/google/protobuf/empty.ts | 8 ------ .../nice-grpc/google/protobuf/struct.ts | 8 ------ integration/nice-grpc/simple.ts | 10 +------- .../no-proto-package/no-proto-package.ts | 10 +------- integration/oneof-properties/oneof.ts | 8 ------ .../google/protobuf/struct.ts | 8 ------ integration/oneof-unions-snake/simple.bin | Bin 0 -> 4860 bytes integration/oneof-unions-snake/simple.ts | 8 ------ .../oneof-unions/google/protobuf/struct.ts | 8 ------ integration/oneof-unions/oneof.ts | 8 ------ integration/options/options.ts | 10 +------- integration/options/something/something.ts | 10 +------- integration/point/point.ts | 8 ------ integration/return-observable/observable.ts | 10 +------- .../simple-deprecated-fields/simple.ts | 8 ------ integration/simple-json-name/simple.ts | 10 +------- integration/simple-long-string/simple.ts | 2 +- .../simple-optionals/import_dir/thing.ts | 10 +------- integration/simple-optionals/simple.ts | 4 +-- integration/simple-optionals/thing.ts | 10 +------- integration/simple-proto2/simple.ts | 8 ------ .../google/type/date.ts | 8 ------ .../import_dir/thing.ts | 10 +------- .../simple-prototype-defaults/simple.ts | 4 +-- .../simple-snake/google/protobuf/struct.ts | 8 ------ integration/simple-snake/import_dir/thing.ts | 10 +------- integration/simple-snake/simple.bin | Bin 21936 -> 21936 bytes integration/simple-snake/simple.ts | 4 +-- .../google/protobuf/struct.ts | 8 ------ integration/simple-string-enums/simple.ts | 10 +------- .../import_dir/thing.ts | 10 +------- .../simple-unrecognized-enum/simple.ts | 4 +-- integration/simple/google/type/date.ts | 8 ------ integration/simple/import_dir/thing.ts | 10 +------- integration/simple/simple.ts | 4 +-- integration/struct/google/protobuf/struct.ts | 8 ------ integration/struct/struct.ts | 8 ------ integration/type-registry/bar/bar.ts | 10 +------- integration/type-registry/foo.ts | 10 +------- .../type-registry/google/protobuf/struct.ts | 8 ------ integration/types-with-underscores/file.ts | 8 ------ .../google/protobuf/compiler/plugin.ts | 2 +- integration/unknown-fields/options.ts | 8 ------ .../unknown-fields/something/something.ts | 8 ------ integration/use-date-false/metadata.ts | 10 +------- .../use-date-string/use-date-string.ts | 10 +------- .../use-date-true/google/protobuf/empty.ts | 8 ------ integration/use-date-true/use-date-true.ts | 10 +------- integration/use-exact-types-false/foo.ts | 8 ------ .../use-json-wire-format.bin | Bin 19667 -> 19667 bytes .../objectid/objectid.ts | 8 ------ .../use-objectid-true.ts | 10 +------- integration/value/google/protobuf/struct.ts | 8 ------ integration/value/value.ts | 8 ------ src/main.ts | 24 +++++++++--------- 97 files changed, 57 insertions(+), 753 deletions(-) create mode 100644 integration/oneof-unions-snake/simple.bin diff --git a/integration/angular/simple-message.ts b/integration/angular/simple-message.ts index 5fd10a617..19709f8ad 100644 --- a/integration/angular/simple-message.ts +++ b/integration/angular/simple-message.ts @@ -1,5 +1,4 @@ /* eslint-disable */ -import * as Long from 'long'; import * as _m0 from 'protobufjs/minimal'; export const protobufPackage = 'angular'; @@ -74,13 +73,6 @@ export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & Record>, never>; -// If you get a compile-error about 'Constructor and ... have no overlap', -// add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'. -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); -} - function isSet(value: any): boolean { return value !== null && value !== undefined; } diff --git a/integration/avoid-import-conflicts/simple.ts b/integration/avoid-import-conflicts/simple.ts index a108d960e..453ccd807 100644 --- a/integration/avoid-import-conflicts/simple.ts +++ b/integration/avoid-import-conflicts/simple.ts @@ -1,12 +1,11 @@ /* eslint-disable */ -import * as Long from 'long'; -import * as _m0 from 'protobufjs/minimal'; import { SimpleEnum as SimpleEnum1, Simple as Simple2, simpleEnumFromJSON as simpleEnumFromJSON3, simpleEnumToJSON as simpleEnumToJSON4, } from './simple2'; +import * as _m0 from 'protobufjs/minimal'; export const protobufPackage = 'simple'; @@ -196,13 +195,6 @@ export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & Record>, never>; -// If you get a compile-error about 'Constructor and ... have no overlap', -// add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'. -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); -} - function isSet(value: any): boolean { return value !== null && value !== undefined; } diff --git a/integration/avoid-import-conflicts/simple2.ts b/integration/avoid-import-conflicts/simple2.ts index d8d1807b2..1c75e2fca 100644 --- a/integration/avoid-import-conflicts/simple2.ts +++ b/integration/avoid-import-conflicts/simple2.ts @@ -1,5 +1,4 @@ /* eslint-disable */ -import * as Long from 'long'; import * as _m0 from 'protobufjs/minimal'; export const protobufPackage = 'simple2'; @@ -123,13 +122,6 @@ export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & Record>, never>; -// If you get a compile-error about 'Constructor and ... have no overlap', -// add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'. -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); -} - function isSet(value: any): boolean { return value !== null && value !== undefined; } diff --git a/integration/barrel-imports/bar.ts b/integration/barrel-imports/bar.ts index c9b0c0f02..2c06f57d9 100644 --- a/integration/barrel-imports/bar.ts +++ b/integration/barrel-imports/bar.ts @@ -1,5 +1,4 @@ /* eslint-disable */ -import * as Long from 'long'; import * as _m0 from 'protobufjs/minimal'; export interface Bar { @@ -82,13 +81,6 @@ type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & Record>, never>; -// If you get a compile-error about 'Constructor and ... have no overlap', -// add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'. -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); -} - function isSet(value: any): boolean { return value !== null && value !== undefined; } diff --git a/integration/barrel-imports/foo.ts b/integration/barrel-imports/foo.ts index 6b7f9cf5c..d9f65cbd6 100644 --- a/integration/barrel-imports/foo.ts +++ b/integration/barrel-imports/foo.ts @@ -1,7 +1,6 @@ /* eslint-disable */ -import * as Long from 'long'; -import * as _m0 from 'protobufjs/minimal'; import { Bar } from './bar'; +import * as _m0 from 'protobufjs/minimal'; export interface Foo { name: string; @@ -83,13 +82,6 @@ type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & Record>, never>; -// If you get a compile-error about 'Constructor and ... have no overlap', -// add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'. -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); -} - function isSet(value: any): boolean { return value !== null && value !== undefined; } diff --git a/integration/batching-with-context/batching.ts b/integration/batching-with-context/batching.ts index a04bd9e9c..0cf8c74c2 100644 --- a/integration/batching-with-context/batching.ts +++ b/integration/batching-with-context/batching.ts @@ -1,8 +1,7 @@ /* eslint-disable */ -import * as Long from 'long'; -import * as _m0 from 'protobufjs/minimal'; import * as DataLoader from 'dataloader'; import * as hash from 'object-hash'; +import * as _m0 from 'protobufjs/minimal'; export const protobufPackage = 'batching'; @@ -691,13 +690,6 @@ export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & Record>, never>; -// If you get a compile-error about 'Constructor and ... have no overlap', -// add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'. -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); -} - function isObject(value: any): boolean { return typeof value === 'object' && value !== null; } diff --git a/integration/batching/batching.ts b/integration/batching/batching.ts index 9d7083a89..97d24cdf7 100644 --- a/integration/batching/batching.ts +++ b/integration/batching/batching.ts @@ -1,5 +1,4 @@ /* eslint-disable */ -import * as Long from 'long'; import * as _m0 from 'protobufjs/minimal'; export const protobufPackage = 'batching'; @@ -639,13 +638,6 @@ export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & Record>, never>; -// If you get a compile-error about 'Constructor and ... have no overlap', -// add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'. -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); -} - function isObject(value: any): boolean { return typeof value === 'object' && value !== null; } diff --git a/integration/bytes-as-base64/message.ts b/integration/bytes-as-base64/message.ts index 8a3e0e8fc..8f9f0e113 100644 --- a/integration/bytes-as-base64/message.ts +++ b/integration/bytes-as-base64/message.ts @@ -1,7 +1,4 @@ /* eslint-disable */ -import * as Long from 'long'; -import * as _m0 from 'protobufjs/minimal'; - export const protobufPackage = ''; export interface Message { @@ -82,13 +79,6 @@ export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & Record>, never>; -// If you get a compile-error about 'Constructor and ... have no overlap', -// add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'. -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); -} - function isSet(value: any): boolean { return value !== null && value !== undefined; } diff --git a/integration/bytes-node/point.ts b/integration/bytes-node/point.ts index ed60534a1..0f8ad7810 100644 --- a/integration/bytes-node/point.ts +++ b/integration/bytes-node/point.ts @@ -1,5 +1,4 @@ /* eslint-disable */ -import * as Long from 'long'; import * as _m0 from 'protobufjs/minimal'; import { BytesValue } from './google/protobuf/wrappers'; @@ -118,13 +117,6 @@ export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & Record>, never>; -// If you get a compile-error about 'Constructor and ... have no overlap', -// add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'. -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); -} - function isSet(value: any): boolean { return value !== null && value !== undefined; } diff --git a/integration/const-enum/const-enum.ts b/integration/const-enum/const-enum.ts index cca45141d..262c455d8 100644 --- a/integration/const-enum/const-enum.ts +++ b/integration/const-enum/const-enum.ts @@ -1,5 +1,4 @@ /* eslint-disable */ -import * as Long from 'long'; import * as _m0 from 'protobufjs/minimal'; export const protobufPackage = ''; @@ -229,13 +228,6 @@ export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & Record>, never>; -// If you get a compile-error about 'Constructor and ... have no overlap', -// add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'. -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); -} - function isObject(value: any): boolean { return typeof value === 'object' && value !== null; } diff --git a/integration/enums-as-literals-with-string-enums/enums-as-literals-with-string-enums.ts b/integration/enums-as-literals-with-string-enums/enums-as-literals-with-string-enums.ts index 9fea70268..c6d10e0ec 100644 --- a/integration/enums-as-literals-with-string-enums/enums-as-literals-with-string-enums.ts +++ b/integration/enums-as-literals-with-string-enums/enums-as-literals-with-string-enums.ts @@ -1,5 +1,4 @@ /* eslint-disable */ -import * as Long from 'long'; import * as _m0 from 'protobufjs/minimal'; export const protobufPackage = ''; @@ -137,13 +136,6 @@ export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & Record>, never>; -// If you get a compile-error about 'Constructor and ... have no overlap', -// add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'. -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); -} - function isSet(value: any): boolean { return value !== null && value !== undefined; } diff --git a/integration/enums-as-literals/enums-as-literals.ts b/integration/enums-as-literals/enums-as-literals.ts index c3d27c92e..ab7a14215 100644 --- a/integration/enums-as-literals/enums-as-literals.ts +++ b/integration/enums-as-literals/enums-as-literals.ts @@ -1,5 +1,4 @@ /* eslint-disable */ -import * as Long from 'long'; import * as _m0 from 'protobufjs/minimal'; export const protobufPackage = ''; @@ -121,13 +120,6 @@ export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & Record>, never>; -// If you get a compile-error about 'Constructor and ... have no overlap', -// add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'. -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); -} - function isSet(value: any): boolean { return value !== null && value !== undefined; } diff --git a/integration/fieldmask/fieldmask.ts b/integration/fieldmask/fieldmask.ts index 9f248194f..f6be6e71a 100644 --- a/integration/fieldmask/fieldmask.ts +++ b/integration/fieldmask/fieldmask.ts @@ -1,5 +1,4 @@ /* eslint-disable */ -import * as Long from 'long'; import * as _m0 from 'protobufjs/minimal'; import { FieldMask } from './google/protobuf/field_mask'; @@ -75,13 +74,6 @@ export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & Record>, never>; -// If you get a compile-error about 'Constructor and ... have no overlap', -// add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'. -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); -} - function isSet(value: any): boolean { return value !== null && value !== undefined; } diff --git a/integration/fieldmask/google/protobuf/field_mask.ts b/integration/fieldmask/google/protobuf/field_mask.ts index 570dedc07..811dfd74e 100644 --- a/integration/fieldmask/google/protobuf/field_mask.ts +++ b/integration/fieldmask/google/protobuf/field_mask.ts @@ -1,5 +1,4 @@ /* eslint-disable */ -import * as Long from 'long'; import * as _m0 from 'protobufjs/minimal'; export const protobufPackage = 'google.protobuf'; @@ -286,10 +285,3 @@ type KeysOfUnion = T extends T ? keyof T : never; export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & Record>, never>; - -// If you get a compile-error about 'Constructor and ... have no overlap', -// add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'. -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); -} diff --git a/integration/file-suffix/child.pb.ts b/integration/file-suffix/child.pb.ts index ae0e1607c..a2cdac7da 100644 --- a/integration/file-suffix/child.pb.ts +++ b/integration/file-suffix/child.pb.ts @@ -1,5 +1,4 @@ /* eslint-disable */ -import * as Long from 'long'; import * as _m0 from 'protobufjs/minimal'; export const protobufPackage = 'file_suffix'; @@ -107,13 +106,6 @@ export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & Record>, never>; -// If you get a compile-error about 'Constructor and ... have no overlap', -// add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'. -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); -} - function isSet(value: any): boolean { return value !== null && value !== undefined; } diff --git a/integration/file-suffix/parent.pb.ts b/integration/file-suffix/parent.pb.ts index 76e98b915..2808a94bd 100644 --- a/integration/file-suffix/parent.pb.ts +++ b/integration/file-suffix/parent.pb.ts @@ -1,8 +1,7 @@ /* eslint-disable */ -import * as Long from 'long'; -import * as _m0 from 'protobufjs/minimal'; import { ChildEnum, Child, childEnumFromJSON, childEnumToJSON } from './child.pb'; import { Timestamp } from './google/protobuf/timestamp.pb'; +import * as _m0 from 'protobufjs/minimal'; export const protobufPackage = 'file_suffix'; @@ -118,13 +117,6 @@ function fromJsonTimestamp(o: any): Date { } } -// If you get a compile-error about 'Constructor and ... have no overlap', -// add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'. -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); -} - function isSet(value: any): boolean { return value !== null && value !== undefined; } diff --git a/integration/generic-metadata/hero.ts b/integration/generic-metadata/hero.ts index 1f43611ed..c34c95abb 100644 --- a/integration/generic-metadata/hero.ts +++ b/integration/generic-metadata/hero.ts @@ -1,9 +1,8 @@ /* eslint-disable */ -import * as Long from 'long'; -import * as _m0 from 'protobufjs/minimal'; import { Observable } from 'rxjs'; import { Foo } from './some-file'; import { map } from 'rxjs/operators'; +import * as _m0 from 'protobufjs/minimal'; export const protobufPackage = 'hero'; @@ -328,13 +327,6 @@ export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & Record>, never>; -// If you get a compile-error about 'Constructor and ... have no overlap', -// add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'. -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); -} - function isSet(value: any): boolean { return value !== null && value !== undefined; } diff --git a/integration/generic-service-definitions-and-services/simple.ts b/integration/generic-service-definitions-and-services/simple.ts index 0890c6919..000963397 100644 --- a/integration/generic-service-definitions-and-services/simple.ts +++ b/integration/generic-service-definitions-and-services/simple.ts @@ -1,5 +1,4 @@ /* eslint-disable */ -import * as Long from 'long'; import * as _m0 from 'protobufjs/minimal'; export const protobufPackage = 'simple'; @@ -144,13 +143,6 @@ export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & Record>, never>; -// If you get a compile-error about 'Constructor and ... have no overlap', -// add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'. -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); -} - function isSet(value: any): boolean { return value !== null && value !== undefined; } diff --git a/integration/generic-service-definitions/simple.ts b/integration/generic-service-definitions/simple.ts index 0890c6919..000963397 100644 --- a/integration/generic-service-definitions/simple.ts +++ b/integration/generic-service-definitions/simple.ts @@ -1,5 +1,4 @@ /* eslint-disable */ -import * as Long from 'long'; import * as _m0 from 'protobufjs/minimal'; export const protobufPackage = 'simple'; @@ -144,13 +143,6 @@ export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & Record>, never>; -// If you get a compile-error about 'Constructor and ... have no overlap', -// add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'. -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); -} - function isSet(value: any): boolean { return value !== null && value !== undefined; } diff --git a/integration/global-this/global-this.ts b/integration/global-this/global-this.ts index db1793210..9bc9b55e5 100644 --- a/integration/global-this/global-this.ts +++ b/integration/global-this/global-this.ts @@ -1,5 +1,4 @@ /* eslint-disable */ -import * as Long from 'long'; import * as _m0 from 'protobufjs/minimal'; export const protobufPackage = 'simple'; @@ -127,13 +126,6 @@ export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & Record>, never>; -// If you get a compile-error about 'Constructor and ... have no overlap', -// add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'. -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); -} - function isSet(value: any): boolean { return value !== null && value !== undefined; } diff --git a/integration/grpc-js/google/protobuf/empty.ts b/integration/grpc-js/google/protobuf/empty.ts index fd9332ed8..5849fae1d 100644 --- a/integration/grpc-js/google/protobuf/empty.ts +++ b/integration/grpc-js/google/protobuf/empty.ts @@ -1,5 +1,4 @@ /* eslint-disable */ -import * as Long from 'long'; import * as _m0 from 'protobufjs/minimal'; export const protobufPackage = 'google.protobuf'; @@ -72,10 +71,3 @@ type KeysOfUnion = T extends T ? keyof T : never; export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & Record>, never>; - -// If you get a compile-error about 'Constructor and ... have no overlap', -// add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'. -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); -} diff --git a/integration/grpc-js/google/protobuf/struct.ts b/integration/grpc-js/google/protobuf/struct.ts index df4825442..f58c0f87d 100644 --- a/integration/grpc-js/google/protobuf/struct.ts +++ b/integration/grpc-js/google/protobuf/struct.ts @@ -1,5 +1,4 @@ /* eslint-disable */ -import * as Long from 'long'; import * as _m0 from 'protobufjs/minimal'; export const protobufPackage = 'google.protobuf'; @@ -462,13 +461,6 @@ export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & Record>, never>; -// If you get a compile-error about 'Constructor and ... have no overlap', -// add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'. -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); -} - function isObject(value: any): boolean { return typeof value === 'object' && value !== null; } diff --git a/integration/grpc-js/simple.ts b/integration/grpc-js/simple.ts index 6111e5301..2fc4dd787 100644 --- a/integration/grpc-js/simple.ts +++ b/integration/grpc-js/simple.ts @@ -1,5 +1,4 @@ /* eslint-disable */ -import * as Long from 'long'; import { makeGenericClientConstructor, ChannelCredentials, @@ -18,7 +17,6 @@ import { ClientDuplexStream, ServiceError, } from '@grpc/grpc-js'; -import * as _m0 from 'protobufjs/minimal'; import { Timestamp } from './google/protobuf/timestamp'; import { Empty } from './google/protobuf/empty'; import { @@ -33,6 +31,7 @@ import { BoolValue, } from './google/protobuf/wrappers'; import { Struct, ListValue, Value } from './google/protobuf/struct'; +import * as _m0 from 'protobufjs/minimal'; export const protobufPackage = 'simple'; @@ -663,13 +662,6 @@ function fromJsonTimestamp(o: any): Date { } } -// If you get a compile-error about 'Constructor and ... have no overlap', -// add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'. -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); -} - function isSet(value: any): boolean { return value !== null && value !== undefined; } diff --git a/integration/grpc-web-go-server/example.ts b/integration/grpc-web-go-server/example.ts index aa5eaf406..9f6e33a36 100644 --- a/integration/grpc-web-go-server/example.ts +++ b/integration/grpc-web-go-server/example.ts @@ -1,8 +1,7 @@ /* eslint-disable */ -import * as Long from 'long'; -import * as _m0 from 'protobufjs/minimal'; import { Observable } from 'rxjs'; import { map } from 'rxjs/operators'; +import * as _m0 from 'protobufjs/minimal'; export const protobufPackage = 'rpx'; @@ -678,13 +677,6 @@ export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & Record>, never>; -// If you get a compile-error about 'Constructor and ... have no overlap', -// add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'. -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); -} - function isSet(value: any): boolean { return value !== null && value !== undefined; } diff --git a/integration/grpc-web-no-streaming-observable/example.ts b/integration/grpc-web-no-streaming-observable/example.ts index 7f0a75273..d41f7911c 100644 --- a/integration/grpc-web-no-streaming-observable/example.ts +++ b/integration/grpc-web-no-streaming-observable/example.ts @@ -1,10 +1,9 @@ /* eslint-disable */ -import * as Long from 'long'; import { grpc } from '@improbable-eng/grpc-web'; -import * as _m0 from 'protobufjs/minimal'; import { Observable } from 'rxjs'; import { BrowserHeaders } from 'browser-headers'; import { take } from 'rxjs/operators'; +import * as _m0 from 'protobufjs/minimal'; export const protobufPackage = 'rpx'; @@ -432,13 +431,6 @@ export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & Record>, never>; -// If you get a compile-error about 'Constructor and ... have no overlap', -// add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'. -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); -} - function isSet(value: any): boolean { return value !== null && value !== undefined; } diff --git a/integration/grpc-web-no-streaming/example.ts b/integration/grpc-web-no-streaming/example.ts index b75f246e5..ce091737e 100644 --- a/integration/grpc-web-no-streaming/example.ts +++ b/integration/grpc-web-no-streaming/example.ts @@ -1,8 +1,7 @@ /* eslint-disable */ -import * as Long from 'long'; import { grpc } from '@improbable-eng/grpc-web'; -import * as _m0 from 'protobufjs/minimal'; import { BrowserHeaders } from 'browser-headers'; +import * as _m0 from 'protobufjs/minimal'; export const protobufPackage = 'rpx'; @@ -432,13 +431,6 @@ export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & Record>, never>; -// If you get a compile-error about 'Constructor and ... have no overlap', -// add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'. -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); -} - function isSet(value: any): boolean { return value !== null && value !== undefined; } diff --git a/integration/grpc-web/example.ts b/integration/grpc-web/example.ts index da8dd9581..016f6f1aa 100644 --- a/integration/grpc-web/example.ts +++ b/integration/grpc-web/example.ts @@ -1,10 +1,9 @@ /* eslint-disable */ -import * as Long from 'long'; import { grpc } from '@improbable-eng/grpc-web'; -import * as _m0 from 'protobufjs/minimal'; import { Observable } from 'rxjs'; import { BrowserHeaders } from 'browser-headers'; import { share } from 'rxjs/operators'; +import * as _m0 from 'protobufjs/minimal'; export const protobufPackage = 'rpx'; @@ -910,13 +909,6 @@ export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & Record>, never>; -// If you get a compile-error about 'Constructor and ... have no overlap', -// add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'. -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); -} - function isSet(value: any): boolean { return value !== null && value !== undefined; } diff --git a/integration/lower-case-svc-methods/math.ts b/integration/lower-case-svc-methods/math.ts index f7a056276..50e642809 100644 --- a/integration/lower-case-svc-methods/math.ts +++ b/integration/lower-case-svc-methods/math.ts @@ -1,8 +1,7 @@ /* eslint-disable */ -import * as Long from 'long'; -import * as _m0 from 'protobufjs/minimal'; import * as DataLoader from 'dataloader'; import * as hash from 'object-hash'; +import * as _m0 from 'protobufjs/minimal'; export const protobufPackage = ''; @@ -265,13 +264,6 @@ export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & Record>, never>; -// If you get a compile-error about 'Constructor and ... have no overlap', -// add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'. -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); -} - function isSet(value: any): boolean { return value !== null && value !== undefined; } diff --git a/integration/meta-typings/google/type/date.ts b/integration/meta-typings/google/type/date.ts index 1f18e9365..1bd406c2a 100644 --- a/integration/meta-typings/google/type/date.ts +++ b/integration/meta-typings/google/type/date.ts @@ -1,6 +1,5 @@ /* eslint-disable */ import { FileDescriptorProto } from 'ts-proto-descriptors'; -import * as Long from 'long'; import * as _m0 from 'protobufjs/minimal'; export const protobufPackage = 'google.type'; @@ -237,10 +236,3 @@ export const protoMetadata: ProtoMetadata = { references: { '.google.type.DateMessage': DateMessage }, dependencies: [], }; - -// If you get a compile-error about 'Constructor and ... have no overlap', -// add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'. -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); -} diff --git a/integration/meta-typings/import_dir/thing.ts b/integration/meta-typings/import_dir/thing.ts index d1a35afb5..2c0b16283 100644 --- a/integration/meta-typings/import_dir/thing.ts +++ b/integration/meta-typings/import_dir/thing.ts @@ -1,8 +1,7 @@ /* eslint-disable */ import { FileDescriptorProto } from 'ts-proto-descriptors'; -import * as Long from 'long'; -import * as _m0 from 'protobufjs/minimal'; import { protoMetadata as protoMetadata1, Timestamp } from '../google/protobuf/timestamp'; +import * as _m0 from 'protobufjs/minimal'; export const protobufPackage = 'simple'; @@ -129,10 +128,3 @@ function fromTimestamp(t: Timestamp): Date { millis += t.nanos / 1_000_000; return new Date(millis); } - -// If you get a compile-error about 'Constructor and ... have no overlap', -// add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'. -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); -} diff --git a/integration/meta-typings/simple.ts b/integration/meta-typings/simple.ts index aca5f97d3..75c694ac1 100644 --- a/integration/meta-typings/simple.ts +++ b/integration/meta-typings/simple.ts @@ -1,11 +1,11 @@ /* eslint-disable */ import { FileDescriptorProto } from 'ts-proto-descriptors'; -import * as Long from 'long'; -import * as _m0 from 'protobufjs/minimal'; import { protoMetadata as protoMetadata1, DateMessage } from './google/type/date'; import { protoMetadata as protoMetadata2, StringValue, Int32Value, BoolValue } from './google/protobuf/wrappers'; import { protoMetadata as protoMetadata3, Timestamp } from './google/protobuf/timestamp'; import { protoMetadata as protoMetadata4, ImportedThing } from './import_dir/thing'; +import * as Long from 'long'; +import * as _m0 from 'protobufjs/minimal'; export const protobufPackage = 'simple'; diff --git a/integration/nestjs-metadata-grpc-js/hero.ts b/integration/nestjs-metadata-grpc-js/hero.ts index 391dabab4..fc92d83db 100644 --- a/integration/nestjs-metadata-grpc-js/hero.ts +++ b/integration/nestjs-metadata-grpc-js/hero.ts @@ -1,7 +1,5 @@ /* eslint-disable */ import { GrpcMethod, GrpcStreamMethod } from '@nestjs/microservices'; -import * as Long from 'long'; -import * as _m0 from 'protobufjs/minimal'; import { Observable } from 'rxjs'; import { Metadata } from '@grpc/grpc-js'; @@ -59,10 +57,3 @@ export function HeroServiceControllerMethods() { } export const HERO_SERVICE_NAME = 'HeroService'; - -// If you get a compile-error about 'Constructor and ... have no overlap', -// add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'. -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); -} diff --git a/integration/nestjs-metadata-observables/hero.ts b/integration/nestjs-metadata-observables/hero.ts index c42113931..64dc37d37 100644 --- a/integration/nestjs-metadata-observables/hero.ts +++ b/integration/nestjs-metadata-observables/hero.ts @@ -1,7 +1,5 @@ /* eslint-disable */ import { GrpcMethod, GrpcStreamMethod } from '@nestjs/microservices'; -import * as Long from 'long'; -import * as _m0 from 'protobufjs/minimal'; import { Observable } from 'rxjs'; import { Metadata } from '@grpc/grpc-js'; @@ -59,10 +57,3 @@ export function HeroServiceControllerMethods() { } export const HERO_SERVICE_NAME = 'HeroService'; - -// If you get a compile-error about 'Constructor and ... have no overlap', -// add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'. -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); -} diff --git a/integration/nestjs-metadata-restparameters/hero.ts b/integration/nestjs-metadata-restparameters/hero.ts index 6fe22beaa..fe0e557a2 100644 --- a/integration/nestjs-metadata-restparameters/hero.ts +++ b/integration/nestjs-metadata-restparameters/hero.ts @@ -1,7 +1,5 @@ /* eslint-disable */ import { GrpcMethod, GrpcStreamMethod } from '@nestjs/microservices'; -import * as Long from 'long'; -import * as _m0 from 'protobufjs/minimal'; import { Observable } from 'rxjs'; import { Metadata } from '@grpc/grpc-js'; @@ -63,10 +61,3 @@ export function HeroServiceControllerMethods() { } export const HERO_SERVICE_NAME = 'HeroService'; - -// If you get a compile-error about 'Constructor and ... have no overlap', -// add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'. -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); -} diff --git a/integration/nestjs-metadata/hero.ts b/integration/nestjs-metadata/hero.ts index 391dabab4..fc92d83db 100644 --- a/integration/nestjs-metadata/hero.ts +++ b/integration/nestjs-metadata/hero.ts @@ -1,7 +1,5 @@ /* eslint-disable */ import { GrpcMethod, GrpcStreamMethod } from '@nestjs/microservices'; -import * as Long from 'long'; -import * as _m0 from 'protobufjs/minimal'; import { Observable } from 'rxjs'; import { Metadata } from '@grpc/grpc-js'; @@ -59,10 +57,3 @@ export function HeroServiceControllerMethods() { } export const HERO_SERVICE_NAME = 'HeroService'; - -// If you get a compile-error about 'Constructor and ... have no overlap', -// add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'. -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); -} diff --git a/integration/nestjs-restparameters/hero.ts b/integration/nestjs-restparameters/hero.ts index 44758442c..92972371b 100644 --- a/integration/nestjs-restparameters/hero.ts +++ b/integration/nestjs-restparameters/hero.ts @@ -1,7 +1,5 @@ /* eslint-disable */ import { GrpcMethod, GrpcStreamMethod } from '@nestjs/microservices'; -import * as Long from 'long'; -import * as _m0 from 'protobufjs/minimal'; import { Observable } from 'rxjs'; export const protobufPackage = 'hero'; @@ -58,10 +56,3 @@ export function HeroServiceControllerMethods() { } export const HERO_SERVICE_NAME = 'HeroService'; - -// If you get a compile-error about 'Constructor and ... have no overlap', -// add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'. -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); -} diff --git a/integration/nestjs-simple-observables/hero.ts b/integration/nestjs-simple-observables/hero.ts index 21685a52d..d238e2cb6 100644 --- a/integration/nestjs-simple-observables/hero.ts +++ b/integration/nestjs-simple-observables/hero.ts @@ -1,7 +1,5 @@ /* eslint-disable */ import { GrpcMethod, GrpcStreamMethod } from '@nestjs/microservices'; -import * as Long from 'long'; -import * as _m0 from 'protobufjs/minimal'; import { Observable } from 'rxjs'; export const protobufPackage = 'hero'; @@ -58,10 +56,3 @@ export function HeroServiceControllerMethods() { } export const HERO_SERVICE_NAME = 'HeroService'; - -// If you get a compile-error about 'Constructor and ... have no overlap', -// add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'. -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); -} diff --git a/integration/nestjs-simple-restparameters/google/protobuf/empty.ts b/integration/nestjs-simple-restparameters/google/protobuf/empty.ts index c8eea3c69..b50215678 100644 --- a/integration/nestjs-simple-restparameters/google/protobuf/empty.ts +++ b/integration/nestjs-simple-restparameters/google/protobuf/empty.ts @@ -1,7 +1,4 @@ /* eslint-disable */ -import * as Long from 'long'; -import * as _m0 from 'protobufjs/minimal'; - export const protobufPackage = 'google.protobuf'; /** @@ -18,10 +15,3 @@ export const protobufPackage = 'google.protobuf'; export interface Empty {} export const GOOGLE_PROTOBUF_PACKAGE_NAME = 'google.protobuf'; - -// If you get a compile-error about 'Constructor and ... have no overlap', -// add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'. -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); -} diff --git a/integration/nestjs-simple-restparameters/hero.ts b/integration/nestjs-simple-restparameters/hero.ts index 9b0cc79b0..475b19809 100644 --- a/integration/nestjs-simple-restparameters/hero.ts +++ b/integration/nestjs-simple-restparameters/hero.ts @@ -1,7 +1,5 @@ /* eslint-disable */ import { GrpcMethod, GrpcStreamMethod } from '@nestjs/microservices'; -import * as Long from 'long'; -import * as _m0 from 'protobufjs/minimal'; import { Observable } from 'rxjs'; import { Empty } from './google/protobuf/empty'; @@ -38,10 +36,3 @@ export function HeroServiceControllerMethods() { } export const HERO_SERVICE_NAME = 'HeroService'; - -// If you get a compile-error about 'Constructor and ... have no overlap', -// add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'. -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); -} diff --git a/integration/nestjs-simple/google/protobuf/empty.ts b/integration/nestjs-simple/google/protobuf/empty.ts index c8eea3c69..b50215678 100644 --- a/integration/nestjs-simple/google/protobuf/empty.ts +++ b/integration/nestjs-simple/google/protobuf/empty.ts @@ -1,7 +1,4 @@ /* eslint-disable */ -import * as Long from 'long'; -import * as _m0 from 'protobufjs/minimal'; - export const protobufPackage = 'google.protobuf'; /** @@ -18,10 +15,3 @@ export const protobufPackage = 'google.protobuf'; export interface Empty {} export const GOOGLE_PROTOBUF_PACKAGE_NAME = 'google.protobuf'; - -// If you get a compile-error about 'Constructor and ... have no overlap', -// add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'. -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); -} diff --git a/integration/nestjs-simple/google/protobuf/timestamp.ts b/integration/nestjs-simple/google/protobuf/timestamp.ts index a5467d162..46f31ae23 100644 --- a/integration/nestjs-simple/google/protobuf/timestamp.ts +++ b/integration/nestjs-simple/google/protobuf/timestamp.ts @@ -1,7 +1,4 @@ /* eslint-disable */ -import * as Long from 'long'; -import * as _m0 from 'protobufjs/minimal'; - export const protobufPackage = 'google.protobuf'; /** @@ -114,10 +111,3 @@ export interface Timestamp { } export const GOOGLE_PROTOBUF_PACKAGE_NAME = 'google.protobuf'; - -// If you get a compile-error about 'Constructor and ... have no overlap', -// add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'. -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); -} diff --git a/integration/nestjs-simple/hero.ts b/integration/nestjs-simple/hero.ts index 6783ff75d..7028e042f 100644 --- a/integration/nestjs-simple/hero.ts +++ b/integration/nestjs-simple/hero.ts @@ -1,7 +1,5 @@ /* eslint-disable */ import { GrpcMethod, GrpcStreamMethod } from '@nestjs/microservices'; -import * as Long from 'long'; -import * as _m0 from 'protobufjs/minimal'; import { Observable } from 'rxjs'; import { Timestamp } from './google/protobuf/timestamp'; import { Empty } from './google/protobuf/empty'; @@ -73,10 +71,3 @@ export function HeroServiceControllerMethods() { } export const HERO_SERVICE_NAME = 'HeroService'; - -// If you get a compile-error about 'Constructor and ... have no overlap', -// add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'. -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); -} diff --git a/integration/nice-grpc/google/protobuf/empty.ts b/integration/nice-grpc/google/protobuf/empty.ts index 9568eefa5..3e2434b93 100644 --- a/integration/nice-grpc/google/protobuf/empty.ts +++ b/integration/nice-grpc/google/protobuf/empty.ts @@ -1,5 +1,4 @@ /* eslint-disable */ -import * as Long from 'long'; import * as _m0 from 'protobufjs/minimal'; export const protobufPackage = 'google.protobuf'; @@ -67,10 +66,3 @@ export type DeepPartial = T extends Builtin : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; - -// If you get a compile-error about 'Constructor and ... have no overlap', -// add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'. -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); -} diff --git a/integration/nice-grpc/google/protobuf/struct.ts b/integration/nice-grpc/google/protobuf/struct.ts index 29a16fca1..3c6bc6cf9 100644 --- a/integration/nice-grpc/google/protobuf/struct.ts +++ b/integration/nice-grpc/google/protobuf/struct.ts @@ -1,5 +1,4 @@ /* eslint-disable */ -import * as Long from 'long'; import * as _m0 from 'protobufjs/minimal'; export const protobufPackage = 'google.protobuf'; @@ -457,13 +456,6 @@ export type DeepPartial = T extends Builtin ? { [K in keyof T]?: DeepPartial } : Partial; -// If you get a compile-error about 'Constructor and ... have no overlap', -// add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'. -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); -} - function isObject(value: any): boolean { return typeof value === 'object' && value !== null; } diff --git a/integration/nice-grpc/simple.ts b/integration/nice-grpc/simple.ts index 9a86ab1d8..a20f3ca76 100644 --- a/integration/nice-grpc/simple.ts +++ b/integration/nice-grpc/simple.ts @@ -1,6 +1,4 @@ /* eslint-disable */ -import * as Long from 'long'; -import * as _m0 from 'protobufjs/minimal'; import { CallContext, CallOptions } from 'nice-grpc-common'; import { Timestamp } from './google/protobuf/timestamp'; import { Empty } from './google/protobuf/empty'; @@ -16,6 +14,7 @@ import { BoolValue, } from './google/protobuf/wrappers'; import { Struct, Value, ListValue } from './google/protobuf/struct'; +import * as _m0 from 'protobufjs/minimal'; export const protobufPackage = 'simple'; @@ -398,13 +397,6 @@ function fromJsonTimestamp(o: any): Date { } } -// If you get a compile-error about 'Constructor and ... have no overlap', -// add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'. -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); -} - function isSet(value: any): boolean { return value !== null && value !== undefined; } diff --git a/integration/no-proto-package/no-proto-package.ts b/integration/no-proto-package/no-proto-package.ts index a0253987e..c846b24e3 100644 --- a/integration/no-proto-package/no-proto-package.ts +++ b/integration/no-proto-package/no-proto-package.ts @@ -1,8 +1,7 @@ /* eslint-disable */ -import * as Long from 'long'; -import * as _m0 from 'protobufjs/minimal'; import { Observable } from 'rxjs'; import { map } from 'rxjs/operators'; +import * as _m0 from 'protobufjs/minimal'; export const protobufPackage = ''; @@ -141,13 +140,6 @@ export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & Record>, never>; -// If you get a compile-error about 'Constructor and ... have no overlap', -// add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'. -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); -} - function isSet(value: any): boolean { return value !== null && value !== undefined; } diff --git a/integration/oneof-properties/oneof.ts b/integration/oneof-properties/oneof.ts index 4bf89b448..8487bca8d 100644 --- a/integration/oneof-properties/oneof.ts +++ b/integration/oneof-properties/oneof.ts @@ -1,5 +1,4 @@ /* eslint-disable */ -import * as Long from 'long'; import * as _m0 from 'protobufjs/minimal'; export const protobufPackage = 'oneof'; @@ -328,13 +327,6 @@ export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & Record>, never>; -// If you get a compile-error about 'Constructor and ... have no overlap', -// add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'. -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); -} - function isSet(value: any): boolean { return value !== null && value !== undefined; } diff --git a/integration/oneof-unions-snake/google/protobuf/struct.ts b/integration/oneof-unions-snake/google/protobuf/struct.ts index 4896a1507..bb96718fa 100644 --- a/integration/oneof-unions-snake/google/protobuf/struct.ts +++ b/integration/oneof-unions-snake/google/protobuf/struct.ts @@ -1,5 +1,4 @@ /* eslint-disable */ -import * as Long from 'long'; import * as _m0 from 'protobufjs/minimal'; export const protobufPackage = 'google.protobuf'; @@ -499,13 +498,6 @@ export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & Record>, never>; -// If you get a compile-error about 'Constructor and ... have no overlap', -// add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'. -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); -} - function isObject(value: any): boolean { return typeof value === 'object' && value !== null; } diff --git a/integration/oneof-unions-snake/simple.bin b/integration/oneof-unions-snake/simple.bin new file mode 100644 index 0000000000000000000000000000000000000000..ca4927412a548a0607195dd36430ccde631d9237 GIT binary patch literal 4860 zcmbtY%W~Vu6(s>urd#rhcE$?*>c}&Gg{G#IN!7%jsVR_zDA*Lq0Z1vDDaQiImV}rD zSO6$nvq@FHB9+Q2i&Q1cWHIYhWtmleAit4aa&9*Oy<%q(E$l}3y{GTv^u66=OOZF7 zO+;-L260d+mGrCEm-8#R@BY2QZtn-d{zR0#N?ZMVp4@ zDk~nklet*dFt@n&(K+xfTD6tXGwt*I%AYk>l#{TG`SZ!-wE`f}%WIW$03C=(`Hh@? zk>r)~eYWJ!r$Z4Y>a>3zB8zG^6GEIke?Jk@$#4=K*)T)TPBQWeJp9^y(HUQWCy)m@Of=e=x0M9S0FBriYe3#{V$<`Y4#5^`*Y3oaqr0d--ox z6VB`h6W8Cb1>ycN6XTE-s;u=q}^>v=GG(>xLMm4lgUex z?vvt+-`-&h<-*i+dqi;+NYm>o+xn3AJsTFCKE2#A|8rJgok2WWBeeFXVJ6O z)v-7flVFC8(qJGi%1apW6qb__tBi45jFF(w8_r`d@VV=c`8*OZheyFY90@ry^n5ow zl6FN^{?>~Rco53}gE{P+24io}8@Yr~p)JvhXn>)WFrdp;qtnD}r*B*JLBDG|jIS6DR9EDR(b?hV&wIA%IJ|3fYqQt3fChNm z==3eqsdB5+Xb+lJr&Z-Z;GJ%t@wT;T^&!{qR^_(m^>}xkZ<=;v129J2YFqssx#7Ci z@6cxJU7K-(_YAvlH3n_N=DmU4>pCVU&zhFgXdBk1*{orI?8(h7v(x9!hS6@Hc9ik% zcE_~I`jc+*x(O?ddfTL}u=Nf=ZL`rQhmJ=L1P=zbtBgB6vteO`c$f%-VeeEEP{;gw z04Xf;rm<%j`5vvZqTh+m>TKM#3!E z)*?&_^R|IaK@@CEjD%fC5sgn!7ePioxwX!X<`zJjsWceiSP5OAoio8ALrKP7D zJPp<4!`zCLWM!R(YVuL;M{@GxvQERl=u9i*%7wMuPxF;O=zLc-++7st8FeQgb-?9l zGq_01Llgtq@?_tyQelZuo~a?A5UJ}O<8KeV(E;krjOxqy2z3e#W->YA)S<^*-5GE| zs86AUQ750f`vUDL-5mWy_D@pY6Q@y?}NYZZl; z@n{r!Gig``k52MN@E16ebLyZ6}N zG|(hpE_|8W%vZkG`0f_n{LZlCJv$|Y7`f=cf~yXOCXXvLZXEcZZqGELyNth2Bf9en zmo6j-%V-`(lyk*FMV~75E0<-LgOpQ7(!9_j;klfp;E8wWQp6!jhQM{gmz@(CiqL5f zT{L0vyvB_o2#?zUbY1@_T>zoRbVU-x4=%zmz%2uX>O+}J!jmRWS^_1?TOI-avUG{9 zAaD5+j^0;VTd&-Zcy!6mEQdTL2r|(4s**H( zeRPvOm8gZXZoyQ38udicOYJKpBlr;VbQS8~och6}Qh{N%fTYWNM{#E&!O1@%?=;O{akZMNh{ zEl2$p^98%4^j<5D%U@F7|5JjU?5VV0`~yGglnYv}lxJi4P)0B+-*96*ri*}!Tfvkb zJXCC{2S!JD{JcX?M8byxi|Vzt=YfZg-(D-@&aijH{exd(KI z0WS)(fu;sX)BpsCWQXm;U;57IS6_`>5SX@vg+ DOzK21 literal 0 HcmV?d00001 diff --git a/integration/oneof-unions-snake/simple.ts b/integration/oneof-unions-snake/simple.ts index 18be427ac..4a12a7239 100644 --- a/integration/oneof-unions-snake/simple.ts +++ b/integration/oneof-unions-snake/simple.ts @@ -1,5 +1,4 @@ /* eslint-disable */ -import * as Long from 'long'; import * as _m0 from 'protobufjs/minimal'; import { Struct } from './google/protobuf/struct'; @@ -82,13 +81,6 @@ export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & Record>, never>; -// If you get a compile-error about 'Constructor and ... have no overlap', -// add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'. -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); -} - function isObject(value: any): boolean { return typeof value === 'object' && value !== null; } diff --git a/integration/oneof-unions/google/protobuf/struct.ts b/integration/oneof-unions/google/protobuf/struct.ts index 5bdacf388..8eaaac6d8 100644 --- a/integration/oneof-unions/google/protobuf/struct.ts +++ b/integration/oneof-unions/google/protobuf/struct.ts @@ -1,5 +1,4 @@ /* eslint-disable */ -import * as Long from 'long'; import * as _m0 from 'protobufjs/minimal'; export const protobufPackage = 'google.protobuf'; @@ -484,13 +483,6 @@ export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & Record>, never>; -// If you get a compile-error about 'Constructor and ... have no overlap', -// add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'. -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); -} - function isObject(value: any): boolean { return typeof value === 'object' && value !== null; } diff --git a/integration/oneof-unions/oneof.ts b/integration/oneof-unions/oneof.ts index 186457422..6a9246323 100644 --- a/integration/oneof-unions/oneof.ts +++ b/integration/oneof-unions/oneof.ts @@ -1,5 +1,4 @@ /* eslint-disable */ -import * as Long from 'long'; import * as _m0 from 'protobufjs/minimal'; import { Value } from './google/protobuf/struct'; @@ -438,13 +437,6 @@ export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & Record>, never>; -// If you get a compile-error about 'Constructor and ... have no overlap', -// add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'. -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); -} - function isSet(value: any): boolean { return value !== null && value !== undefined; } diff --git a/integration/options/options.ts b/integration/options/options.ts index f5283a01f..0b93c8002 100644 --- a/integration/options/options.ts +++ b/integration/options/options.ts @@ -1,9 +1,8 @@ /* eslint-disable */ import { FileDescriptorProto as FileDescriptorProto1 } from 'ts-proto-descriptors'; -import * as Long from 'long'; -import * as _m0 from 'protobufjs/minimal'; import { protoMetadata as protoMetadata1 } from './google/protobuf/descriptor'; import { protoMetadata as protoMetadata2, Something } from './something/something'; +import * as _m0 from 'protobufjs/minimal'; export const protobufPackage = ''; @@ -498,10 +497,3 @@ export const protoMetadata: ProtoMetadata = { }, }, }; - -// If you get a compile-error about 'Constructor and ... have no overlap', -// add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'. -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); -} diff --git a/integration/options/something/something.ts b/integration/options/something/something.ts index a019bf641..b7194abad 100644 --- a/integration/options/something/something.ts +++ b/integration/options/something/something.ts @@ -1,8 +1,7 @@ /* eslint-disable */ import { FileDescriptorProto as FileDescriptorProto1 } from 'ts-proto-descriptors'; -import * as Long from 'long'; -import * as _m0 from 'protobufjs/minimal'; import { protoMetadata as protoMetadata1 } from '../google/protobuf/descriptor'; +import * as _m0 from 'protobufjs/minimal'; export const protobufPackage = 'something'; @@ -160,10 +159,3 @@ export const protoMetadata: ProtoMetadata = { references: { '.something.Something': Something }, dependencies: [protoMetadata1], }; - -// If you get a compile-error about 'Constructor and ... have no overlap', -// add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'. -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); -} diff --git a/integration/point/point.ts b/integration/point/point.ts index 0325e7dad..89a092d3b 100644 --- a/integration/point/point.ts +++ b/integration/point/point.ts @@ -1,5 +1,4 @@ /* eslint-disable */ -import * as Long from 'long'; import * as _m0 from 'protobufjs/minimal'; export const protobufPackage = ''; @@ -147,13 +146,6 @@ export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & Record>, never>; -// If you get a compile-error about 'Constructor and ... have no overlap', -// add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'. -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); -} - function isSet(value: any): boolean { return value !== null && value !== undefined; } diff --git a/integration/return-observable/observable.ts b/integration/return-observable/observable.ts index 036a1e997..403d21c79 100644 --- a/integration/return-observable/observable.ts +++ b/integration/return-observable/observable.ts @@ -1,7 +1,6 @@ /* eslint-disable */ -import * as Long from 'long'; -import * as _m0 from 'protobufjs/minimal'; import { Observable } from 'rxjs'; +import * as _m0 from 'protobufjs/minimal'; export const protobufPackage = ''; @@ -132,13 +131,6 @@ export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & Record>, never>; -// If you get a compile-error about 'Constructor and ... have no overlap', -// add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'. -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); -} - function isSet(value: any): boolean { return value !== null && value !== undefined; } diff --git a/integration/simple-deprecated-fields/simple.ts b/integration/simple-deprecated-fields/simple.ts index 76a93c0eb..34797084f 100644 --- a/integration/simple-deprecated-fields/simple.ts +++ b/integration/simple-deprecated-fields/simple.ts @@ -1,5 +1,4 @@ /* eslint-disable */ -import * as Long from 'long'; import * as _m0 from 'protobufjs/minimal'; export const protobufPackage = 'simple'; @@ -183,13 +182,6 @@ export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & Record>, never>; -// If you get a compile-error about 'Constructor and ... have no overlap', -// add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'. -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); -} - function isSet(value: any): boolean { return value !== null && value !== undefined; } diff --git a/integration/simple-json-name/simple.ts b/integration/simple-json-name/simple.ts index b5c3c482a..e8905e0c7 100644 --- a/integration/simple-json-name/simple.ts +++ b/integration/simple-json-name/simple.ts @@ -1,7 +1,6 @@ /* eslint-disable */ -import * as Long from 'long'; -import * as _m0 from 'protobufjs/minimal'; import { Timestamp } from './google/protobuf/timestamp'; +import * as _m0 from 'protobufjs/minimal'; export const protobufPackage = 'simple'; @@ -180,13 +179,6 @@ function fromJsonTimestamp(o: any): Date { } } -// If you get a compile-error about 'Constructor and ... have no overlap', -// add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'. -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); -} - function isSet(value: any): boolean { return value !== null && value !== undefined; } diff --git a/integration/simple-long-string/simple.ts b/integration/simple-long-string/simple.ts index 45a12bc74..f61906f6a 100644 --- a/integration/simple-long-string/simple.ts +++ b/integration/simple-long-string/simple.ts @@ -1,7 +1,7 @@ /* eslint-disable */ +import { Timestamp } from './google/protobuf/timestamp'; import * as Long from 'long'; import * as _m0 from 'protobufjs/minimal'; -import { Timestamp } from './google/protobuf/timestamp'; import { UInt64Value } from './google/protobuf/wrappers'; export const protobufPackage = 'simple'; diff --git a/integration/simple-optionals/import_dir/thing.ts b/integration/simple-optionals/import_dir/thing.ts index cb723aa4a..5edf91ea0 100644 --- a/integration/simple-optionals/import_dir/thing.ts +++ b/integration/simple-optionals/import_dir/thing.ts @@ -1,7 +1,6 @@ /* eslint-disable */ -import * as Long from 'long'; -import * as _m0 from 'protobufjs/minimal'; import { Timestamp } from '../google/protobuf/timestamp'; +import * as _m0 from 'protobufjs/minimal'; export const protobufPackage = 'simple'; @@ -97,13 +96,6 @@ function fromJsonTimestamp(o: any): Date { } } -// If you get a compile-error about 'Constructor and ... have no overlap', -// add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'. -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); -} - function isSet(value: any): boolean { return value !== null && value !== undefined; } diff --git a/integration/simple-optionals/simple.ts b/integration/simple-optionals/simple.ts index cd82b257d..e43352b66 100644 --- a/integration/simple-optionals/simple.ts +++ b/integration/simple-optionals/simple.ts @@ -1,8 +1,8 @@ /* eslint-disable */ -import * as Long from 'long'; -import * as _m0 from 'protobufjs/minimal'; import { ImportedThing } from './import_dir/thing'; import { Timestamp } from './google/protobuf/timestamp'; +import * as Long from 'long'; +import * as _m0 from 'protobufjs/minimal'; import { StringValue, Int32Value, BoolValue } from './google/protobuf/wrappers'; export const protobufPackage = 'simple'; diff --git a/integration/simple-optionals/thing.ts b/integration/simple-optionals/thing.ts index ead5c2412..f9501c68e 100644 --- a/integration/simple-optionals/thing.ts +++ b/integration/simple-optionals/thing.ts @@ -1,7 +1,6 @@ /* eslint-disable */ -import * as Long from 'long'; -import * as _m0 from 'protobufjs/minimal'; import { Timestamp } from './google/protobuf/timestamp'; +import * as _m0 from 'protobufjs/minimal'; export const protobufPackage = 'simple'; @@ -97,13 +96,6 @@ function fromJsonTimestamp(o: any): Date { } } -// If you get a compile-error about 'Constructor and ... have no overlap', -// add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'. -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); -} - function isSet(value: any): boolean { return value !== null && value !== undefined; } diff --git a/integration/simple-proto2/simple.ts b/integration/simple-proto2/simple.ts index d8b9a60e0..05ebf8fb5 100644 --- a/integration/simple-proto2/simple.ts +++ b/integration/simple-proto2/simple.ts @@ -1,5 +1,4 @@ /* eslint-disable */ -import * as Long from 'long'; import * as _m0 from 'protobufjs/minimal'; export const protobufPackage = 'simple'; @@ -107,13 +106,6 @@ export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & Record>, never>; -// If you get a compile-error about 'Constructor and ... have no overlap', -// add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'. -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); -} - function isSet(value: any): boolean { return value !== null && value !== undefined; } diff --git a/integration/simple-prototype-defaults/google/type/date.ts b/integration/simple-prototype-defaults/google/type/date.ts index a61f07442..342ce17d9 100644 --- a/integration/simple-prototype-defaults/google/type/date.ts +++ b/integration/simple-prototype-defaults/google/type/date.ts @@ -1,5 +1,4 @@ /* eslint-disable */ -import * as Long from 'long'; import * as _m0 from 'protobufjs/minimal'; export const protobufPackage = 'google.type'; @@ -119,13 +118,6 @@ export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & Record>, never>; -// If you get a compile-error about 'Constructor and ... have no overlap', -// add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'. -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); -} - function isSet(value: any): boolean { return value !== null && value !== undefined; } diff --git a/integration/simple-prototype-defaults/import_dir/thing.ts b/integration/simple-prototype-defaults/import_dir/thing.ts index 81f623f5b..f461dea13 100644 --- a/integration/simple-prototype-defaults/import_dir/thing.ts +++ b/integration/simple-prototype-defaults/import_dir/thing.ts @@ -1,7 +1,6 @@ /* eslint-disable */ -import * as Long from 'long'; -import * as _m0 from 'protobufjs/minimal'; import { Timestamp } from '../google/protobuf/timestamp'; +import * as _m0 from 'protobufjs/minimal'; export const protobufPackage = 'simple'; @@ -97,13 +96,6 @@ function fromJsonTimestamp(o: any): Date { } } -// If you get a compile-error about 'Constructor and ... have no overlap', -// add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'. -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); -} - function isSet(value: any): boolean { return value !== null && value !== undefined; } diff --git a/integration/simple-prototype-defaults/simple.ts b/integration/simple-prototype-defaults/simple.ts index fb481b494..70aa3af35 100644 --- a/integration/simple-prototype-defaults/simple.ts +++ b/integration/simple-prototype-defaults/simple.ts @@ -1,9 +1,9 @@ /* eslint-disable */ -import * as Long from 'long'; -import * as _m0 from 'protobufjs/minimal'; import { Timestamp } from './google/protobuf/timestamp'; +import * as Long from 'long'; import { ImportedThing } from './import_dir/thing'; import { DateMessage } from './google/type/date'; +import * as _m0 from 'protobufjs/minimal'; import { StringValue, Int32Value, BoolValue, BytesValue } from './google/protobuf/wrappers'; export const protobufPackage = 'simple'; diff --git a/integration/simple-snake/google/protobuf/struct.ts b/integration/simple-snake/google/protobuf/struct.ts index e6e54254c..624caf8c5 100644 --- a/integration/simple-snake/google/protobuf/struct.ts +++ b/integration/simple-snake/google/protobuf/struct.ts @@ -1,5 +1,4 @@ /* eslint-disable */ -import * as Long from 'long'; import * as _m0 from 'protobufjs/minimal'; export const protobufPackage = 'google.protobuf'; @@ -462,13 +461,6 @@ export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & Record>, never>; -// If you get a compile-error about 'Constructor and ... have no overlap', -// add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'. -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); -} - function isObject(value: any): boolean { return typeof value === 'object' && value !== null; } diff --git a/integration/simple-snake/import_dir/thing.ts b/integration/simple-snake/import_dir/thing.ts index 142b0299b..f1cdc9240 100644 --- a/integration/simple-snake/import_dir/thing.ts +++ b/integration/simple-snake/import_dir/thing.ts @@ -1,7 +1,6 @@ /* eslint-disable */ -import * as Long from 'long'; -import * as _m0 from 'protobufjs/minimal'; import { Timestamp } from '../google/protobuf/timestamp'; +import * as _m0 from 'protobufjs/minimal'; export const protobufPackage = 'simple'; @@ -97,13 +96,6 @@ function fromJsonTimestamp(o: any): Date { } } -// If you get a compile-error about 'Constructor and ... have no overlap', -// add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'. -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); -} - function isSet(value: any): boolean { return value !== null && value !== undefined; } diff --git a/integration/simple-snake/simple.bin b/integration/simple-snake/simple.bin index 8b9d6a26408bb70259fb5e43615d00ed453673e9..a8fca9efde0f3f52f3bc1124b37b41b78c33ccf5 100644 GIT binary patch delta 24 gcmdn6nsLKw#tEYAj7khu>lL{sJJ`r?v@Q(=0A;!dzyJUM delta 24 gcmdn6nsLKw#tEYAEJ_Sj>lL{sJJ`r?v@Q(=0A=R~!vFvP diff --git a/integration/simple-snake/simple.ts b/integration/simple-snake/simple.ts index 52811afca..47f25629b 100644 --- a/integration/simple-snake/simple.ts +++ b/integration/simple-snake/simple.ts @@ -1,8 +1,8 @@ /* eslint-disable */ -import * as Long from 'long'; -import * as _m0 from 'protobufjs/minimal'; import { Timestamp } from './google/protobuf/timestamp'; +import * as Long from 'long'; import { ImportedThing } from './import_dir/thing'; +import * as _m0 from 'protobufjs/minimal'; import { StringValue, Int32Value, BoolValue } from './google/protobuf/wrappers'; import { Struct } from './google/protobuf/struct'; diff --git a/integration/simple-string-enums/google/protobuf/struct.ts b/integration/simple-string-enums/google/protobuf/struct.ts index 98852c543..968282a70 100644 --- a/integration/simple-string-enums/google/protobuf/struct.ts +++ b/integration/simple-string-enums/google/protobuf/struct.ts @@ -1,5 +1,4 @@ /* eslint-disable */ -import * as Long from 'long'; import * as _m0 from 'protobufjs/minimal'; export const protobufPackage = 'google.protobuf'; @@ -472,13 +471,6 @@ export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & Record>, never>; -// If you get a compile-error about 'Constructor and ... have no overlap', -// add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'. -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); -} - function isObject(value: any): boolean { return typeof value === 'object' && value !== null; } diff --git a/integration/simple-string-enums/simple.ts b/integration/simple-string-enums/simple.ts index ed6427868..03060b015 100644 --- a/integration/simple-string-enums/simple.ts +++ b/integration/simple-string-enums/simple.ts @@ -1,7 +1,6 @@ /* eslint-disable */ -import * as Long from 'long'; -import * as _m0 from 'protobufjs/minimal'; import { NullValue, nullValueToNumber, nullValueFromJSON, nullValueToJSON } from './google/protobuf/struct'; +import * as _m0 from 'protobufjs/minimal'; export const protobufPackage = 'simple'; @@ -265,13 +264,6 @@ export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & Record>, never>; -// If you get a compile-error about 'Constructor and ... have no overlap', -// add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'. -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); -} - function isObject(value: any): boolean { return typeof value === 'object' && value !== null; } diff --git a/integration/simple-unrecognized-enum/import_dir/thing.ts b/integration/simple-unrecognized-enum/import_dir/thing.ts index c979d4ea3..45cf91b0b 100644 --- a/integration/simple-unrecognized-enum/import_dir/thing.ts +++ b/integration/simple-unrecognized-enum/import_dir/thing.ts @@ -1,7 +1,6 @@ /* eslint-disable */ -import * as Long from 'long'; -import * as _m0 from 'protobufjs/minimal'; import { Timestamp } from '../google/protobuf/timestamp'; +import * as _m0 from 'protobufjs/minimal'; export const protobufPackage = 'simple'; @@ -97,13 +96,6 @@ function fromJsonTimestamp(o: any): Date { } } -// If you get a compile-error about 'Constructor and ... have no overlap', -// add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'. -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); -} - function isSet(value: any): boolean { return value !== null && value !== undefined; } diff --git a/integration/simple-unrecognized-enum/simple.ts b/integration/simple-unrecognized-enum/simple.ts index 3dc4afc12..77aa951b5 100644 --- a/integration/simple-unrecognized-enum/simple.ts +++ b/integration/simple-unrecognized-enum/simple.ts @@ -1,8 +1,8 @@ /* eslint-disable */ -import * as Long from 'long'; -import * as _m0 from 'protobufjs/minimal'; import { Timestamp } from './google/protobuf/timestamp'; +import * as Long from 'long'; import { ImportedThing } from './import_dir/thing'; +import * as _m0 from 'protobufjs/minimal'; import { StringValue, Int32Value, BoolValue } from './google/protobuf/wrappers'; export const protobufPackage = 'simple'; diff --git a/integration/simple/google/type/date.ts b/integration/simple/google/type/date.ts index 0efafd84c..8c9c9fa83 100644 --- a/integration/simple/google/type/date.ts +++ b/integration/simple/google/type/date.ts @@ -1,5 +1,4 @@ /* eslint-disable */ -import * as Long from 'long'; import * as _m0 from 'protobufjs/minimal'; export const protobufPackage = 'google.type'; @@ -119,13 +118,6 @@ export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & Record>, never>; -// If you get a compile-error about 'Constructor and ... have no overlap', -// add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'. -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); -} - function isSet(value: any): boolean { return value !== null && value !== undefined; } diff --git a/integration/simple/import_dir/thing.ts b/integration/simple/import_dir/thing.ts index c979d4ea3..45cf91b0b 100644 --- a/integration/simple/import_dir/thing.ts +++ b/integration/simple/import_dir/thing.ts @@ -1,7 +1,6 @@ /* eslint-disable */ -import * as Long from 'long'; -import * as _m0 from 'protobufjs/minimal'; import { Timestamp } from '../google/protobuf/timestamp'; +import * as _m0 from 'protobufjs/minimal'; export const protobufPackage = 'simple'; @@ -97,13 +96,6 @@ function fromJsonTimestamp(o: any): Date { } } -// If you get a compile-error about 'Constructor and ... have no overlap', -// add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'. -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); -} - function isSet(value: any): boolean { return value !== null && value !== undefined; } diff --git a/integration/simple/simple.ts b/integration/simple/simple.ts index 2c25204a2..b6e5590a7 100644 --- a/integration/simple/simple.ts +++ b/integration/simple/simple.ts @@ -1,9 +1,9 @@ /* eslint-disable */ -import * as Long from 'long'; -import * as _m0 from 'protobufjs/minimal'; import { Timestamp } from './google/protobuf/timestamp'; +import * as Long from 'long'; import { ImportedThing } from './import_dir/thing'; import { DateMessage } from './google/type/date'; +import * as _m0 from 'protobufjs/minimal'; import { StringValue, Int32Value, BoolValue, BytesValue } from './google/protobuf/wrappers'; export const protobufPackage = 'simple'; diff --git a/integration/struct/google/protobuf/struct.ts b/integration/struct/google/protobuf/struct.ts index df4825442..f58c0f87d 100644 --- a/integration/struct/google/protobuf/struct.ts +++ b/integration/struct/google/protobuf/struct.ts @@ -1,5 +1,4 @@ /* eslint-disable */ -import * as Long from 'long'; import * as _m0 from 'protobufjs/minimal'; export const protobufPackage = 'google.protobuf'; @@ -462,13 +461,6 @@ export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & Record>, never>; -// If you get a compile-error about 'Constructor and ... have no overlap', -// add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'. -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); -} - function isObject(value: any): boolean { return typeof value === 'object' && value !== null; } diff --git a/integration/struct/struct.ts b/integration/struct/struct.ts index 8a2e0e8a1..ed8714231 100644 --- a/integration/struct/struct.ts +++ b/integration/struct/struct.ts @@ -1,5 +1,4 @@ /* eslint-disable */ -import * as Long from 'long'; import * as _m0 from 'protobufjs/minimal'; import { Struct } from './google/protobuf/struct'; @@ -75,13 +74,6 @@ export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & Record>, never>; -// If you get a compile-error about 'Constructor and ... have no overlap', -// add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'. -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); -} - function isObject(value: any): boolean { return typeof value === 'object' && value !== null; } diff --git a/integration/type-registry/bar/bar.ts b/integration/type-registry/bar/bar.ts index d59c685c7..f75afe22d 100644 --- a/integration/type-registry/bar/bar.ts +++ b/integration/type-registry/bar/bar.ts @@ -1,8 +1,7 @@ /* eslint-disable */ import { messageTypeRegistry } from '../typeRegistry'; -import * as Long from 'long'; -import * as _m0 from 'protobufjs/minimal'; import { Foo } from '../foo'; +import * as _m0 from 'protobufjs/minimal'; export const protobufPackage = 'foo.bar'; @@ -82,13 +81,6 @@ export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & Record | '$type'>, never>; -// If you get a compile-error about 'Constructor and ... have no overlap', -// add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'. -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); -} - function isSet(value: any): boolean { return value !== null && value !== undefined; } diff --git a/integration/type-registry/foo.ts b/integration/type-registry/foo.ts index 2d4177c22..4ed381f5a 100644 --- a/integration/type-registry/foo.ts +++ b/integration/type-registry/foo.ts @@ -1,8 +1,7 @@ /* eslint-disable */ import { messageTypeRegistry } from './typeRegistry'; -import * as Long from 'long'; -import * as _m0 from 'protobufjs/minimal'; import { Timestamp } from './google/protobuf/timestamp'; +import * as _m0 from 'protobufjs/minimal'; import { Struct } from './google/protobuf/struct'; export const protobufPackage = 'foo'; @@ -223,13 +222,6 @@ function fromJsonTimestamp(o: any): Date { } } -// If you get a compile-error about 'Constructor and ... have no overlap', -// add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'. -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); -} - function isObject(value: any): boolean { return typeof value === 'object' && value !== null; } diff --git a/integration/type-registry/google/protobuf/struct.ts b/integration/type-registry/google/protobuf/struct.ts index 1ae57045b..3f662790c 100644 --- a/integration/type-registry/google/protobuf/struct.ts +++ b/integration/type-registry/google/protobuf/struct.ts @@ -1,6 +1,5 @@ /* eslint-disable */ import { messageTypeRegistry } from '../../typeRegistry'; -import * as Long from 'long'; import * as _m0 from 'protobufjs/minimal'; export const protobufPackage = 'google.protobuf'; @@ -491,13 +490,6 @@ export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & Record | '$type'>, never>; -// If you get a compile-error about 'Constructor and ... have no overlap', -// add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'. -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); -} - function isObject(value: any): boolean { return typeof value === 'object' && value !== null; } diff --git a/integration/types-with-underscores/file.ts b/integration/types-with-underscores/file.ts index 14518ba69..e977012d3 100644 --- a/integration/types-with-underscores/file.ts +++ b/integration/types-with-underscores/file.ts @@ -1,5 +1,4 @@ /* eslint-disable */ -import * as Long from 'long'; import * as _m0 from 'protobufjs/minimal'; export const protobufPackage = ''; @@ -115,13 +114,6 @@ export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & Record>, never>; -// If you get a compile-error about 'Constructor and ... have no overlap', -// add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'. -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); -} - function isSet(value: any): boolean { return value !== null && value !== undefined; } diff --git a/integration/unknown-fields/google/protobuf/compiler/plugin.ts b/integration/unknown-fields/google/protobuf/compiler/plugin.ts index 49c66b540..f3353c89e 100644 --- a/integration/unknown-fields/google/protobuf/compiler/plugin.ts +++ b/integration/unknown-fields/google/protobuf/compiler/plugin.ts @@ -1,7 +1,7 @@ /* eslint-disable */ import * as Long from 'long'; -import * as _m0 from 'protobufjs/minimal'; import { FileDescriptorProto, GeneratedCodeInfo } from '../../../google/protobuf/descriptor'; +import * as _m0 from 'protobufjs/minimal'; export const protobufPackage = 'google.protobuf.compiler'; diff --git a/integration/unknown-fields/options.ts b/integration/unknown-fields/options.ts index 0e4ecf271..e8ed01194 100644 --- a/integration/unknown-fields/options.ts +++ b/integration/unknown-fields/options.ts @@ -1,5 +1,4 @@ /* eslint-disable */ -import * as Long from 'long'; import * as _m0 from 'protobufjs/minimal'; export const protobufPackage = ''; @@ -197,10 +196,3 @@ export class MyServiceClientImpl implements MyService { interface Rpc { request(service: string, method: string, data: Uint8Array): Promise; } - -// If you get a compile-error about 'Constructor and ... have no overlap', -// add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'. -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); -} diff --git a/integration/unknown-fields/something/something.ts b/integration/unknown-fields/something/something.ts index 65e56bda3..4fbd49f16 100644 --- a/integration/unknown-fields/something/something.ts +++ b/integration/unknown-fields/something/something.ts @@ -1,5 +1,4 @@ /* eslint-disable */ -import * as Long from 'long'; import * as _m0 from 'protobufjs/minimal'; export const protobufPackage = 'something'; @@ -73,10 +72,3 @@ export const Something = { return message; }, }; - -// If you get a compile-error about 'Constructor and ... have no overlap', -// add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'. -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); -} diff --git a/integration/use-date-false/metadata.ts b/integration/use-date-false/metadata.ts index 947711563..f6bb00666 100644 --- a/integration/use-date-false/metadata.ts +++ b/integration/use-date-false/metadata.ts @@ -1,7 +1,6 @@ /* eslint-disable */ -import * as Long from 'long'; -import * as _m0 from 'protobufjs/minimal'; import { Timestamp } from './google/protobuf/timestamp'; +import * as _m0 from 'protobufjs/minimal'; export const protobufPackage = ''; @@ -100,13 +99,6 @@ function fromJsonTimestamp(o: any): Timestamp { } } -// If you get a compile-error about 'Constructor and ... have no overlap', -// add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'. -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); -} - function isSet(value: any): boolean { return value !== null && value !== undefined; } diff --git a/integration/use-date-string/use-date-string.ts b/integration/use-date-string/use-date-string.ts index d5f7a623a..0ab5fb64d 100644 --- a/integration/use-date-string/use-date-string.ts +++ b/integration/use-date-string/use-date-string.ts @@ -1,7 +1,6 @@ /* eslint-disable */ -import * as Long from 'long'; -import * as _m0 from 'protobufjs/minimal'; import { Timestamp } from './google/protobuf/timestamp'; +import * as _m0 from 'protobufjs/minimal'; export const protobufPackage = ''; @@ -218,13 +217,6 @@ function fromTimestamp(t: Timestamp): string { return new Date(millis).toISOString(); } -// If you get a compile-error about 'Constructor and ... have no overlap', -// add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'. -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); -} - function isObject(value: any): boolean { return typeof value === 'object' && value !== null; } diff --git a/integration/use-date-true/google/protobuf/empty.ts b/integration/use-date-true/google/protobuf/empty.ts index fd9332ed8..5849fae1d 100644 --- a/integration/use-date-true/google/protobuf/empty.ts +++ b/integration/use-date-true/google/protobuf/empty.ts @@ -1,5 +1,4 @@ /* eslint-disable */ -import * as Long from 'long'; import * as _m0 from 'protobufjs/minimal'; export const protobufPackage = 'google.protobuf'; @@ -72,10 +71,3 @@ type KeysOfUnion = T extends T ? keyof T : never; export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & Record>, never>; - -// If you get a compile-error about 'Constructor and ... have no overlap', -// add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'. -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); -} diff --git a/integration/use-date-true/use-date-true.ts b/integration/use-date-true/use-date-true.ts index 4ddfb09d2..38e0aeadd 100644 --- a/integration/use-date-true/use-date-true.ts +++ b/integration/use-date-true/use-date-true.ts @@ -1,8 +1,7 @@ /* eslint-disable */ -import * as Long from 'long'; -import * as _m0 from 'protobufjs/minimal'; import { Timestamp } from './google/protobuf/timestamp'; import { Empty } from './google/protobuf/empty'; +import * as _m0 from 'protobufjs/minimal'; export const protobufPackage = ''; @@ -265,13 +264,6 @@ function fromJsonTimestamp(o: any): Date { } } -// If you get a compile-error about 'Constructor and ... have no overlap', -// add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'. -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); -} - function isObject(value: any): boolean { return typeof value === 'object' && value !== null; } diff --git a/integration/use-exact-types-false/foo.ts b/integration/use-exact-types-false/foo.ts index 653741fae..b5c5b40b1 100644 --- a/integration/use-exact-types-false/foo.ts +++ b/integration/use-exact-types-false/foo.ts @@ -1,5 +1,4 @@ /* eslint-disable */ -import * as Long from 'long'; import * as _m0 from 'protobufjs/minimal'; export const protobufPackage = 'foo'; @@ -79,13 +78,6 @@ export type DeepPartial = T extends Builtin ? { [K in keyof T]?: DeepPartial } : Partial; -// If you get a compile-error about 'Constructor and ... have no overlap', -// add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'. -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); -} - function isSet(value: any): boolean { return value !== null && value !== undefined; } diff --git a/integration/use-json-wire-format/use-json-wire-format.bin b/integration/use-json-wire-format/use-json-wire-format.bin index 89e572e44d83f4626c430453316aee69c72030f4..723fabc328f2116b00c90c220cc43fdc016b215b 100644 GIT binary patch delta 14 WcmcaSlkxIQ#tF)dj2l(f`v3qe*9Bkz delta 14 WcmcaSlkxIQ#tF)dEE`qU`v3qe<^^K_ diff --git a/integration/use-objectid-true-external-import/objectid/objectid.ts b/integration/use-objectid-true-external-import/objectid/objectid.ts index 091cd2344..2fbd40c2e 100644 --- a/integration/use-objectid-true-external-import/objectid/objectid.ts +++ b/integration/use-objectid-true-external-import/objectid/objectid.ts @@ -1,5 +1,4 @@ /* eslint-disable */ -import * as Long from 'long'; import * as _m0 from 'protobufjs/minimal'; export const protobufPackage = 'foo.objectid'; @@ -74,13 +73,6 @@ export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & Record>, never>; -// If you get a compile-error about 'Constructor and ... have no overlap', -// add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'. -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); -} - function isSet(value: any): boolean { return value !== null && value !== undefined; } diff --git a/integration/use-objectid-true-external-import/use-objectid-true.ts b/integration/use-objectid-true-external-import/use-objectid-true.ts index fe83a9472..660718c35 100644 --- a/integration/use-objectid-true-external-import/use-objectid-true.ts +++ b/integration/use-objectid-true-external-import/use-objectid-true.ts @@ -1,7 +1,6 @@ /* eslint-disable */ -import * as Long from 'long'; -import * as _m0 from 'protobufjs/minimal'; import * as mongodb from 'mongodb'; +import * as _m0 from 'protobufjs/minimal'; import { ObjectId } from './objectid/objectid'; export const protobufPackage = 'foo'; @@ -227,13 +226,6 @@ function toProtoObjectId(oid: mongodb.ObjectId): ObjectId { return { value }; } -// If you get a compile-error about 'Constructor and ... have no overlap', -// add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'. -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); -} - function isObject(value: any): boolean { return typeof value === 'object' && value !== null; } diff --git a/integration/value/google/protobuf/struct.ts b/integration/value/google/protobuf/struct.ts index df4825442..f58c0f87d 100644 --- a/integration/value/google/protobuf/struct.ts +++ b/integration/value/google/protobuf/struct.ts @@ -1,5 +1,4 @@ /* eslint-disable */ -import * as Long from 'long'; import * as _m0 from 'protobufjs/minimal'; export const protobufPackage = 'google.protobuf'; @@ -462,13 +461,6 @@ export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & Record>, never>; -// If you get a compile-error about 'Constructor and ... have no overlap', -// add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'. -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); -} - function isObject(value: any): boolean { return typeof value === 'object' && value !== null; } diff --git a/integration/value/value.ts b/integration/value/value.ts index 639ea2e2a..d1ca441a3 100644 --- a/integration/value/value.ts +++ b/integration/value/value.ts @@ -1,5 +1,4 @@ /* eslint-disable */ -import * as Long from 'long'; import * as _m0 from 'protobufjs/minimal'; import { Value, ListValue, Struct } from './google/protobuf/struct'; import { StringValue } from './google/protobuf/wrappers'; @@ -124,13 +123,6 @@ export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & Record>, never>; -// If you get a compile-error about 'Constructor and ... have no overlap', -// add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'. -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); -} - function isObject(value: any): boolean { return typeof value === 'object' && value !== null; } diff --git a/src/main.ts b/src/main.ts index a04303fa2..111206010 100644 --- a/src/main.ts +++ b/src/main.ts @@ -285,8 +285,6 @@ export function generateFile(ctx: Context, fileDesc: FileDescriptorProto): [stri ...Object.values(utils).map((v) => { if (v instanceof ConditionalOutput) { return code`${v.ifUsed}`; - } else if (v instanceof Code) { - return v; } else { return code``; } @@ -345,7 +343,7 @@ function makeLongUtils(options: Options, bytes: ReturnType // // I.e there is not an import for long that "just works" in both esModuleInterop and // not esModuleInterop. - const Long = options.esModuleInterop ? imp('Long=long') : imp('Long*long'); + const LongImp = options.esModuleInterop ? imp('Long=long') : imp('Long*long'); const disclaimer = options.esModuleInterop ? '' @@ -353,17 +351,19 @@ function makeLongUtils(options: Options, bytes: ReturnType // If you get a compile-error about 'Constructor and ... have no overlap', // add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'.`; - // Kinda hacky, but we always init long unless in onlyTypes mode. I'd rather do - // this more implicitly, like if `Long@long` is imported or something like that. - const longInit = options.onlyTypes - ? code`` - : code` + // Instead of exposing `LongImp` directly, let callers think that they are getting the + // `imp(Long)` but really it is that + our long initialization snippet. This means the + // initialization code will only be emitted in files that actually use the Long import. + const Long = conditionalOutput( + 'Long', + code` ${disclaimer} - if (${util}.Long !== ${Long}) { - ${util}.Long = ${Long} as any; + if (${util}.Long !== ${LongImp}) { + ${util}.Long = ${LongImp} as any; ${configure}(); } - `; + ` + ); // TODO This is unused? const numberToLong = conditionalOutput( @@ -396,7 +396,7 @@ function makeLongUtils(options: Options, bytes: ReturnType ` ); - return { numberToLong, longToNumber, longToString, longInit, Long }; + return { numberToLong, longToNumber, longToString, Long }; } function makeByteUtils() {