diff --git a/types/react-amplitude/index.d.ts b/types/react-amplitude/index.d.ts new file mode 100644 index 0000000000..c6a9ff3d2d --- /dev/null +++ b/types/react-amplitude/index.d.ts @@ -0,0 +1,22 @@ +// Type definitions for react-amplitude 0.1 +// Project: https://github.com/rorygarand/react-amplitude +// Definitions by: Raymond Ho +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export interface AmplitudeInstance { + init(apiKey: string, userId?: string, config?: any, cb?: () => void): void; + amplitude(): void; + clearUserProperties(): void; + getSessionId(): void; + identify(idObj: any, cb: () => void): void; + isNewSession(): void; + logEvent(eventType: string, eventProperties: {}, cb: () => void): void; + logEventWithTimestamp(eventType: string, eventProperties: {}, timestamp: number, cb: () => void): void; + resetUserId(): void; + setUserId(userId: string): void; + setUserProperties(userProps: any): void; +} + +declare const Amplitude: AmplitudeInstance; + +export default Amplitude; diff --git a/types/react-amplitude/react-amplitude-tests.ts b/types/react-amplitude/react-amplitude-tests.ts new file mode 100644 index 0000000000..f311f8491f --- /dev/null +++ b/types/react-amplitude/react-amplitude-tests.ts @@ -0,0 +1,2 @@ +import Amplitude from 'react-amplitude'; +Amplitude.init('YOUR_UNIQUE_TRACKING_CODE'); diff --git a/types/react-amplitude/tsconfig.json b/types/react-amplitude/tsconfig.json new file mode 100644 index 0000000000..6f7a8a296e --- /dev/null +++ b/types/react-amplitude/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", + "react-amplitude-tests.ts" + ] +} diff --git a/types/react-amplitude/tslint.json b/types/react-amplitude/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-amplitude/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }