diff --git a/types/expo-mixpanel-analytics/expo-mixpanel-analytics-tests.ts b/types/expo-mixpanel-analytics/expo-mixpanel-analytics-tests.ts new file mode 100644 index 0000000000..50dc0dffe4 --- /dev/null +++ b/types/expo-mixpanel-analytics/expo-mixpanel-analytics-tests.ts @@ -0,0 +1,31 @@ +import ExpoMixpanelAnalytics from 'expo-mixpanel-analytics'; + +const analytics = new ExpoMixpanelAnalytics('5224da5bbbed3fdeaad0911820f1bf2x'); + +analytics.identify("13793"); + +analytics.track("Signed Up", { "Referred By": "Friend" }); + +analytics.people_set({ + $first_name: "Joe", + $last_name: "Doe", + $email: "joe.doe@example.com", + $created: "2013-04-01T13:20:00", + $phone: "4805551212", + Address: "1313 Mockingbird Lane", + Birthday: "1948-01-01" +}); + +analytics.people_set_once({ "First login date": "2013-04-01T13:20:00" }); + +analytics.people_unset([ "Days Overdue" ]); + +analytics.people_increment({ "Coins Gathered": 12 }); + +analytics.people_append({ "Power Ups": "Bubble Lead" }); + +analytics.people_union({ "Items purchased": ["socks", "shirts"] }); + +analytics.people_delete_user(); + +analytics.reset(); diff --git a/types/expo-mixpanel-analytics/index.d.ts b/types/expo-mixpanel-analytics/index.d.ts new file mode 100644 index 0000000000..6b51a15585 --- /dev/null +++ b/types/expo-mixpanel-analytics/index.d.ts @@ -0,0 +1,26 @@ +// Type definitions for expo-mixpanel-analytics 0.0 +// Project: https://github.com/codekadiya/expo-mixpanel-analytics +// Definitions by: Martin Treurnicht +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +declare class ExpoMixpanelAnalytics { + constructor(token: string); + identify(userId: string): void; + track(name: string, props: Props): void; + people_set(props: Props): void; + people_set_once(props: Props): void; + people_unset(keys: string[]): void; + people_increment(props: Props): void; + people_append(props: Props): void; + people_union(props: Props): void; + people_delete_user(): void; + reset(): void; + token: string; +} + +interface Props { + [key: string]: T; +} + +export default ExpoMixpanelAnalytics; diff --git a/types/expo-mixpanel-analytics/tsconfig.json b/types/expo-mixpanel-analytics/tsconfig.json new file mode 100644 index 0000000000..57ee3b6a41 --- /dev/null +++ b/types/expo-mixpanel-analytics/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "expo-mixpanel-analytics-tests.ts" + ] +} diff --git a/types/expo-mixpanel-analytics/tslint.json b/types/expo-mixpanel-analytics/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/expo-mixpanel-analytics/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }