Skip to content

Commit

Permalink
fix: no ts-ignore in generated code (#99)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-fenster authored Nov 4, 2019
1 parent 07cabdc commit 355cec8
Show file tree
Hide file tree
Showing 11 changed files with 24 additions and 40 deletions.
4 changes: 4 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ jobs:
npm install
npm test
npm run fix
npm run compile
- run:
name: Run unit tests and gts fix of the generated KMS library
command: |
Expand All @@ -59,6 +60,7 @@ jobs:
npm install
npm test
npm run fix
npm run compile
- run:
name: Run unit tests and gts fix of the generated Translate library
command: |
Expand All @@ -67,6 +69,7 @@ jobs:
npm install
npm test
npm run fix
npm run compile
- run:
name: Run unit tests and gts fix of the generated Text-to-Speech library
command: |
Expand All @@ -75,6 +78,7 @@ jobs:
npm install
npm test
npm run fix
npm run compile
- run:
name: Run linting
command: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,10 +245,9 @@ export class {{ service.name }}Client {
// google.showcase.v1alpha2.Echo.
const {{ service.name.toCamelCase() }}Stub = gaxGrpc.createStub(
opts.fallback ?
// @ts-ignore Do not check types for loaded protos
protos.lookupService('{{api.naming.protoPackage}}.{{ service.name }}') :
// @ts-ignore Do not check types for loaded protos
protos.{{api.naming.protoPackage}}.{{ service.name }},
(protos as protobuf.Root).lookupService('{{api.naming.protoPackage}}.{{ service.name }}') :
// tslint:disable-next-line no-any
(protos as any).{{api.naming.protoPackage}}.{{ service.name }},
opts) as Promise<{[method: string]: Function}>;

const {{ service.name.toCamelCase() }}StubMethods =
Expand Down
5 changes: 1 addition & 4 deletions templates/typescript_gapic/tslint.json.njk
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,5 @@ limitations under the License.
-#}
{
"extends": "gts/tslint.json",
"rules": {
"ban-ts-ignore": false
}
"extends": "gts/tslint.json"
}
Original file line number Diff line number Diff line change
Expand Up @@ -192,10 +192,9 @@ export class KeyManagementServiceClient {
// google.showcase.v1alpha2.Echo.
const keyManagementServiceStub = gaxGrpc.createStub(
opts.fallback ?
// @ts-ignore Do not check types for loaded protos
protos.lookupService('google.cloud.kms.v1.KeyManagementService') :
// @ts-ignore Do not check types for loaded protos
protos.google.cloud.kms.v1.KeyManagementService,
(protos as protobuf.Root).lookupService('google.cloud.kms.v1.KeyManagementService') :
// tslint:disable-next-line no-any
(protos as any).google.cloud.kms.v1.KeyManagementService,
opts) as Promise<{[method: string]: Function}>;

const keyManagementServiceStubMethods =
Expand Down
5 changes: 1 addition & 4 deletions typescript/test/testdata/keymanager/tslint.json.baseline
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
{
"extends": "gts/tslint.json",
"rules": {
"ban-ts-ignore": false
}
"extends": "gts/tslint.json"
}
Original file line number Diff line number Diff line change
Expand Up @@ -212,10 +212,9 @@ export class EchoClient {
// google.showcase.v1alpha2.Echo.
const echoStub = gaxGrpc.createStub(
opts.fallback ?
// @ts-ignore Do not check types for loaded protos
protos.lookupService('google.showcase.v1beta1.Echo') :
// @ts-ignore Do not check types for loaded protos
protos.google.showcase.v1beta1.Echo,
(protos as protobuf.Root).lookupService('google.showcase.v1beta1.Echo') :
// tslint:disable-next-line no-any
(protos as any).google.showcase.v1beta1.Echo,
opts) as Promise<{[method: string]: Function}>;

const echoStubMethods =
Expand Down
5 changes: 1 addition & 4 deletions typescript/test/testdata/showcase/tslint.json.baseline
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
{
"extends": "gts/tslint.json",
"rules": {
"ban-ts-ignore": false
}
"extends": "gts/tslint.json"
}
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,9 @@ export class TextToSpeechClient {
// google.showcase.v1alpha2.Echo.
const textToSpeechStub = gaxGrpc.createStub(
opts.fallback ?
// @ts-ignore Do not check types for loaded protos
protos.lookupService('google.cloud.texttospeech.v1.TextToSpeech') :
// @ts-ignore Do not check types for loaded protos
protos.google.cloud.texttospeech.v1.TextToSpeech,
(protos as protobuf.Root).lookupService('google.cloud.texttospeech.v1.TextToSpeech') :
// tslint:disable-next-line no-any
(protos as any).google.cloud.texttospeech.v1.TextToSpeech,
opts) as Promise<{[method: string]: Function}>;

const textToSpeechStubMethods =
Expand Down
5 changes: 1 addition & 4 deletions typescript/test/testdata/texttospeech/tslint.json.baseline
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
{
"extends": "gts/tslint.json",
"rules": {
"ban-ts-ignore": false
}
"extends": "gts/tslint.json"
}
Original file line number Diff line number Diff line change
Expand Up @@ -226,10 +226,9 @@ export class TranslationServiceClient {
// google.showcase.v1alpha2.Echo.
const translationServiceStub = gaxGrpc.createStub(
opts.fallback ?
// @ts-ignore Do not check types for loaded protos
protos.lookupService('google.cloud.translation.v3beta1.TranslationService') :
// @ts-ignore Do not check types for loaded protos
protos.google.cloud.translation.v3beta1.TranslationService,
(protos as protobuf.Root).lookupService('google.cloud.translation.v3beta1.TranslationService') :
// tslint:disable-next-line no-any
(protos as any).google.cloud.translation.v3beta1.TranslationService,
opts) as Promise<{[method: string]: Function}>;

const translationServiceStubMethods =
Expand Down
5 changes: 1 addition & 4 deletions typescript/test/testdata/translate/tslint.json.baseline
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
{
"extends": "gts/tslint.json",
"rules": {
"ban-ts-ignore": false
}
"extends": "gts/tslint.json"
}

0 comments on commit 355cec8

Please sign in to comment.