Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
22 changes: 11 additions & 11 deletions packages/remote-config/lib/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,17 @@ export namespace FirebaseRemoteConfigTypes {
*/
reset(): Promise<void>;
}

export type CallbackOrObserver<T extends (...args: any[]) => any> = T | { next: T };

export type OnConfigUpdatedListenerCallback = (
event?: { updatedKeys: string[] },
error?: {
code: string;
message: string;
nativeErrorMessage: string;
},
) => void;
}

declare const defaultExport: ReactNativeFirebase.FirebaseModuleWithStatics<
Expand All @@ -554,17 +565,6 @@ export const firebase: ReactNativeFirebase.Module & {
): ReactNativeFirebase.FirebaseApp & { remoteConfig(): FirebaseRemoteConfigTypes.Module };
};

type CallbackOrObserver<T extends (...args: any[]) => any> = T | { next: T };

type OnConfigUpdatedListenerCallback = (
event?: { updatedKeys: string[] },
error?: {
code: string;
message: string;
nativeErrorMessage: string;
},
) => void;

export default defaultExport;

export * from './modular';
Expand Down
4 changes: 3 additions & 1 deletion packages/remote-config/lib/modular/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ import RemoteConfigLogLevel = FirebaseRemoteConfigTypes.RemoteConfigLogLevel;
import FirebaseApp = ReactNativeFirebase.FirebaseApp;
import LastFetchStatusInterface = FirebaseRemoteConfigTypes.LastFetchStatus;
import ValueSourceInterface = FirebaseRemoteConfigTypes.ValueSource;
import CallbackOrObserver = FirebaseRemoteConfigTypes.CallbackOrObserver;
import OnConfigUpdatedListenerCallback = FirebaseRemoteConfigTypes.OnConfigUpdatedListenerCallback;

export const LastFetchStatus: LastFetchStatusInterface;
export const ValueSource: ValueSourceInterface;
Expand Down Expand Up @@ -210,7 +212,7 @@ export function setDefaultsFromResource(
*/
export function onConfigUpdated(
remoteConfig: RemoteConfig,
callback: (config: ConfigValues) => void,
callback: CallbackOrObserver<OnConfigUpdatedListenerCallback>,
): () => void;

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/remote-config/lib/modular/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ export function setDefaultsFromResource(remoteConfig, resourceName) {
* Registers a listener to changes in the configuration.
*
* @param {RemoteConfig} remoteConfig - RemoteConfig instance
* @param {function(ConfigValues): void} callback - function called on config change
* @param {CallbackOrObserver<OnConfigUpdatedListenerCallback>} callback - function called on config change
* @returns {function} unsubscribe listener
*/
export function onConfigUpdated(remoteConfig, callback) {
Expand Down
Loading