Skip to content

Commit 87fef34

Browse files
committed
Steal work by @MarkDuckworth that he had done so far in #6779 :P
1 parent e9fb403 commit 87fef34

File tree

7 files changed

+17
-13
lines changed

7 files changed

+17
-13
lines changed

packages/firestore/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@
111111
"rollup-plugin-terser": "7.0.2",
112112
"rollup-plugin-typescript2": "0.31.2",
113113
"ts-node": "10.9.1",
114-
"typescript": "4.2.2"
114+
"typescript": "4.7.4"
115115
},
116116
"repository": {
117117
"directory": "packages/firestore",

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ export class FetchConnection extends RestConnection {
6161
headers,
6262
body: requestJson
6363
});
64-
} catch (err) {
64+
} catch (e) {
65+
const err = e as { status: number | undefined; statusText: string };
6566
throw new FirestoreError(
6667
mapCodeFromHttpStatus(err.status),
6768
'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: VisibilityState;
64+
readonly visibilityState: DocumentVisibilityState;
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: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
import { expect } from 'chai';
1919

20+
import { FirestoreError } from '../../../src';
2021
import { DEFAULT_TRANSACTION_OPTIONS } from '../../../src/core/transaction_options';
2122
import { TimerId } from '../../../src/util/async_queue';
2223
import { Deferred } from '../../util/promise';
@@ -155,7 +156,8 @@ apiDescribe(
155156
await transaction.set(docRef, { count: 16 });
156157
});
157158
expect.fail('transaction should fail');
158-
} catch (err) {
159+
} catch (e) {
160+
const err = e as FirestoreError;
159161
expect(err).to.exist;
160162
expect(err.code).to.equal('aborted');
161163
}
@@ -194,7 +196,8 @@ apiDescribe(
194196
options
195197
);
196198
expect.fail('transaction should fail');
197-
} catch (err) {
199+
} catch (e) {
200+
const err = e as FirestoreError;
198201
expect(err).to.exist;
199202
expect(err.code).to.equal('aborted');
200203
}

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: VisibilityState = 'visible';
1314-
const hidden: VisibilityState = 'hidden';
1313+
const visible: DocumentVisibilityState = 'visible';
1314+
const hidden: DocumentVisibilityState = 'hidden';
13151315
const networkEnabled = true;
13161316
const networkDisabled = false;
13171317
const primary = true;
13181318
const secondary = false;
13191319

13201320
type ExpectedPrimaryStateTestCase = [
13211321
boolean,
1322-
VisibilityState,
1322+
DocumentVisibilityState,
13231323
boolean,
1324-
VisibilityState,
1324+
DocumentVisibilityState,
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?: VisibilityState;
1574+
visibility?: DocumentVisibilityState;
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: VisibilityState = 'hidden';
96+
private _visibilityState: DocumentVisibilityState = 'hidden';
9797
private visibilityListener: EventListener | null = null;
9898

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

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

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

0 commit comments

Comments
 (0)