Skip to content

Commit

Permalink
refactor: refactor api type declarations
Browse files Browse the repository at this point in the history
  • Loading branch information
MoumitaM committed Sep 6, 2024
1 parent 45d30f0 commit 514e568
Showing 1 changed file with 10 additions and 18 deletions.
28 changes: 10 additions & 18 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,64 +57,56 @@ export interface constructorOptions {
export type apiCallback = () => void;
export type FlushCallback = (error?: Error, data?: any) => void;

type IdentityOptions =
| { userId: string; anonymousId?: string }
| { userId?: string; anonymousId: string };

export type IdentifyParams = {
userId?: string;
anonymousId?: string;
context?: apiObject;
traits?: apiObject;
integrations?: integrationOptions;
timestamp?: Date;
};
} & IdentityOptions;

export type PageParams = {
name: string;
userId?: string;
anonymousId?: string;
context?: apiObject;
properties?: apiObject;
integrations?: integrationOptions;
timestamp?: Date;
};
} & IdentityOptions;

export type TrackParams = {
event: string;
userId?: string;
anonymousId?: string;
context?: apiObject;
properties?: apiObject;
integrations?: integrationOptions;
timestamp?: Date;
};
} & IdentityOptions;

export type GroupParams = {
groupId: string;
userId?: string;
anonymousId?: string;
context?: apiObject;
traits?: apiObject;
integrations?: integrationOptions;
timestamp?: Date;
};
} & IdentityOptions;

export type ScreenParams = {
name: string;
userId?: string;
anonymousId?: string;
context?: apiObject;
properties?: apiObject;
integrations?: integrationOptions;
timestamp?: Date;
};
} & IdentityOptions;

export type AliasParams = {
previousId: string;
userId?: string;
anonymousId?: string;
context?: apiObject;
properties?: apiObject;
integrations?: integrationOptions;
timestamp?: Date;
};
} & IdentityOptions;

declare class Analytics {
/**
Expand Down

0 comments on commit 514e568

Please sign in to comment.