Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
040f954
refactor(remote-config): move to typescript
akashdeep931 Feb 19, 2026
3ac9a81
fix: remote-config unit tests
akashdeep931 Feb 19, 2026
5f988f0
fix(remote-config-typescript): public and internal types
akashdeep931 Feb 20, 2026
617ab63
fix(remote-config-typescript): remote-config index exports
akashdeep931 Feb 20, 2026
6a55992
fix(remote-config-typescript): namespaced fallbackModules import
akashdeep931 Feb 20, 2026
6a05b21
fix(remote-config-typescript): namespaced internal types
akashdeep931 Feb 20, 2026
705dcf4
fix(remote-config-typescript): clean up and namespaces internal types
akashdeep931 Feb 20, 2026
b11cf45
fix(remote-config-typescript): RemoteConfigWithDeprecationArg usage
akashdeep931 Feb 24, 2026
741480b
fix(remote-config-typescript): mark namespaced api types as deprecated
akashdeep931 Feb 24, 2026
a29e1b9
fix(remote-config-typescript): remote-config unit tests
akashdeep931 Feb 24, 2026
a6902c6
fix(remote-config-typescript): getRemoteConfig() modular api method
akashdeep931 Feb 24, 2026
a9ca4af
fix(remote-config-typescript): getValue() modular api method return type
akashdeep931 Feb 24, 2026
adece70
fix(remote-config-typescript): internal ConfigValue type to user faci…
akashdeep931 Feb 24, 2026
ae43cd7
fix(remote-config-typescript): FetchStatus type usage
akashdeep931 Feb 24, 2026
ed616ae
fix(remote-config-typescript): internal RemoteConfigLogLevel type to …
akashdeep931 Feb 24, 2026
cc2a1b7
fix(remote-config-typescript): setConfigSettings() modular API args t…
akashdeep931 Feb 24, 2026
06f223d
ci: create a script for checking RN types with firebase-js-sdk
russellwheatley Feb 26, 2026
865573f
fix(remote-config-typescript): revert previous version docs
akashdeep931 Feb 27, 2026
6a92143
fix(remote-config-typescript): revert previous version docs
akashdeep931 Feb 27, 2026
331abd6
fix(remote-config-typescript): revert previous version docs
akashdeep931 Feb 27, 2026
d0219c2
fix(remote-config-typescript): web module internal type use
akashdeep931 Feb 27, 2026
4ed786f
fix(remote-config-typescript): main package exports
akashdeep931 Feb 27, 2026
a5ad713
fix(remote-config-typescript): modular not used js-sdk supported types
akashdeep931 Feb 27, 2026
f3e2557
fix(remote-config-typescript): fetchConfig() modular api method
akashdeep931 Feb 27, 2026
a13524a
fix(remote-config-typescript): onConfigUpdated modular api deprecated…
akashdeep931 Feb 27, 2026
1ebe4e1
fix(remote-config-typescript): modular api internal type seperation
akashdeep931 Feb 27, 2026
680b36f
fix(remote-config-typescript): unit tests and namespaced api definiti…
akashdeep931 Feb 27, 2026
d977a1b
fix(remote-config-typescript): unit tests and namespaced this.native …
akashdeep931 Feb 27, 2026
4328dfe
fix(remote-config-typescript): unit and type tests, with namespaced A…
akashdeep931 Mar 2, 2026
8038ede
fix(remote-config-typescript): public type exports from namespaced ap…
akashdeep931 Mar 2, 2026
06135ac
fix(remote-config-typescript): type-test type assertion
akashdeep931 Mar 2, 2026
e6c1050
fix(remote-config-typescript): extra public types
akashdeep931 Mar 2, 2026
968c03d
fix(remote-config-typescript): config diffs
akashdeep931 Mar 2, 2026
2c010a0
fix(remote-config-typescript): extra types definitions
akashdeep931 Mar 2, 2026
cf88e38
fix(remote-config-typescript): extra type definitions
akashdeep931 Mar 2, 2026
722387b
fix(remote-config-typescript): extra type definitions
akashdeep931 Mar 2, 2026
1d0a0ba
fix(remote-config-typescript): rebase on main and fix e2e tests
akashdeep931 Mar 2, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
117 changes: 117 additions & 0 deletions .github/scripts/compare-types/packages/remote-config/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
/**
* Known differences between the firebase-js-sdk @firebase/remote-config public
* API and the @react-native-firebase/remote-config modular API.
*
* Each entry must have a `name` (the export name) and a `reason` explaining
* why the difference exists. Any difference NOT listed here will cause CI to
* fail so that new drift is caught and deliberately acknowledged.
*
* Sections:
* nameMapping — exports that exist in both packages but under different names
* missingInRN — firebase-js-sdk exports absent from RN Firebase
* extraInRN — RN Firebase exports not present in the firebase-js-sdk
* differentShape — exports present in both but with differing signatures/members
*/

