Skip to content

Commit

Permalink
feat: import proto as type import if onlyTypes is set
Browse files Browse the repository at this point in the history
commit de7953832cdfab186b7dd269e9702d562021516b
Author: Stephen Haberman <stephen.haberman@gmail.com>
Date:   Sat Mar 12 20:29:49 2022 -0600

    Run prettier.

commit c13e65ca04d896f64603f61fb004eaf967759321
Author: RSWilli <bartel.wilhelm@gmail.com>
Date:   Fri Mar 11 22:20:26 2022 +0100

    bump ts-poet to 4.10.0

commit 0014e23
Author: RSWilli <bartel.wilhelm@gmail.com>
Date:   Fri Mar 11 13:52:53 2022 +0100

    import proto as type import if onlyTypes is set
  • Loading branch information
stephenh committed Mar 13, 2022
1 parent 1bba1d0 commit 25d8e8b
Show file tree
Hide file tree
Showing 13 changed files with 159 additions and 34 deletions.
2 changes: 1 addition & 1 deletion integration/avoid-import-conflicts-types-only/simple.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable */
import { SimpleEnum as SimpleEnum1, Simple as Simple2 } from './simple2';
import type { SimpleEnum as SimpleEnum1, Simple as Simple2 } from './simple2';

export const protobufPackage = 'simple';

Expand Down
2 changes: 1 addition & 1 deletion integration/grpc-js/simple.ts
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,7 @@ export interface TestClient extends Client {
): ClientDuplexStream<string | undefined, string | undefined>;
}

