Skip to content

Commit

Permalink
Add an interface Database (#3511)
Browse files Browse the repository at this point in the history
* Add an interface Database

* Create thirty-flies-flow.md

* Update .changeset/thirty-flies-flow.md

Co-authored-by: Sebastian Schmidt <[email protected]>

* Update thirty-flies-flow.md

Co-authored-by: Sebastian Schmidt <[email protected]>
  • Loading branch information
Feiyang1 and schmidt-sebastian authored Jul 30, 2020
1 parent 94986e6 commit ef348fe
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
6 changes: 6 additions & 0 deletions .changeset/thirty-flies-flow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@firebase/database-types": patch
"@firebase/database": patch
---

Added interface `Database` which is implemented by `FirebaseDatabase`. This allows consumer SDKs (such as the Firebase Admin SDK) to export the database types as an interface.
11 changes: 9 additions & 2 deletions packages/database-types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,16 @@ export interface DataSnapshot {
val(): any;
}

export class FirebaseDatabase {
private constructor();
export interface Database {
app: FirebaseApp;
goOffline(): void;
goOnline(): void;
ref(path?: string | Reference): Reference;
refFromURL(url: string): Reference;
}

export class FirebaseDatabase implements Database {
private constructor();
app: FirebaseApp;
goOffline(): void;
goOnline(): void;
Expand Down
2 changes: 1 addition & 1 deletion packages/database/index.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export function initStandalone(app: FirebaseApp, url: string, version: string) {
app,
authProvider,
url
) as types.FirebaseDatabase,
) as types.Database,
namespace: {
Reference,
Query,
Expand Down

0 comments on commit ef348fe

Please sign in to comment.