You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-11-07 10:46:24 +03:00
Document IEvent.properties, fix IWelcomeScreenLoad
IEvent.properties is a placeholder that needs to be overriden by extenders for type validation to take place. IWelcomeScreenLoad should have had properties declared for it. Because it didn't, a faulty call using it was possible.
This commit is contained in:
@@ -35,12 +35,12 @@ import SettingsStore from './settings/SettingsStore';
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
interface IEvent {
|
interface IEvent {
|
||||||
// The event name that will be used by PostHog.
|
// The event name that will be used by PostHog. Event names should use snake_case.
|
||||||
// TODO: standard format (camel case? snake? UpperCase?)
|
|
||||||
eventName: string;
|
eventName: string;
|
||||||
|
|
||||||
// The properties of the event that will be stored in PostHog.
|
// The properties of the event that will be stored in PostHog. This is just a placeholder,
|
||||||
properties: {};
|
// extending interfaces must override this with a concrete definition to do type validation.
|
||||||
|
properties: {}
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum Anonymity {
|
export enum Anonymity {
|
||||||
@@ -73,6 +73,7 @@ interface IPageView extends IAnonymousEvent {
|
|||||||
|
|
||||||
export interface IWelcomeScreenLoad extends IAnonymousEvent {
|
export interface IWelcomeScreenLoad extends IAnonymousEvent {
|
||||||
eventName: "welcome_screen_load";
|
eventName: "welcome_screen_load";
|
||||||
|
properties: Record<any, never>;
|
||||||
}
|
}
|
||||||
|
|
||||||
const hashHex = async (input: string): Promise<string> => {
|
const hashHex = async (input: string): Promise<string> => {
|
||||||
|
|||||||
@@ -76,6 +76,6 @@ export default class Welcome extends React.PureComponent<IProps> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
getAnalytics().trackAnonymousEvent<IWelcomeScreenLoad>("welcome_screen_load", { foo: "bar" });
|
getAnalytics().trackAnonymousEvent<IWelcomeScreenLoad>("welcome_screen_load", {});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user