Skip to content

Commit 9514b13

Browse files
committed
Revert "TypeScript 4.7.4 upgrade for Firestore (#6796)"
This reverts commit ab3f16c (#6796) because it (somehow?) caused the browser tests to fail in GitHub Actions.
1 parent fde5adf commit 9514b13

File tree

14 files changed

+29
-79
lines changed

14 files changed

+29
-79
lines changed

.changeset/breezy-wombats-care.md

Lines changed: 0 additions & 7 deletions
This file was deleted.

packages/firestore-compat/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
"rollup-plugin-typescript2": "0.31.2",
5959
"@rollup/plugin-node-resolve": "13.3.0",
6060
"ts-node": "10.9.1",
61-
"typescript": "4.7.4"
61+
"typescript": "4.2.2"
6262
},
6363
"license": "Apache-2.0",
6464
"typings": "dist/src/index.d.ts",

packages/firestore-compat/test/array_transforms.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,7 @@ apiDescribe('Array Transforms:', (persistence: boolean) => {
189189
let errCaught = false;
190190
try {
191191
await docRef.get({ source: 'cache' });
192-
} catch (e) {
193-
const err = e as firestore.FirestoreError;
192+
} catch (err) {
194193
expect(err.code).to.equal('unavailable');
195194
errCaught = true;
196195
}

packages/firestore-compat/test/transactions.test.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,7 @@ apiDescribe('Database transactions', (persistence: boolean) => {
116116
const snapshot = await this.docRef.get();
117117
expect(snapshot.exists).to.equal(true);
118118
expect(snapshot.data()).to.deep.equal(expected);
119-
} catch (e) {
120-
const err = e as firestore.FirestoreError;
119+
} catch (err) {
121120
expect.fail(
122121
'Expected the sequence (' +
123122
this.listStages(this.stages) +
@@ -134,8 +133,7 @@ apiDescribe('Database transactions', (persistence: boolean) => {
134133
await this.runTransaction();
135134
const snapshot = await this.docRef.get();
136135
expect(snapshot.exists).to.equal(false);
137-
} catch (e) {
138-
const err = e as firestore.FirestoreError;
136+
} catch (err) {
139137
expect.fail(
140138
'Expected the sequence (' +
141139
this.listStages(this.stages) +
@@ -152,9 +150,8 @@ apiDescribe('Database transactions', (persistence: boolean) => {
152150
await this.prepareDoc();
153151
await this.runTransaction();
154152
succeeded = true;
155-
} catch (e) {
156-
const err = e as firestore.FirestoreError;
157-
expect(err.code).to.equal(expected);
153+
} catch (err) {
154+
expect((err as firestore.FirestoreError).code).to.equal(expected);
158155
}
159156
if (succeeded) {
160157
expect.fail(

packages/firestore/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
"@firebase/logger": "0.3.4",
8787
"@firebase/util": "1.7.3",
8888
"@firebase/webchannel-wrapper": "0.8.1",
89-
"@grpc/grpc-js": "~1.7.0",
89+
"@grpc/grpc-js": "^1.3.2",
9090
"@grpc/proto-loader": "^0.6.13",
9191
"node-fetch": "2.6.7",
9292
"tslib": "^2.1.0"
@@ -113,7 +113,7 @@
113113
"rollup-plugin-terser": "7.0.2",
114114
"rollup-plugin-typescript2": "0.31.2",
115115
"ts-node": "10.9.1",
116-
"typescript": "4.7.4"
116+
"typescript": "4.2.2"
117117
},
118118
"repository": {
119119
"directory": "packages/firestore",

packages/firestore/scripts/remove-asserts.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/firestore/scripts/remove-asserts.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ class RemoveAsserts {
6464
) {
6565
const method = declaration.name!.text;
6666
if (method === 'debugAssert') {
67-
updatedNode = ts.createOmittedExpression();
67+
updatedNode = ts.createEmptyStatement();
6868
} else if (method === 'hardAssert') {
6969
// Remove the log message but keep the assertion
7070
updatedNode = ts.createCall(

packages/firestore/src/platform/browser_lite/fetch_connection.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,7 @@ export class FetchConnection extends RestConnection {
6161
headers,
6262
body: requestJson
6363
});
64-
} catch (e) {
65-
const err = e as { status: number | undefined; statusText: string };
64+
} catch (err) {
6665
throw new FirestoreError(
6766
mapCodeFromHttpStatus(err.status),
6867
'Request failed with error: ' + err.statusText

packages/firestore/src/util/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export interface WindowLike {
6161

6262
/** The subset of the browser's Document interface used by the SDK. */
6363
export interface DocumentLike {
64-
readonly visibilityState: DocumentVisibilityState;
64+
readonly visibilityState: VisibilityState;
6565
addEventListener(type: string, listener: EventListener): void;
6666
removeEventListener(type: string, listener: EventListener): void;
6767
}

packages/firestore/test/integration/api_internal/transaction.test.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717

1818
import { expect } from 'chai';
1919

20-
import { FirestoreError } from '../../../src';
2120
import { DEFAULT_TRANSACTION_OPTIONS } from '../../../src/core/transaction_options';
2221
import { TimerId } from '../../../src/util/async_queue';
2322
import { Deferred } from '../../util/promise';
@@ -156,8 +155,7 @@ apiDescribe(
156155
await transaction.set(docRef, { count: 16 });
157156
});
158157
expect.fail('transaction should fail');
159-
} catch (e) {
160-
const err = e as FirestoreError;
158+
} catch (err) {
161159
expect(err).to.exist;
162160
expect(err.code).to.equal('aborted');
163161
}
@@ -196,8 +194,7 @@ apiDescribe(
196194
options
197195
);
198196
expect.fail('transaction should fail');
199-
} catch (e) {
200-
const err = e as FirestoreError;
197+
} catch (err) {
201198
expect(err).to.exist;
202199
expect(err.code).to.equal('aborted');
203200
}

packages/firestore/test/unit/local/indexeddb_persistence.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1310,18 +1310,18 @@ describe('IndexedDb: canActAsPrimary', () => {
13101310

13111311
after(() => SimpleDb.delete(INDEXEDDB_TEST_DATABASE_NAME));
13121312

1313-
const visible: DocumentVisibilityState = 'visible';
1314-
const hidden: DocumentVisibilityState = 'hidden';
1313+
const visible: VisibilityState = 'visible';
1314+
const hidden: VisibilityState = 'hidden';
13151315
const networkEnabled = true;
13161316
const networkDisabled = false;
13171317
const primary = true;
13181318
const secondary = false;
13191319

13201320
type ExpectedPrimaryStateTestCase = [
13211321
boolean,
1322-
DocumentVisibilityState,
1322+
VisibilityState,
13231323
boolean,
1324-
DocumentVisibilityState,
1324+
VisibilityState,
13251325
boolean
13261326
];
13271327

packages/firestore/test/unit/specs/spec_test_runner.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1571,7 +1571,7 @@ export interface SpecWatchEntity {
15711571
// PORTING NOTE: Only used by web multi-tab tests.
15721572
export interface SpecClientState {
15731573
/** The visibility state of the browser tab running the client. */
1574-
visibility?: DocumentVisibilityState;
1574+
visibility?: VisibilityState;
15751575
/** Whether this tab should try to forcefully become primary. */
15761576
primary?: true;
15771577
}

packages/firestore/test/util/test_platform.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,10 @@ export function testWindow(
9393
* `Document` fake that implements the `visibilitychange` API used by Firestore.
9494
*/
9595
export class FakeDocument implements DocumentLike {
96-
private _visibilityState: DocumentVisibilityState = 'hidden';
96+
private _visibilityState: VisibilityState = 'hidden';
9797
private visibilityListener: EventListener | null = null;
9898

99-
get visibilityState(): DocumentVisibilityState {
99+
get visibilityState(): VisibilityState {
100100
return this._visibilityState;
101101
}
102102

@@ -114,7 +114,7 @@ export class FakeDocument implements DocumentLike {
114114
}
115115
}
116116

117-
raiseVisibilityEvent(visibility: DocumentVisibilityState): void {
117+
raiseVisibilityEvent(visibility: VisibilityState): void {
118118
this._visibilityState = visibility;
119119
if (this.visibilityListener) {
120120
this.visibilityListener(new Event('visibilitychange'));

yarn.lock

Lines changed: 7 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1815,6 +1815,13 @@
18151815
lodash.snakecase "^4.1.1"
18161816
p-defer "^3.0.0"
18171817

1818+
"@grpc/grpc-js@^1.3.2":
1819+
version "1.3.7"
1820+
resolved "https://registry.npmjs.org/@grpc/grpc-js/-/grpc-js-1.3.7.tgz#58b687aff93b743aafde237fd2ee9a3259d7f2d8"
1821+
integrity sha512-CKQVuwuSPh40tgOkR7c0ZisxYRiN05PcKPW72mQL5y++qd7CwBRoaJZvU5xfXnCJDFBmS3qZGQ71Frx6Ofo2XA==
1822+
dependencies:
1823+
"@types/node" ">=12.12.47"
1824+
18181825
"@grpc/grpc-js@~1.6.0":
18191826
version "1.6.7"
18201827
resolved "https://registry.npmjs.org/@grpc/grpc-js/-/grpc-js-1.6.7.tgz#4c4fa998ff719fe859ac19fe977fdef097bb99aa"
@@ -1823,14 +1830,6 @@
18231830
"@grpc/proto-loader" "^0.6.4"
18241831
"@types/node" ">=12.12.47"
18251832

1826-
"@grpc/grpc-js@~1.7.0":
1827-
version "1.7.3"
1828-
resolved "https://registry.npmjs.org/@grpc/grpc-js/-/grpc-js-1.7.3.tgz#f2ea79f65e31622d7f86d4b4c9ae38f13ccab99a"
1829-
integrity sha512-H9l79u4kJ2PVSxUNA08HMYAnUBLj9v6KjYQ7SQ71hOZcEXhShE/y5iQCesP8+6/Ik/7i2O0a10bPquIcYfufog==
1830-
dependencies:
1831-
"@grpc/proto-loader" "^0.7.0"
1832-
"@types/node" ">=12.12.47"
1833-
18341833
"@grpc/proto-loader@^0.6.12", "@grpc/proto-loader@^0.6.13", "@grpc/proto-loader@^0.6.4":
18351834
version "0.6.13"
18361835
resolved "https://registry.npmjs.org/@grpc/proto-loader/-/proto-loader-0.6.13.tgz#008f989b72a40c60c96cd4088522f09b05ac66bc"
@@ -1842,17 +1841,6 @@
18421841
protobufjs "^6.11.3"
18431842
yargs "^16.2.0"
18441843

1845-
"@grpc/proto-loader@^0.7.0":
1846-
version "0.7.3"
1847-
resolved "https://registry.npmjs.org/@grpc/proto-loader/-/proto-loader-0.7.3.tgz#75a6f95b51b85c5078ac7394da93850c32d36bb8"
1848-
integrity sha512-5dAvoZwna2Py3Ef96Ux9jIkp3iZ62TUsV00p3wVBPNX5K178UbNi8Q7gQVqwXT1Yq9RejIGG9G2IPEo93T6RcA==
1849-
dependencies:
1850-
"@types/long" "^4.0.1"
1851-
lodash.camelcase "^4.3.0"
1852-
long "^4.0.0"
1853-
protobufjs "^7.0.0"
1854-
yargs "^16.2.0"
1855-
18561844
"@gulp-sourcemaps/identity-map@^2.0.1":
18571845
version "2.0.1"
18581846
resolved "https://registry.npmjs.org/@gulp-sourcemaps/identity-map/-/identity-map-2.0.1.tgz#a6e8b1abec8f790ec6be2b8c500e6e68037c0019"
@@ -11901,11 +11889,6 @@ long@^4.0.0:
1190111889
resolved "https://registry.npmjs.org/long/-/long-4.0.0.tgz#9a7b71cfb7d361a194ea555241c92f7468d5bf28"
1190211890
integrity sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA==
1190311891

11904-
long@^5.0.0:
11905-
version "5.2.1"
11906-
resolved "https://registry.npmjs.org/long/-/long-5.2.1.tgz#e27595d0083d103d2fa2c20c7699f8e0c92b897f"
11907-
integrity sha512-GKSNGeNAtw8IryjjkhZxuKB3JzlcLTwjtiQCHKvqQet81I93kXslhDQruGI/QsddO83mcDToBVy7GqGS/zYf/A==
11908-
1190911892
loose-envify@^1.0.0:
1191011893
version "1.4.0"
1191111894
resolved "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz#71ee51fa7be4caec1a63839f7e682d8132d30caf"
@@ -14145,24 +14128,6 @@ [email protected], protobufjs@^6.11.3:
1414514128
"@types/node" ">=13.7.0"
1414614129
long "^4.0.0"
1414714130

14148-
protobufjs@^7.0.0:
14149-
version "7.1.2"
14150-
resolved "https://registry.npmjs.org/protobufjs/-/protobufjs-7.1.2.tgz#a0cf6aeaf82f5625bffcf5a38b7cd2a7de05890c"
14151-
integrity sha512-4ZPTPkXCdel3+L81yw3dG6+Kq3umdWKh7Dc7GW/CpNk4SX3hK58iPCWeCyhVTDrbkNeKrYNZ7EojM5WDaEWTLQ==
14152-
dependencies:
14153-
"@protobufjs/aspromise" "^1.1.2"
14154-
"@protobufjs/base64" "^1.1.2"
14155-
"@protobufjs/codegen" "^2.0.4"
14156-
"@protobufjs/eventemitter" "^1.1.0"
14157-
"@protobufjs/fetch" "^1.1.0"
14158-
"@protobufjs/float" "^1.0.2"
14159-
"@protobufjs/inquire" "^1.1.0"
14160-
"@protobufjs/path" "^1.1.2"
14161-
"@protobufjs/pool" "^1.1.0"
14162-
"@protobufjs/utf8" "^1.1.0"
14163-
"@types/node" ">=13.7.0"
14164-
long "^5.0.0"
14165-
1416614131
protocols@^1.1.0, protocols@^1.4.0:
1416714132
version "1.4.8"
1416814133
resolved "https://registry.npmjs.org/protocols/-/protocols-1.4.8.tgz#48eea2d8f58d9644a4a32caae5d5db290a075ce8"

0 commit comments

Comments
 (0)