Skip to content

Commit 86befb3

Browse files
authored
rename imports to avoid conflicts (#5534)
* rename imports to avoid conflicts * update comment
1 parent ba9cba4 commit 86befb3

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

packages/database-compat/src/index.ts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,12 @@ import { enableLogging } from '@firebase/database';
2323
import * as types from '@firebase/database-types';
2424

2525
import { name, version } from '../package.json';
26-
import { Database } from '../src/api/Database';
26+
import { Database as DatabaseCompat } from '../src/api/Database';
2727
import * as INTERNAL from '../src/api/internal';
28-
import { DataSnapshot, Query, Reference } from '../src/api/Reference';
28+
// rename the imports to avoid conflicts with imports that will be added by "yarn add-compat-overloads" during a release build
29+
import { DataSnapshot as DataSnapshotCompat, Query as QueryCompat, Reference } from '../src/api/Reference';
2930

30-
const ServerValue = Database.ServerValue;
31+
const ServerValue = DatabaseCompat.ServerValue;
3132

3233
export function registerDatabase(instance: FirebaseNamespace) {
3334
// Register the Database Service with the 'firebase' namespace.
@@ -43,17 +44,17 @@ export function registerDatabase(instance: FirebaseNamespace) {
4344
const databaseExp = container
4445
.getProvider('database')
4546
.getImmediate({ identifier: url });
46-
return new Database(databaseExp, app);
47+
return new DatabaseCompat(databaseExp, app);
4748
},
4849
ComponentType.PUBLIC
4950
)
5051
.setServiceProps(
5152
// firebase.database namespace properties
5253
{
5354
Reference,
54-
Query,
55-
Database,
56-
DataSnapshot,
55+
Query: QueryCompat,
56+
Database: DatabaseCompat,
57+
DataSnapshot: DataSnapshotCompat,
5758
enableLogging,
5859
INTERNAL,
5960
ServerValue
@@ -69,7 +70,7 @@ registerDatabase(firebase);
6970

7071
// Types to export for the admin SDK. They are exported here in the browser entry point only for types
7172
// The same symbol should be exported from the node entry point so their values can be accessed at runtime by admin SDK
72-
export { Database, Query, Reference, enableLogging, ServerValue, DataSnapshot };
73+
export { DatabaseCompat as Database, QueryCompat as Query, Reference, enableLogging, ServerValue, DataSnapshotCompat as DataSnapshot };
7374
export { OnDisconnect } from '@firebase/database';
7475

7576
declare module '@firebase/app-compat' {

0 commit comments

Comments
 (0)