TypeScript

Using TypeScript with React Native Firebase

React Native Firebase ships TypeScript declarations for every module. From v25 onward, modular types and helpers are exported from each package root (for example @react-native-firebase/auth) alongside the namespaced default export.

If you are setting up TypeScript in a new React Native app, see the official TypeScript documentation.

Modular API

Import modular helpers and types from the package root:

tsx
import { useEffect, useState } from 'react';
import { getAuth, onAuthStateChanged, type User } from '@react-native-firebase/auth';

function App() {
  const [user, setUser] = useState<User | null>(null);

  useEffect(() => {
    const authInstance = getAuth();
    return onAuthStateChanged(authInstance, setUser);
  }, []);

  if (!user) {
    return null;
  }

  return user.email;
}

See Migrating to v25 for Auth breaking changes (FirebaseAuthTypes deprecation, provider helpers, async isSignInWithEmailLink, and other firebase-js-sdk alignment updates).

Where definitions live

Published types are built to packages/<module>/dist/typescript/ (for example packages/auth/dist/typescript/lib/index.d.ts). Source lives under packages/<module>/lib/ as TypeScript (.ts) since the v25 package migrations.

Modular Auth source: packages/auth/lib/modular.ts.

Public API reference (generated from source JSDoc): reference API.

Definitions per module

Each package exports its own types from the package root. Examples:

ModuleModular types (import from package root)
AuthUser, Auth, UserCredential, OAuthProvider, …
FirestoreFirebaseFirestoreTypes namespace (namespaced) + modular helpers from @react-native-firebase/firestore
App CheckAppCheck, AppCheckTokenResult, …

For Auth v25 alignment details and intentional firebase-js-sdk differences, see the Auth compare:types triage knowledge document and yarn compare:types auth registry.