Skip to content

Commit 3fa62ef

Browse files
jsprischmidt-sebastian
authored andcommitted
Update rtdb types (#840)
1 parent 87b274b commit 3fa62ef

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

packages/database-types/index.d.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export interface DataSnapshot {
2020
child(path: string): DataSnapshot;
2121
exists(): boolean;
2222
exportVal(): any;
23-
forEach(action: (a: DataSnapshot) => boolean): boolean;
23+
forEach(action: (a: DataSnapshot) => boolean | void): boolean;
2424
getPriority(): string | number | null;
2525
hasChild(path: string): boolean;
2626
hasChildren(): boolean;
@@ -53,29 +53,31 @@ export interface OnDisconnect {
5353
update(values: Object, onComplete?: (a: Error | null) => any): Promise<any>;
5454
}
5555

56+
type EventType = 'value' | 'child_added' | 'child_changed' | 'child_moved' | 'child_removed';
57+
5658
export interface Query {
5759
endAt(value: number | string | boolean | null, key?: string): Query;
5860
equalTo(value: number | string | boolean | null, key?: string): Query;
5961
isEqual(other: Query | null): boolean;
6062
limitToFirst(limit: number): Query;
6163
limitToLast(limit: number): Query;
6264
off(
63-
eventType?: string,
65+
eventType?: EventType,
6466
callback?: (a: DataSnapshot, b?: string | null) => any,
6567
context?: Object | null
6668
): any;
6769
on(
68-
eventType: string,
70+
eventType: EventType,
6971
callback: (a: DataSnapshot | null, b?: string) => any,
7072
cancelCallbackOrContext?: Object | null,
7173
context?: Object | null
7274
): (a: DataSnapshot | null, b?: string) => any;
7375
once(
74-
eventType: string,
76+
eventType: EventType,
7577
successCallback?: (a: DataSnapshot, b?: string) => any,
7678
failureCallbackOrContext?: Object | null,
7779
context?: Object | null
78-
): Promise<any>;
80+
): Promise<DataSnapshot>;
7981
orderByChild(path: string): Query;
8082
orderByKey(): Query;
8183
orderByPriority(): Query;

0 commit comments

Comments
 (0)