From b6c5a1a4768497465eabfa39153e28e4e418987e Mon Sep 17 00:00:00 2001 From: Brian Chen Date: Fri, 20 Aug 2021 12:01:45 -0500 Subject: [PATCH] chore!: upgrade typescript to v4.1.5 (#1592) --- dev/conformance/runner.ts | 2 +- dev/src/util.ts | 10 +++++----- dev/system-test/firestore.ts | 4 ++-- dev/test/index.ts | 4 ++-- dev/test/pool.ts | 2 +- package.json | 2 +- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/dev/conformance/runner.ts b/dev/conformance/runner.ts index 1fb08e35f..02b1a7595 100644 --- a/dev/conformance/runner.ts +++ b/dev/conformance/runner.ts @@ -432,7 +432,7 @@ function runTest(spec: ConformanceProto) { }; return createInstance(overrides).then(() => { - return new Promise((resolve, reject) => { + return new Promise((resolve, reject) => { const unlisten = watchQuery().onSnapshot( actualSnap => { const expectedSnapshot = expectedSnapshots.shift(); diff --git a/dev/src/util.ts b/dev/src/util.ts index 20045c153..0b15be22c 100644 --- a/dev/src/util.ts +++ b/dev/src/util.ts @@ -28,14 +28,14 @@ import * as gapicConfig from './v1/firestore_client_config.json'; */ export class Deferred { promise: Promise; - resolve: (value?: R | Promise) => void = () => {}; - reject: (reason?: Error) => void = () => {}; + resolve: (value: R | Promise) => void = () => {}; + reject: (reason: Error) => void = () => {}; constructor() { - this.promise = new Promise( + this.promise = new Promise( ( - resolve: (value?: R | Promise) => void, - reject: (reason?: Error) => void + resolve: (value: R | Promise) => void, + reject: (reason: Error) => void ) => { this.resolve = resolve; this.reject = reject; diff --git a/dev/system-test/firestore.ts b/dev/system-test/firestore.ts index 11e45e1aa..c6a95e9c8 100644 --- a/dev/system-test/firestore.ts +++ b/dev/system-test/firestore.ts @@ -444,7 +444,7 @@ describe('DocumentReference class', () => { }); it('has set() method', () => { - const allSupportedTypesObject = { + const allSupportedTypesObject: {[field: string]: unknown} = { stringValue: 'a', trueValue: true, falseValue: false, @@ -474,7 +474,7 @@ describe('DocumentReference class', () => { .then(doc => { const data = doc.data()!; expect(data.pathValue.path).to.equal( - allSupportedTypesObject.pathValue.path + (allSupportedTypesObject.pathValue as DocumentReference).path ); delete data.pathValue; delete allSupportedTypesObject.pathValue; diff --git a/dev/test/index.ts b/dev/test/index.ts index 68bf967cd..a3cf866fe 100644 --- a/dev/test/index.ts +++ b/dev/test/index.ts @@ -262,7 +262,7 @@ const allSupportedTypesInput = { bytesValue: Buffer.from([0x1, 0x2]), }; -const allSupportedTypesOutput = { +const allSupportedTypesOutput: {[field: string]: unknown} = { stringValue: 'a', trueValue: true, falseValue: false, @@ -676,7 +676,7 @@ describe('snapshot_() method', () => { // Deep Equal doesn't support matching instances of DocumentRefs, so we // compare them manually and remove them from the resulting object. expect(actualObject.get('pathValue').formattedName).to.equal( - expected.pathValue.formattedName + (expected.pathValue as Firestore.DocumentReference).formattedName ); const data = actualObject.data()!; delete data.pathValue; diff --git a/dev/test/pool.ts b/dev/test/pool.ts index a78a31631..8a377de68 100644 --- a/dev/test/pool.ts +++ b/dev/test/pool.ts @@ -222,7 +222,7 @@ describe('Client pool', () => { }); it('garbage collection calls destructor', () => { - const garbageCollect = new Deferred(); + const garbageCollect = new Deferred(); const clientPool = new ClientPool<{}>( 1, diff --git a/package.json b/package.json index 18ec0623a..f809f014d 100644 --- a/package.json +++ b/package.json @@ -81,7 +81,7 @@ "proxyquire": "^2.1.3", "sinon": "^11.0.0", "ts-node": "^10.0.0", - "typescript": "3.8.3", + "typescript": "^4.1.5", "through2": "^4.0.0" } }