export const TestClient = (makeGenericClientConstructor(TestService, 'simple.Test') as unknown) as {
export const TestClient = makeGenericClientConstructor(TestService, 'simple.Test') as unknown as {
new (address: string, credentials: ChannelCredentials, options?: Partial<ChannelOptions>): TestClient;
service: typeof TestService;
};
Expand Down
3 changes: 3 additions & 0 deletions integration/meta-typings/google/protobuf/timestamp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ export const protoMetadata: ProtoMetadata = {
defaultValue: '',
oneofIndex: 0,
jsonName: 'seconds',
options: undefined,
proto3Optional: false,
},
{
Expand All @@ -190,6 +191,7 @@ export const protoMetadata: ProtoMetadata = {
defaultValue: '',
oneofIndex: 0,
jsonName: 'nanos',
options: undefined,
proto3Optional: false,
},
],
Expand All @@ -198,6 +200,7 @@ export const protoMetadata: ProtoMetadata = {
enumType: [],
extensionRange: [],
oneofDecl: [],
options: undefined,
reservedRange: [],
reservedName: [],
},
Expand Down
18 changes: 18 additions & 0 deletions integration/meta-typings/google/protobuf/wrappers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,7 @@ export const protoMetadata: ProtoMetadata = {
defaultValue: '',
oneofIndex: 0,
jsonName: 'value',
options: undefined,
proto3Optional: false,
},
],
Expand All @@ -409,6 +410,7 @@ export const protoMetadata: ProtoMetadata = {
enumType: [],
extensionRange: [],
oneofDecl: [],
options: undefined,
reservedRange: [],
reservedName: [],
},
Expand All @@ -425,6 +427,7 @@ export const protoMetadata: ProtoMetadata = {
defaultValue: '',
oneofIndex: 0,
jsonName: 'value',
options: undefined,
proto3Optional: false,
},
],
Expand All @@ -433,6 +436,7 @@ export const protoMetadata: ProtoMetadata = {
enumType: [],
extensionRange: [],
oneofDecl: [],
options: undefined,
reservedRange: [],
reservedName: [],
},
Expand All @@ -449,6 +453,7 @@ export const protoMetadata: ProtoMetadata = {
defaultValue: '',
oneofIndex: 0,
jsonName: 'value',
options: undefined,
proto3Optional: false,
},
],
Expand All @@ -457,6 +462,7 @@ export const protoMetadata: ProtoMetadata = {
enumType: [],
extensionRange: [],
oneofDecl: [],
options: undefined,
reservedRange: [],
reservedName: [],
},
Expand All @@ -473,6 +479,7 @@ export const protoMetadata: ProtoMetadata = {
defaultValue: '',
oneofIndex: 0,
jsonName: 'value',
options: undefined,
proto3Optional: false,
},
],
Expand All @@ -481,6 +488,7 @@ export const protoMetadata: ProtoMetadata = {
enumType: [],
extensionRange: [],
oneofDecl: [],
options: undefined,
reservedRange: [],
reservedName: [],
},
Expand All @@ -497,6 +505,7 @@ export const protoMetadata: ProtoMetadata = {
defaultValue: '',
oneofIndex: 0,
jsonName: 'value',
options: undefined,
proto3Optional: false,
},
],
Expand All @@ -505,6 +514,7 @@ export const protoMetadata: ProtoMetadata = {
enumType: [],
extensionRange: [],
oneofDecl: [],
options: undefined,
reservedRange: [],
reservedName: [],
},
Expand All @@ -521,6 +531,7 @@ export const protoMetadata: ProtoMetadata = {
defaultValue: '',
oneofIndex: 0,
jsonName: 'value',
options: undefined,
proto3Optional: false,
},
],
Expand All @@ -529,6 +540,7 @@ export const protoMetadata: ProtoMetadata = {
enumType: [],
extensionRange: [],
oneofDecl: [],
options: undefined,
reservedRange: [],
reservedName: [],
},
Expand All @@ -545,6 +557,7 @@ export const protoMetadata: ProtoMetadata = {
defaultValue: '',
oneofIndex: 0,
jsonName: 'value',
options: undefined,
proto3Optional: false,
},
],
Expand All @@ -553,6 +566,7 @@ export const protoMetadata: ProtoMetadata = {
enumType: [],
extensionRange: [],
oneofDecl: [],
options: undefined,
reservedRange: [],
reservedName: [],
},
Expand All @@ -569,6 +583,7 @@ export const protoMetadata: ProtoMetadata = {
defaultValue: '',
oneofIndex: 0,
jsonName: 'value',
options: undefined,
proto3Optional: false,
},
],
Expand All @@ -577,6 +592,7 @@ export const protoMetadata: ProtoMetadata = {
enumType: [],
extensionRange: [],
oneofDecl: [],
options: undefined,
reservedRange: [],
reservedName: [],
},
Expand All @@ -593,6 +609,7 @@ export const protoMetadata: ProtoMetadata = {
defaultValue: '',
oneofIndex: 0,
jsonName: 'value',
options: undefined,
proto3Optional: false,
},
],
Expand All @@ -601,6 +618,7 @@ export const protoMetadata: ProtoMetadata = {
enumType: [],
extensionRange: [],
oneofDecl: [],
options: undefined,
reservedRange: [],
reservedName: [],
},
Expand Down
4 changes: 4 additions & 0 deletions integration/meta-typings/google/type/date.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ export const protoMetadata: ProtoMetadata = {
defaultValue: '',
oneofIndex: 0,
jsonName: 'year',
options: undefined,
proto3Optional: false,
},
{
Expand All @@ -118,6 +119,7 @@ export const protoMetadata: ProtoMetadata = {
defaultValue: '',
oneofIndex: 0,
jsonName: 'month',
options: undefined,
proto3Optional: false,
},
{
Expand All @@ -130,6 +132,7 @@ export const protoMetadata: ProtoMetadata = {
defaultValue: '',
oneofIndex: 0,
jsonName: 'day',
options: undefined,
proto3Optional: false,
},
],
Expand All @@ -138,6 +141,7 @@ export const protoMetadata: ProtoMetadata = {
enumType: [],
extensionRange: [],
oneofDecl: [],
options: undefined,
reservedRange: [],
reservedName: [],
},
Expand Down
3 changes: 3 additions & 0 deletions integration/meta-typings/import_dir/thing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ export const protoMetadata: ProtoMetadata = {
defaultValue: '',
oneofIndex: 0,
jsonName: 'createdAt',
options: undefined,
proto3Optional: false,
},
],
Expand All @@ -76,13 +77,15 @@ export const protoMetadata: ProtoMetadata = {
enumType: [],
extensionRange: [],
oneofDecl: [],
options: undefined,
reservedRange: [],
reservedName: [],
},
],
enumType: [],
service: [],
extension: [],
options: undefined,
sourceCodeInfo: { location: [] },
syntax: 'proto3',
}),
Expand Down
Loading

0 comments on commit 25d8e8b

Please sign in to comment.