Skip to content

Update firestore package to typescript 4.7.4 #6779

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/firestore/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
"rollup-plugin-terser": "7.0.2",
"rollup-plugin-typescript2": "0.31.2",
"ts-node": "10.9.1",
"typescript": "4.2.2"
"typescript": "4.7.4"
},
"repository": {
"directory": "packages/firestore",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ export class FetchConnection extends RestConnection {
headers,
body: requestJson
});
} catch (err) {
} catch (e) {
const err = e as { status: number | undefined; statusText: string };
throw new FirestoreError(
mapCodeFromHttpStatus(err.status),
'Request failed with error: ' + err.statusText
Expand Down
2 changes: 1 addition & 1 deletion packages/firestore/src/util/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export interface WindowLike {

/** The subset of the browser's Document interface used by the SDK. */
export interface DocumentLike {
readonly visibilityState: VisibilityState;
readonly visibilityState: DocumentVisibilityState;
addEventListener(type: string, listener: EventListener): void;
removeEventListener(type: string, listener: EventListener): void;
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import { expect } from 'chai';

import { FirestoreError } from '../../../src';
import { DEFAULT_TRANSACTION_OPTIONS } from '../../../src/core/transaction_options';
import { TimerId } from '../../../src/util/async_queue';
import { Deferred } from '../../util/promise';
Expand Down Expand Up @@ -155,7 +156,8 @@ apiDescribe(
await transaction.set(docRef, { count: 16 });
});
expect.fail('transaction should fail');
} catch (err) {
} catch (e) {
const err = e as FirestoreError;
expect(err).to.exist;
expect(err.code).to.equal('aborted');
}
Expand Down Expand Up @@ -194,7 +196,8 @@ apiDescribe(
options
);
expect.fail('transaction should fail');
} catch (err) {
} catch (e) {
const err = e as FirestoreError;
expect(err).to.exist;
expect(err.code).to.equal('aborted');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1310,18 +1310,18 @@ describe('IndexedDb: canActAsPrimary', () => {

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

const visible: VisibilityState = 'visible';
const hidden: VisibilityState = 'hidden';
const visible: DocumentVisibilityState = 'visible';
const hidden: DocumentVisibilityState = 'hidden';
const networkEnabled = true;
const networkDisabled = false;
const primary = true;
const secondary = false;

type ExpectedPrimaryStateTestCase = [
boolean,
VisibilityState,
DocumentVisibilityState,
boolean,
VisibilityState,
DocumentVisibilityState,
boolean
];

Expand Down
2 changes: 1 addition & 1 deletion packages/firestore/test/unit/specs/spec_test_runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1571,7 +1571,7 @@ export interface SpecWatchEntity {
// PORTING NOTE: Only used by web multi-tab tests.
export interface SpecClientState {
/** The visibility state of the browser tab running the client. */
visibility?: VisibilityState;
visibility?: DocumentVisibilityState;
/** Whether this tab should try to forcefully become primary. */
primary?: true;
}
Expand Down
6 changes: 3 additions & 3 deletions packages/firestore/test/util/test_platform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,10 @@ export function testWindow(
* `Document` fake that implements the `visibilitychange` API used by Firestore.
*/
export class FakeDocument implements DocumentLike {
private _visibilityState: VisibilityState = 'hidden';
private _visibilityState: DocumentVisibilityState = 'hidden';
private visibilityListener: EventListener | null = null;

get visibilityState(): VisibilityState {
get visibilityState(): DocumentVisibilityState {
return this._visibilityState;
}

Expand All @@ -114,7 +114,7 @@ export class FakeDocument implements DocumentLike {
}
}

raiseVisibilityEvent(visibility: VisibilityState): void {
raiseVisibilityEvent(visibility: DocumentVisibilityState): void {
this._visibilityState = visibility;
if (this.visibilityListener) {
this.visibilityListener(new Event('visibilitychange'));
Expand Down