diff --git a/package.json b/package.json index 710a307ad..32d7869ec 100644 --- a/package.json +++ b/package.json @@ -92,7 +92,7 @@ "proxyquire": "^2.0.0", "sinon": "^7.1.1", "source-map-support": "^0.5.9", - "typescript": "~3.1.5" + "typescript": "~3.2.0" }, "nyc": { "exclude": [ diff --git a/src/iam.ts b/src/iam.ts index 006976226..e55e882d7 100644 --- a/src/iam.ts +++ b/src/iam.ts @@ -21,11 +21,8 @@ import {promisifyAll} from '@google-cloud/promisify'; import * as arrify from 'arrify'; import {CallOptions} from 'google-gax'; -import * as is from 'is'; -import * as r from 'request'; import {PubSub} from '.'; - /** * @callback GetPolicyCallback * @param {?Error} err Request error, if any. @@ -175,7 +172,8 @@ export class IAM { this.Promise = pubsub.Promise; } this.pubsub = pubsub; - this.request = pubsub.request.bind(pubsub); + // tslint:disable-next-line no-any + this.request = pubsub.request.bind(pubsub) as any; this.id = id; } diff --git a/src/subscriber.ts b/src/subscriber.ts index 56a845b31..a193261c7 100644 --- a/src/subscriber.ts +++ b/src/subscriber.ts @@ -264,7 +264,8 @@ export class Subscriber extends EventEmitter { deadline => this.modifyAckDeadline_(modAcks[deadline], Number(deadline))); - requests.push.apply(requests, modAckRequests); + // tslint:disable-next-line no-any + requests.push.apply(requests, modAckRequests as any); Promise.all(modAckRequests).then(() => { this.inventory_.nack = []; diff --git a/src/topic.ts b/src/topic.ts index 33f48c910..862bc70ed 100644 --- a/src/topic.ts +++ b/src/topic.ts @@ -71,7 +71,8 @@ export class Topic { * @type {PubSub} */ this.parent = this.pubsub = pubsub; - this.request = pubsub.request.bind(pubsub); + // tslint:disable-next-line no-any + this.request = pubsub.request.bind(pubsub) as any; /** * [IAM (Identity and Access * Management)](https://cloud.google.com/pubsub/access_control) allows you diff --git a/test/subscriber.ts b/test/subscriber.ts index b597f0557..93a250d2b 100644 --- a/test/subscriber.ts +++ b/test/subscriber.ts @@ -47,14 +47,14 @@ class FakeConnectionPool extends EventEmitter { calledWith_: IArguments; constructor() { super(); - this.calledWith_ = [].slice.call(arguments); + this.calledWith_ = arguments; } } class FakeHistogram { calledWith_: IArguments; constructor() { - this.calledWith_ = [].slice.call(arguments); + this.calledWith_ = arguments; } } // tslint:disable-next-line no-any diff --git a/test/subscription.ts b/test/subscription.ts index 868aa734b..113ff4ed9 100644 --- a/test/subscription.ts +++ b/test/subscription.ts @@ -35,7 +35,7 @@ const fakePromisify = Object.assign({}, pfy, { class FakeIAM { calledWith_: IArguments; constructor() { - this.calledWith_ = [].slice.call(arguments); + this.calledWith_ = arguments; } } @@ -43,14 +43,14 @@ class FakeSnapshot { calledWith_: IArguments; static formatName_?: Function; constructor() { - this.calledWith_ = [].slice.call(arguments); + this.calledWith_ = arguments; } } class FakeSubscriber { calledWith_: IArguments; constructor() { - this.calledWith_ = [].slice.call(arguments); + this.calledWith_ = arguments; } } @@ -149,9 +149,7 @@ describe('Subscription', () => { it('should create an IAM object', () => { assert(subscription.iam instanceof FakeIAM); - const args = subscription.iam.calledWith_; - assert.strictEqual(args[0], PUBSUB); assert.strictEqual(args[1], subscription.name); }); @@ -159,7 +157,6 @@ describe('Subscription', () => { it('should inherit from Subscriber', () => { const options = {}; const subscription = new Subscription(PUBSUB, SUB_NAME, options); - assert(subscription instanceof FakeSubscriber); assert.strictEqual(subscription.calledWith_[0], options); }); diff --git a/test/topic.ts b/test/topic.ts index 34d62123c..b335ce6f9 100644 --- a/test/topic.ts +++ b/test/topic.ts @@ -33,16 +33,20 @@ const fakePromisify = Object.assign({}, pfy, { }); class FakeIAM { - calledWith_: IArguments; - constructor() { - this.calledWith_ = [].slice.call(arguments); + // tslint:disable-next-line no-any + calledWith_: any[]; + // tslint:disable-next-line no-any + constructor(...args: any[]) { + this.calledWith_ = args; } } class FakePublisher { - calledWith_: IArguments; - constructor() { - this.calledWith_ = [].slice.call(arguments); + // tslint:disable-next-line no-any + calledWith_: any[]; + // tslint:disable-next-line no-any + constructor(...args: any[]) { + this.calledWith_ = args; } }