Default properties to {} to avoid passing it superfluously for events with no properties

pull/21833/head
James Salter 2021-07-28 17:54:35 +01:00
parent d401789f9e
commit 07eaee25d2
2 changed files with 3 additions and 3 deletions

View File

@ -302,7 +302,7 @@ export class PosthogAnalytics {
public async trackPseudonymousEvent<E extends IPseudonymousEvent>( public async trackPseudonymousEvent<E extends IPseudonymousEvent>(
eventName: E["eventName"], eventName: E["eventName"],
properties: E["properties"], properties: E["properties"] = {},
) { ) {
if (this.anonymity == Anonymity.Anonymous || this.anonymity == Anonymity.Disabled) return; if (this.anonymity == Anonymity.Anonymous || this.anonymity == Anonymity.Disabled) return;
await this.capture(eventName, properties); await this.capture(eventName, properties);
@ -310,7 +310,7 @@ export class PosthogAnalytics {
public async trackAnonymousEvent<E extends IAnonymousEvent>( public async trackAnonymousEvent<E extends IAnonymousEvent>(
eventName: E["eventName"], eventName: E["eventName"],
properties: E["properties"], properties: E["properties"] = {},
): Promise<void> { ): Promise<void> {
if (this.anonymity == Anonymity.Disabled) return; if (this.anonymity == Anonymity.Disabled) return;
await this.capture(eventName, properties); await this.capture(eventName, properties);

View File

@ -76,6 +76,6 @@ export default class Welcome extends React.PureComponent<IProps> {
} }
componentDidMount() { componentDidMount() {
getAnalytics().trackAnonymousEvent<IWelcomeScreenLoad>("welcome_screen_load", {}); getAnalytics().trackAnonymousEvent<IWelcomeScreenLoad>("welcome_screen_load");
} }
} }