Event Parameters and Options Types
Defines TypeScript types for event parameters and options when logging events in Firebase Analytics. This helps in ensuring that the parameters and options passed to the logEvent function adhere to the expected structure.
import { EventParams, AnalyticsCallOptions } from '@firebase/analytics-types';
function logEvent(analytics: FirebaseAnalytics, eventName: string, eventParams?: EventParams, options?: AnalyticsCallOptions) {
analytics.logEvent(eventName, eventParams, options);
}
Analytics Interface
Provides type definitions for the FirebaseAnalytics interface, which includes methods for interacting with Firebase Analytics, such as setting the current screen, logging events, etc. This ensures that all method calls on the analytics object are type-checked.
import { FirebaseAnalytics } from '@firebase/analytics-types';
function setupAnalytics(analytics: FirebaseAnalytics) {
analytics.setCurrentScreen('homepage');
}