Reputation: 155
I'm using firebase SDK version 8.0.2 and trying to log a 'screen_view' event but I'm getting an error that says:
Argument of type '"screen_view"' is not assignable to parameter of type '"add_payment_info"'
The linter seems like it's not reading the correct string value.
useEffect(() => {
if (subscribeActive) {
analytics.logEvent('screen_view')
}
}, [subscribeActive])
Related Github link, though OP doesn't specify how he fixed it: https://github.com/firebase/firebase-js-sdk/issues/3080
Upvotes: 1
Views: 1144
Reputation: 155
Figured it out. There are non-optional properties in the eventParams object for a 'screen_view' event. Without the app_name & screen_name it produces the typescript error I described--weird how the error doesn't specify missing properties, but instead throws a misleading error.
logEvent(
eventName: 'screen_view',
eventParams: {
app_name: string;
screen_name: EventParams['screen_name'];
app_id?: string;
app_version?: string;
app_installer_id?: string;
[key: string]: any;
},
options?: firebase.analytics.AnalyticsCallOptions
): void;
Upvotes: 2