Skip to content

Commit

Permalink
fix: remove Long import statement when Long was unused (#599)
Browse files Browse the repository at this point in the history
* use conditional output to detect that Long is used

* yarn build:test

* add comment
  • Loading branch information
3846masa committed Jun 22, 2022
1 parent 5644ec5 commit 58dc10c
Show file tree
Hide file tree
Showing 97 changed files with 57 additions and 753 deletions.
8 changes: 0 additions & 8 deletions integration/angular/simple-message.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* eslint-disable */
import * as Long from 'long';
import * as _m0 from 'protobufjs/minimal';

export const protobufPackage = 'angular';
Expand Down Expand Up @@ -74,13 +73,6 @@ export type Exact<P, I extends P> = P extends Builtin
? P
: P & { [K in keyof P]: Exact<P[K], I[K]> } & Record<Exclude<keyof I, KeysOfUnion<P>>, never>;

// If you get a compile-error about 'Constructor<Long> 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;
}
10 changes: 1 addition & 9 deletions integration/avoid-import-conflicts/simple.ts
Original file line number Diff line number Diff line change
@@ -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';

Expand Down Expand Up @@ -196,13 +195,6 @@ export type Exact<P, I extends P> = P extends Builtin
? P
: P & { [K in keyof P]: Exact<P[K], I[K]> } & Record<Exclude<keyof I, KeysOfUnion<P>>, never>;

// If you get a compile-error about 'Constructor<Long> 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;
}
8 changes: 0 additions & 8 deletions integration/avoid-import-conflicts/simple2.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* eslint-disable */
import * as Long from 'long';
import * as _m0 from 'protobufjs/minimal';

export const protobufPackage = 'simple2';
Expand Down Expand Up @@ -123,13 +122,6 @@ export type Exact<P, I extends P> = P extends Builtin
? P
: P & { [K in keyof P]: Exact<P[K], I[K]> } & Record<Exclude<keyof I, KeysOfUnion<P>>, never>;

// If you get a compile-error about 'Constructor<Long> 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;
}
8 changes: 0 additions & 8 deletions integration/barrel-imports/bar.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* eslint-disable */
import * as Long from 'long';
import * as _m0 from 'protobufjs/minimal';

export interface Bar {
Expand Down Expand Up @@ -82,13 +81,6 @@ type Exact<P, I extends P> = P extends Builtin
? P
: P & { [K in keyof P]: Exact<P[K], I[K]> } & Record<Exclude<keyof I, KeysOfUnion<P>>, never>;

// If you get a compile-error about 'Constructor<Long> 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;
}
10 changes: 1 addition & 9 deletions integration/barrel-imports/foo.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -83,13 +82,6 @@ type Exact<P, I extends P> = P extends Builtin
? P
: P & { [K in keyof P]: Exact<P[K], I[K]> } & Record<Exclude<keyof I, KeysOfUnion<P>>, never>;

// If you get a compile-error about 'Constructor<Long> 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;
}
10 changes: 1 addition & 9 deletions integration/batching-with-context/batching.ts
Original file line number Diff line number Diff line change
@@ -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';

Expand Down Expand Up @@ -691,13 +690,6 @@ export type Exact<P, I extends P> = P extends Builtin
? P
: P & { [K in keyof P]: Exact<P[K], I[K]> } & Record<Exclude<keyof I, KeysOfUnion<P>>, never>;

// If you get a compile-error about 'Constructor<Long> 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;
}
Expand Down
8 changes: 0 additions & 8 deletions integration/batching/batching.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* eslint-disable */
import * as Long from 'long';
import * as _m0 from 'protobufjs/minimal';

export const protobufPackage = 'batching';
Expand Down Expand Up @@ -639,13 +638,6 @@ export type Exact<P, I extends P> = P extends Builtin
? P
: P & { [K in keyof P]: Exact<P[K], I[K]> } & Record<Exclude<keyof I, KeysOfUnion<P>>, never>;

// If you get a compile-error about 'Constructor<Long> 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;
}
Expand Down
10 changes: 0 additions & 10 deletions integration/bytes-as-base64/message.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
/* eslint-disable */
import * as Long from 'long';
import * as _m0 from 'protobufjs/minimal';

export const protobufPackage = '';

export interface Message {
Expand Down Expand Up @@ -82,13 +79,6 @@ export type Exact<P, I extends P> = P extends Builtin
? P
: P & { [K in keyof P]: Exact<P[K], I[K]> } & Record<Exclude<keyof I, KeysOfUnion<P>>, never>;

// If you get a compile-error about 'Constructor<Long> 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;
}
8 changes: 0 additions & 8 deletions integration/bytes-node/point.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* eslint-disable */
import * as Long from 'long';
import * as _m0 from 'protobufjs/minimal';
import { BytesValue } from './google/protobuf/wrappers';

Expand Down Expand Up @@ -118,13 +117,6 @@ export type Exact<P, I extends P> = P extends Builtin
? P
: P & { [K in keyof P]: Exact<P[K], I[K]> } & Record<Exclude<keyof I, KeysOfUnion<P>>, never>;

