mirror of
https://github.com/zhigang1992/react-native-firebase.git
synced 2026-04-24 04:24:52 +08:00
[types][database] rework types
This commit is contained in:
36
packages/database/type-test.ts
Normal file
36
packages/database/type-test.ts
Normal file
@@ -0,0 +1,36 @@
|
||||
import firebase from '@react-native-firebase/app';
|
||||
import defaultExport, { firebase as firebaseFromModule } from '@react-native-firebase/database';
|
||||
|
||||
// checks module exists at root
|
||||
console.log(firebase.database().app.name);
|
||||
console.log(firebase.database().ref('foo/bar'));
|
||||
|
||||
// checks module exists at app level
|
||||
console.log(firebase.app().database().app.name);
|
||||
console.log(
|
||||
firebase
|
||||
.app()
|
||||
.database()
|
||||
.ref('foo/bar'),
|
||||
);
|
||||
|
||||
// check module accepts a string arg
|
||||
console.log(firebase.app().database('some-string').app.name);
|
||||
|
||||
// checks statics exist
|
||||
console.log(firebase.database.SDK_VERSION);
|
||||
|
||||
// checks statics exist on defaultExport
|
||||
console.log(defaultExport.SDK_VERSION);
|
||||
|
||||
// checks root exists
|
||||
console.log(firebase.SDK_VERSION);
|
||||
|
||||
// checks firebase named export exists on module
|
||||
console.log(firebaseFromModule.SDK_VERSION);
|
||||
|
||||
// checks multi-app support exists
|
||||
console.log(firebase.database(firebase.app()).app.name);
|
||||
|
||||
// checks default export supports app arg
|
||||
console.log(defaultExport(firebase.app()).app.name);
|
||||
Reference in New Issue
Block a user