Skip to content

Commit

Permalink
Merge 7358020 into 89b104a
Browse files Browse the repository at this point in the history
  • Loading branch information
tomonacci authored Oct 25, 2021
2 parents 89b104a + 7358020 commit 512d449
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
7 changes: 7 additions & 0 deletions packages/analytics/__tests__/analytics.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,13 @@ describe('Analytics', function () {
'firebase.analytics().logScreenView(*):',
);
});
it('accepts arbitrary custom event parameters while rejecting defined parameters with wrong types', function () {
expect(() => firebase.analytics().logScreenView({ foo: 'bar' })).not.toThrow();
expect(() =>
// @ts-ignore test
firebase.analytics().logScreenView({ screen_name: 123, foo: 'bar' }),
).toThrowError('firebase.analytics().logScreenView(*):');
});
});

describe('logAddPaymentInfo()', function () {
Expand Down
4 changes: 4 additions & 0 deletions packages/analytics/lib/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,10 @@ export namespace FirebaseAnalyticsTypes {
* Current class associated with the view the user is currently viewing.
*/
screen_class?: string;
/**
* Custom event parameters.
*/
[key: string]: any;
}

export interface RefundEventParameters {
Expand Down
2 changes: 1 addition & 1 deletion packages/analytics/lib/structs.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const Item = struct({
price: 'number?',
});

export const ScreenView = struct({
export const ScreenView = struct.interface({
screen_class: 'string?',
screen_name: 'string?',
});
Expand Down

0 comments on commit 512d449

Please sign in to comment.