// If you get a compile-error about 'Constructor<Long> 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;
}
8 changes: 0 additions & 8 deletions integration/const-enum/const-enum.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* eslint-disable */
import * as Long from 'long';
import * as _m0 from 'protobufjs/minimal';

export const protobufPackage = '';
Expand Down Expand Up @@ -229,13 +228,6 @@ export type Exact<P, I extends P> = P extends Builtin
? P
: P & { [K in keyof P]: Exact<P[K], I[K]> } & Record<Exclude<keyof I, KeysOfUnion<P>>, never>;

// If you get a compile-error about 'Constructor<Long> 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;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* eslint-disable */
import * as Long from 'long';
import * as _m0 from 'protobufjs/minimal';

export const protobufPackage = '';
Expand Down Expand Up @@ -137,13 +136,6 @@ export type Exact<P, I extends P> = P extends Builtin
? P
: P & { [K in keyof P]: Exact<P[K], I[K]> } & Record<Exclude<keyof I, KeysOfUnion<P>>, never>;

// If you get a compile-error about 'Constructor<Long> 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;
}
8 changes: 0 additions & 8 deletions integration/enums-as-literals/enums-as-literals.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* eslint-disable */
import * as Long from 'long';
import * as _m0 from 'protobufjs/minimal';

export const protobufPackage = '';
Expand Down Expand Up @@ -121,13 +120,6 @@ export type Exact<P, I extends P> = P extends Builtin
? P
: P & { [K in keyof P]: Exact<P[K], I[K]> } & Record<Exclude<keyof I, KeysOfUnion<P>>, never>;

// If you get a compile-error about 'Constructor<Long> 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;
}
8 changes: 0 additions & 8 deletions integration/fieldmask/fieldmask.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* eslint-disable */
import * as Long from 'long';
import * as _m0 from 'protobufjs/minimal';
import { FieldMask } from './google/protobuf/field_mask';

Expand Down Expand Up @@ -75,13 +74,6 @@ export type Exact<P, I extends P> = P extends Builtin
? P
: P & { [K in keyof P]: Exact<P[K], I[K]> } & Record<Exclude<keyof I, KeysOfUnion<P>>, never>;

// If you get a compile-error about 'Constructor<Long> 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;
}
8 changes: 0 additions & 8 deletions integration/fieldmask/google/protobuf/field_mask.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* eslint-disable */
import * as Long from 'long';
import * as _m0 from 'protobufjs/minimal';

export const protobufPackage = 'google.protobuf';
Expand Down Expand Up @@ -286,10 +285,3 @@ type KeysOfUnion<T> = T extends T ? keyof T : never;
export type Exact<P, I extends P> = P extends Builtin
? P
: P & { [K in keyof P]: Exact<P[K], I[K]> } & Record<Exclude<keyof I, KeysOfUnion<P>>, never>;

// If you get a compile-error about 'Constructor<Long> 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();
}
8 changes: 0 additions & 8 deletions integration/file-suffix/child.pb.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* eslint-disable */
import * as Long from 'long';
import * as _m0 from 'protobufjs/minimal';

export const protobufPackage = 'file_suffix';
Expand Down Expand Up @@ -107,13 +106,6 @@ export type Exact<P, I extends P> = P extends Builtin
? P
: P & { [K in keyof P]: Exact<P[K], I[K]> } & Record<Exclude<keyof I, KeysOfUnion<P>>, never>;

// If you get a compile-error about 'Constructor<Long> 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;
}
10 changes: 1 addition & 9 deletions integration/file-suffix/parent.pb.ts
Original file line number Diff line number Diff line change
@@ -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';

Expand Down Expand Up @@ -118,13 +117,6 @@ function fromJsonTimestamp(o: any): Date {
}
}

// If you get a compile-error about 'Constructor<Long> 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;
}
10 changes: 1 addition & 9 deletions integration/generic-metadata/hero.ts
Original file line number Diff line number Diff line change
@@ -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';

Expand Down Expand Up @@ -328,13 +327,6 @@ export type Exact<P, I extends P> = P extends Builtin
? P
: P & { [K in keyof P]: Exact<P[K], I[K]> } & Record<Exclude<keyof I, KeysOfUnion<P>>, never>;

// If you get a compile-error about 'Constructor<Long> 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;
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* eslint-disable */
import * as Long from 'long';
import * as _m0 from 'protobufjs/minimal';

export const protobufPackage = 'simple';
Expand Down Expand Up @@ -144,13 +143,6 @@ export type Exact<P, I extends P> = P extends Builtin
? P
: P & { [K in keyof P]: Exact<P[K], I[K]> } & Record<Exclude<keyof I, KeysOfUnion<P>>, never>;

// If you get a compile-error about 'Constructor<Long> 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;
}
Loading

0 comments on commit 58dc10c

Please sign in to comment.