Skip to content

Commit 53d13c5

Browse files
authored
Fixing Typings for RTDB (#264)
* Re-exported the typings from database for admin use case * [AUTOMATED]: Prettier Code Styling * Fixing case issue * Whoops, missed one
1 parent e1dceac commit 53d13c5

File tree

3 files changed

+21
-4
lines changed

3 files changed

+21
-4
lines changed

packages/database/index.node.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ import './src/nodePatches';
3232
* @param app A valid FirebaseApp-like object
3333
* @param url A valid Firebase databaseURL
3434
*/
35+
36+
const ServerValue = Database.ServerValue;
37+
3538
export function initStandalone(app, url) {
3639
return {
3740
instance: RepoManager.getInstance().databaseFromApp(app, url),
@@ -41,7 +44,7 @@ export function initStandalone(app, url) {
4144
Database,
4245
enableLogging,
4346
INTERNAL,
44-
ServerValue: Database.ServerValue,
47+
ServerValue,
4548
TEST_ACCESS
4649
}
4750
};
@@ -59,7 +62,7 @@ export function registerDatabase(instance: FirebaseNamespace) {
5962
Database,
6063
enableLogging,
6164
INTERNAL,
62-
ServerValue: Database.ServerValue,
65+
ServerValue,
6366
TEST_ACCESS
6467
},
6568
null,
@@ -72,3 +75,9 @@ export function registerDatabase(instance: FirebaseNamespace) {
7275
}
7376

7477
registerDatabase(firebase);
78+
79+
// Types to export for the admin SDK
80+
export { Database, Query, Reference, enableLogging, ServerValue };
81+
82+
export { DataSnapshot } from './src/api/DataSnapshot';
83+
export { OnDisconnect } from './src/api/onDisconnect';

packages/database/index.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ import * as INTERNAL from './src/api/internal';
2424
import * as TEST_ACCESS from './src/api/test_access';
2525
import { isNodeSdk } from '@firebase/util';
2626

27+
const ServerValue = Database.ServerValue;
28+
2729
export function registerDatabase(instance: FirebaseNamespace) {
2830
// Register the Database Service with the 'firebase' namespace.
2931
const namespace = instance.INTERNAL.registerService(
@@ -36,7 +38,7 @@ export function registerDatabase(instance: FirebaseNamespace) {
3638
Database,
3739
enableLogging,
3840
INTERNAL,
39-
ServerValue: Database.ServerValue,
41+
ServerValue,
4042
TEST_ACCESS
4143
},
4244
null,
@@ -49,3 +51,9 @@ export function registerDatabase(instance: FirebaseNamespace) {
4951
}
5052

5153
registerDatabase(firebase);
54+
55+
// Types to export for the admin SDK
56+
export { Database, Query, Reference, enableLogging, ServerValue };
57+
58+
export { DataSnapshot } from './src/api/DataSnapshot';
59+
export { OnDisconnect } from './src/api/onDisconnect';

packages/database/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,5 @@
5151
"bugs": {
5252
"url": "https://github.com/firebase/firebase-js-sdk/issues"
5353
},
54-
"typings": "dist/index.d.ts"
54+
"typings": "dist/cjs/index.d.ts"
5555
}

0 commit comments

Comments
 (0)