import type { PackageConfig } from '../../src/types';

const config: PackageConfig = {
// ---------------------------------------------------------------------------
// Name mapping
// ---------------------------------------------------------------------------
// ValueSource exists in both packages. In RN Firebase we export only the
// value (from modular/statics) and use the value as the type; no type alias.
// Both sides see `ValueSource` and they match — no mapping entry needed.
nameMapping: {},

// ---------------------------------------------------------------------------
// Missing in RN Firebase
// ---------------------------------------------------------------------------
missingInRN: [
// Currently empty — all firebase-js-sdk remote-config exports are present
// in the RN Firebase modular API (though some have different shapes; see below).
],

// ---------------------------------------------------------------------------
// Extra in RN Firebase
// ---------------------------------------------------------------------------
extraInRN: [
{
name: 'LastFetchStatus',
reason:
'Namespaced constant re-exported from statics.d.ts for backwards ' +
'compatibility with the class-based (namespaced) API. Not part of ' +
'the firebase-js-sdk modular API.',
},
{
name: 'onConfigUpdated',
reason:
'Deprecated RN Firebase listener for real-time config updates. ' +
'Replaced by `onConfigUpdate()` which matches the firebase-js-sdk API.',
},
{
name: 'reset',
reason:
'Android-only API that deletes all activated, fetched and default ' +
'configs and resets all Remote Config settings. No equivalent exists ' +
'in the firebase-js-sdk.',
},
{
name: 'setConfigSettings',
reason:
'RN Firebase helper to update `minimumFetchIntervalMillis` and ' +
'`fetchTimeoutMillis` asynchronously via the native module. In the ' +
'firebase-js-sdk these properties are set by direct property assignment ' +
'on the `RemoteConfig.settings` object.',
},
{
name: 'setDefaults',
reason:
'RN Firebase API for setting default config values programmatically. ' +
'The firebase-js-sdk uses direct assignment to `RemoteConfig.defaultConfig` ' +
'instead.',
},
{
name: 'setDefaultsFromResource',
reason:
'RN Firebase-specific API that loads default config values from a ' +
'platform resource file (iOS .plist / Android XML). No equivalent ' +
'exists in the firebase-js-sdk web API.',
},
],

// ---------------------------------------------------------------------------
// Different shape
// ---------------------------------------------------------------------------
differentShape: [
{
name: 'ConfigUpdateObserver',
reason:
'The `error` callback parameter uses `ReactNativeFirebase.NativeFirebaseError` ' +
'instead of `FirebaseError` from `@firebase/app`. Both represent Firebase ' +
'errors but the RN type extends the native bridge error structure.',
},
{
name: 'getRemoteConfig',
reason:
'The optional `app` parameter uses `ReactNativeFirebase.FirebaseApp` from ' +
'`@react-native-firebase/app` instead of `FirebaseApp` from `@firebase/app`. ' +
'Both types represent a Firebase app instance but come from different packages.',
},
{
name: 'setLogLevel',
reason:
'Uses `LogLevel` matching firebase-js-sdk. RN Firebase returns `LogLevel`; ' +
'firebase-js-sdk returns `void`. The return type is a legacy artefact of the RN implementation.',
},
{
name: 'setCustomSignals',
reason:
'Returns `Promise<null>` in RN Firebase vs `Promise<void>` in the ' +
'firebase-js-sdk. The native module resolves with `null` rather than ' +
'`undefined`; both signal successful completion.',
},
],
};

export default config;
266 changes: 266 additions & 0 deletions .github/scripts/compare-types/packages/remote-config/firebase-sdk.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,266 @@
/**
* Public types snapshot from the Firebase JS SDK (@firebase/remote-config).
*
* Source: firebase-js-sdk package @firebase/remote-config
* Modality: modular (tree-shakeable) API only
*
* This file is the reference snapshot used to detect API drift between the
* firebase-js-sdk and the @react-native-firebase/remote-config modular API.
*
* When a new version of the firebase-js-sdk ships with type changes, update
* this file with the new public types from @firebase/remote-config/dist/index.d.ts.
*/

import { FirebaseApp } from '@firebase/app';
import { FirebaseError } from '@firebase/app';

/**
* Makes the last fetched config available to the getters.
* @public
*/
export declare function activate(remoteConfig: RemoteConfig): Promise<boolean>;

/**
* Contains information about which keys have been updated.
* @public
*/
export declare interface ConfigUpdate {
/**
* Parameter keys whose values have been updated from the currently activated values.
* Includes keys that are added, deleted, or whose value, value source, or metadata has changed.
*/
getUpdatedKeys(): Set<string>;
}

/**
* Observer interface for receiving real-time Remote Config update notifications.
* @public
*/
export declare interface ConfigUpdateObserver {
next: (configUpdate: ConfigUpdate) => void;
error: (error: FirebaseError) => void;
complete: () => void;
}

/**
* Defines the type for representing custom signals and their values.
* @public
*/
export declare interface CustomSignals {
[key: string]: string | number | null;
}

/**
* Ensures the last activated config are available to the getters.
* @public
*/
export declare function ensureInitialized(
remoteConfig: RemoteConfig,
): Promise<void>;

/**
* Performs fetch and activate operations, as a convenience.
* @public
*/
export declare function fetchAndActivate(
remoteConfig: RemoteConfig,
): Promise<boolean>;

/**
* Fetches and caches configuration from the Remote Config service.
* @public
*/
export declare function fetchConfig(remoteConfig: RemoteConfig): Promise<void>;

/**
* Defines a successful response (200 or 304).
* @public
*/
export declare interface FetchResponse {
status: number;
eTag?: string;
config?: FirebaseRemoteConfigObject;
templateVersion?: number;
experiments?: FirebaseExperimentDescription[];
}

/**
* Summarizes the outcome of the last attempt to fetch config.
* @public
*/
export declare type FetchStatus =
| 'no-fetch-yet'
| 'success'
| 'failure'
| 'throttle';

/**
* Indicates the type of fetch request.
* @public
*/
export declare type FetchType = 'BASE' | 'REALTIME';

/**
* Defines experiment and variant attached to a config parameter.
* @public
*/
export declare interface FirebaseExperimentDescription {
experimentId: string;
variantId: string;
experimentStartTime: string;
triggerTimeoutMillis: string;
timeToLiveMillis: string;
affectedParameterKeys?: string[];
}

/**
* Defines a self-descriptive reference for config key-value pairs.
* @public
*/
export declare interface FirebaseRemoteConfigObject {
[key: string]: string;
}

/**
* Gets all config.
* @public
*/
export declare function getAll(
remoteConfig: RemoteConfig,
): Record<string, Value>;

/**
* Gets the value for the given key as a boolean.
* @public
*/
export declare function getBoolean(
remoteConfig: RemoteConfig,
key: string,
): boolean;

/**
* Gets the value for the given key as a number.
* @public
*/
export declare function getNumber(
remoteConfig: RemoteConfig,
key: string,
): number;

/**
* Returns a RemoteConfig instance for the given app.
* @public
*/
export declare function getRemoteConfig(
app?: FirebaseApp,
options?: RemoteConfigOptions,
): RemoteConfig;

/**
* Gets the value for the given key as a string.
* @public
*/
export declare function getString(
remoteConfig: RemoteConfig,
key: string,
): string;

/**
* Gets the Value for the given key.
* @public
*/
export declare function getValue(remoteConfig: RemoteConfig, key: string): Value;

/**
* Returns true if a RemoteConfig instance can be initialized in this environment.
* @public
*/
export declare function isSupported(): Promise<boolean>;

/**
* Defines levels of Remote Config logging.
* @public
*/
export declare type LogLevel = 'debug' | 'error' | 'silent';

/**
* Starts listening for real-time config updates from the Remote Config backend.
* @public
*/
export declare function onConfigUpdate(
remoteConfig: RemoteConfig,
observer: ConfigUpdateObserver,
): Unsubscribe;

/**
* The Firebase Remote Config service interface.
* @public
*/
export declare interface RemoteConfig {
app: FirebaseApp;
settings: RemoteConfigSettings;
defaultConfig: {
[key: string]: string | number | boolean;
};
fetchTimeMillis: number;
lastFetchStatus: FetchStatus;
}

/**
* Options for Remote Config initialization.
* @public
*/
export declare interface RemoteConfigOptions {
templateId?: string;
initialFetchResponse?: FetchResponse;
}

/**
* Defines configuration options for the Remote Config SDK.
* @public
*/
export declare interface RemoteConfigSettings {
minimumFetchIntervalMillis: number;
fetchTimeoutMillis: number;
}

/**
* Sets the custom signals for the app instance.
* @public
*/
export declare function setCustomSignals(
remoteConfig: RemoteConfig,
customSignals: CustomSignals,
): Promise<void>;

/**
* Defines the log level to use.
* @public
*/
export declare function setLogLevel(
remoteConfig: RemoteConfig,
logLevel: LogLevel,
): void;

/**
* A function that unsubscribes from a real-time event stream.
* @public
*/
export declare type Unsubscribe = () => void;

/**
* Wraps a value with metadata and type-safe getters.
* @public
*/
export declare interface Value {
asBoolean(): boolean;
asNumber(): number;
asString(): string;
getSource(): ValueSource;
}

/**
* Indicates the source of a value.
* @public
*/
export declare type ValueSource = 'static' | 'default' | 'remote';
Loading
Loading