Skip to content

Commit adc06d4

Browse files
authored
fix(types): enable TypeScript libCheck & resolve type conflicts (invertase#4306)
* chore: enable TypeScript libcheck & remove "dom" lib "dom" conflicts with @types/react-native * chore: add react types (referenced by admob types) * refactor(types, app): move "app" exports to top-level exports, rather than module declarations with namespace extensions * refactor(types): use top-level exports for module types, rather than declarations * refactor(types): for JSON config, augment existing `ReactNativeFirebase` namespace from /app Re-exporting the namespace causes collision issues -- tramples previous values rather than merging * fix(types, admob): Use string-indexing rather than dot-notation for referring to interface keys * fix(types, analytics): convert missing interface to `any` * fix(types, database): missing `value` type (treated as 'any') * fix(types, dynamic-links): fix dynamic-links `onLink` function type "Function" is not generic * fix(types, firestore): add missing generic to Promise type Keep current behavior with `any` * fix(types, messaging): remove parameter initializer in typedef Only allowed in implementations * fix(types, messaging): avoid implicit `any` via `void` return type for `setBackgroundMessageHandler` * fix(types, ml-vision): import non-ambient types in BarcodeDetectorTypes * fix(types, ml-vision): import non-ambient types in root module from BarcodeDetectorTypes * fix(types, ml-vision): repair invalid `extends` use by duplicating inherited key Could have Omit<>'ed the incompatible `bounds` key, but duplicating the one inherited key seemed less complex * fix(types, perf): add void return types to untyped perf methods * tests(admob): add type override to intentionally-wrong syntax Incorrect type is now caught by TS * tests(types, ml-vision): fix ml-vision test typo, exposed by proper types VisionBarcodeFormat.ALL_POINTS does not exist * chore(website): update typedoc to allow recursive types uses new syntax: TSConfigReader
1 parent f619481 commit adc06d4

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

lib/index.d.ts

+12-14
Original file line numberDiff line numberDiff line change
@@ -1962,7 +1962,7 @@ export namespace FirebaseFirestoreTypes {
19621962
* });
19631963
* ```
19641964
*/
1965-
runTransaction(updateFunction: (transaction: Transaction) => Promise): Promise<any>;
1965+
runTransaction(updateFunction: (transaction: Transaction) => Promise<any>): Promise<any>;
19661966

19671967
/**
19681968
* Specifies custom settings to be used to configure the Firestore instance. Must be set before invoking any other methods.
@@ -2023,21 +2023,19 @@ export namespace FirebaseFirestoreTypes {
20232023
}
20242024
}
20252025

2026-
declare module '@react-native-firebase/firestore' {
2027-
// tslint:disable-next-line:no-duplicate-imports required otherwise doesn't work
2028-
import { ReactNativeFirebase } from '@react-native-firebase/app';
2029-
import ReactNativeFirebaseModule = ReactNativeFirebase.Module;
2030-
import FirebaseModuleWithStaticsAndApp = ReactNativeFirebase.FirebaseModuleWithStaticsAndApp;
2026+
declare const defaultExport: ReactNativeFirebase.FirebaseModuleWithStaticsAndApp<
2027+
FirebaseFirestoreTypes.Module,
2028+
FirebaseFirestoreTypes.Statics
2029+
>;
20312030

2032-
const firebaseNamedExport: {} & ReactNativeFirebaseModule;
2033-
export const firebase = firebaseNamedExport;
2031+
export const firebase: ReactNativeFirebase.Module & {
2032+
firestore: typeof defaultExport;
2033+
app(
2034+
name?: string,
2035+
): ReactNativeFirebase.FirebaseApp & { firestore(): FirebaseFirestoreTypes.Module };
2036+
};
20342037

2035-
const defaultExport: FirebaseModuleWithStaticsAndApp<
2036-
FirebaseFirestoreTypes.Module,
2037-
FirebaseFirestoreTypes.Statics
2038-
>;
2039-
export default defaultExport;
2040-
}
2038+
export default defaultExport;
20412039

20422040
/**
20432041
* Attach namespace to `firebase.` and `FirebaseApp.`.

0 commit comments

Comments
 (0)