Update typings for track_forms and track_links on mixpanel package (#39192)

* Fix types for `track_forms` and `track_links`

* semi

* update this other mixpanel package too

* fix lint warnings
This commit is contained in:
fent
2019-10-17 14:20:43 -07:00
committed by Andrew Branch
parent ae3bc97607
commit 3817461fd8
4 changed files with 12 additions and 6 deletions
+4 -2
View File
@@ -9,6 +9,8 @@ export type Persistence = 'cookie' | 'localStorage';
export type PushItem = Array<string | Dict>;
export type Query = string | Element | Element[];
export interface Dict {[key: string]: any; }
export interface XhrHeadersDef {[header: string]: any; }
@@ -123,7 +125,7 @@ export function reset(): void;
export function set_config(config: Partial<Config>): void;
export function time_event(event_name: string): void;
export function track(event_name: string, properties?: Dict, callback?: () => void): void;
export function track_forms(query: string, event_name: string, properties?: Dict | (() => void)): void;
export function track_links(query: string, event_name: string, properties?: Dict | (() => void)): void;
export function track_forms(query: Query, event_name: string, properties?: Dict | (() => void)): void;
export function track_links(query: Query, event_name: string, properties?: Dict | (() => void)): void;
export function unregister(property: string): void;
export const people: People;
+2 -1
View File
@@ -2,7 +2,8 @@
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
+4 -2
View File
@@ -97,7 +97,7 @@ interface Mixpanel {
* @param eventName The name of the event to track
* @param properties A properties object or function that returns a dictionary of properties when passed a DOMElement
*/
track_links(querySelector: string, eventName: string, properties?: { [index: string]: any }): void;
track_links(querySelector: Mixpanel.Query, eventName: string, properties?: { [index: string]: any }): void;
/**
* Track form submissions. Selector must be a valid query.
@@ -125,7 +125,7 @@ interface Mixpanel {
* @param eventName The name of the event to track
* @param properties This can be a set of properties, or a function that returns a set of properties after being passed a DOMElement
*/
track_forms(querySelector: string, eventName: string, properties?: { [index: string]: any }): void;
track_forms(querySelector: Mixpanel.Query, eventName: string, properties?: { [index: string]: any }): void;
/**
* Time an event by including the time between this call and a
@@ -625,6 +625,8 @@ declare namespace Mixpanel {
*/
property_blacklist?: string[];
}
type Query = string | Element | Element[];
}
declare var mixpanel: Mixpanel;
+2 -1
View File
@@ -2,7 +2,8 @@
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,