From ae33f9a8985159f89d3548cfca1a714f1eb0e331 Mon Sep 17 00:00:00 2001 From: Rodrigo Landaeta Date: Wed, 28 Mar 2018 15:25:03 +1100 Subject: [PATCH] Adding typescript support by creating the module definition. --- index.d.ts | 31 +++++++++++++++++++++++++++++++ package.json | 1 + 2 files changed, 32 insertions(+) create mode 100644 index.d.ts diff --git a/index.d.ts b/index.d.ts new file mode 100644 index 0000000..643dff1 --- /dev/null +++ b/index.d.ts @@ -0,0 +1,31 @@ +declare module "react-native-mixpanel-bridge" { + /** + * NOTE: This is quite a literal copy of the type definitions + * generated in definitelyTyped repo for react-native-mixpanel + */ + + // Project: https://github.com/davodesign84/react-native-mixpanel#readme + // Definitions by: Andrew Makarov + // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + // TypeScript Version: 2.2 + + export function sharedInstanceWithToken(token: string): void; + export function track(event: string): void; + export function trackWithProperties(event: string, property: object): void; + export function createAlias(id: string): void; + export function identify(id: string): void; + export function set(property: object): void; + export function setOnce(property: object): void; + export function timeEvent(event: string): void; + export function registerSuperProperties(property: object): void; + export function registerSuperPropertiesOnce(property: object): void; + export function trackCharge(id: number): void; + export function trackChargeWithProperties(id: number, property: object): void; + export function increment(property: string, value: number): void; + export function setPushRegistrationId(token: string): void; + export function initPushHandling(token: string): void; + export function clearPushRegistrationId(): void; + export function addPushDeviceToken(token: string): void; + export function reset(): void; + export function getDistinctId(handler: (id: string) => void): void; +} diff --git a/package.json b/package.json index 9764c1e..72c15be 100644 --- a/package.json +++ b/package.json @@ -5,6 +5,7 @@ "main": "index.js", "repository": "http://github.com/projetoeureka/react-native-mixpanel-bridge", "license": "MIT", + "types": "index.d.ts", "rnpm": { "ios": { "sharedLibraries": [