---
title: TypeScript
description: >-
  Modular API import patterns for TypeScript, where the generated type
  definitions live, and the compare:types process used for Auth.
next: /ios-spm
previous: /migrating-to-v27
---
> ## Documentation Index
> Fetch the complete documentation index at: https://rnfirebase.io/llms.txt
> Use this file to discover all available pages before exploring further.

## Prerequisites

- A React Native or Expo app with TypeScript enabled. Official setup: [React Native TypeScript documentation](https://reactnative.dev/docs/typescript).
- `@react-native-firebase/app` installed and native config completed per [Getting Started](/) (Android `google-services.json`, iOS `GoogleService-Info.plist`, Expo config plugin, or React Native CLI setup).
- The product package you import (this page uses `@react-native-firebase/auth` as the example): `npm install --save @react-native-firebase/auth` or `yarn add @react-native-firebase/auth`, then rebuild native apps if you just added the package.

React Native Firebase ships TypeScript declarations for every module. Modular types and helpers are exported from each package root (for example `@react-native-firebase/auth`). v26 removed the namespaced API and the `Firebase*Types` namespaces from the packages listed in [Migrating to v26](/migrating-to-v26), so use the modular names shown below.

## Modular API

Import modular helpers and types from the package root. This example is a complete React component that listens for auth state:

```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;
}
```

Historical note: [Migrating to v25](/migrating-to-v25) covers the Auth breaking changes made in v25 (the `FirebaseAuthTypes` deprecation, provider helpers, async `isSignInWithEmailLink`, and other firebase-js-sdk alignment updates). The `FirebaseAuthTypes` namespace was then removed in v26; import `User`, `Auth`, and the other modular types from `@react-native-firebase/auth` instead.

## 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/index.ts`](https://github.com/invertase/react-native-firebase/blob/main/packages/auth/lib/index.ts).

Public API reference (generated from source JSDoc): [reference API](https://reference.rnfirebase.io/modules.html).

## Definitions per module

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

| Module    | Modular types (import from package root)                             |
| --------- | -------------------------------------------------------------------- |
| Auth      | `User`, `Auth`, `UserCredential`, `OAuthProvider`, …                 |
| Firestore | `Firestore`, `DocumentReference`, `QuerySnapshot`, `DocumentData`, … |
| App Check | `AppCheck`, `AppCheckTokenResult`, …                                 |

For Auth v25 alignment details and intentional firebase-js-sdk differences, see the [Auth compare:types triage](https://github.com/invertase/react-native-firebase/blob/main/okf-bundle/packages/auth/compare-types-triage.md) knowledge document and [`yarn compare:types auth`](https://github.com/invertase/react-native-firebase/blob/main/.github/scripts/compare-types/configs/auth.ts) registry.
