Skip to content
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

Add type and default generic type to DataSnapshot #590

Closed
wants to merge 8 commits into from
4 changes: 2 additions & 2 deletions packages/database-types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import { FirebaseApp } from '@firebase/app-types';

export interface DataSnapshot {
export interface DataSnapshot<T = any> {
child(path: string): DataSnapshot;
exists(): boolean;
exportVal(): any;
Expand All @@ -28,7 +28,7 @@ export interface DataSnapshot {
numChildren(): number;
ref: Reference;
toJSON(): Object | null;
val(): any;
val(): T | null;
}

export class FirebaseDatabase {
Expand Down
4 changes: 2 additions & 2 deletions packages/firebase/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ declare namespace firebase.auth.Auth {
}

declare namespace firebase.database {
interface DataSnapshot {
interface DataSnapshot<T = any> {
child(path: string): firebase.database.DataSnapshot;
exists(): boolean;
exportVal(): any;
Expand All @@ -434,7 +434,7 @@ declare namespace firebase.database {
hasChildren(): boolean;
key: string | null;
numChildren(): number;
val(): any;
val(): T | null;
ref: firebase.database.Reference;
toJSON(): Object | null;
}
Expand Down
4 changes: 2 additions & 2 deletions packages/firestore/src/remote/serializer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1129,8 +1129,8 @@ export class JsonProtoSerializer {
} else if (filter.fieldFilter !== undefined) {
return [this.fromRelationFilter(filter)];
} else if (filter.compositeFilter !== undefined) {
return filter.compositeFilter
.filters!.map(f => this.fromFilter(f))
return filter.compositeFilter.filters!
.map(f => this.fromFilter(f))
.reduce((accum, current) => accum.concat(current));
} else {
return fail('Unknown filter: ' + JSON.stringify(filter));
Expand Down
4 changes: 1 addition & 3 deletions tools/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,7 @@ Promise.resolve(userToken || cachedToken)
}
]);

const {
projectId: { id }
} = response;
const { projectId: { id } } = response;

return id;
})();
Expand Down