Skip to content
This repository was archived by the owner on Sep 3, 2022. It is now read-only.

Commit 7754d3c

Browse files
committed
explicitly defines call patterns for page method
1 parent 174fc20 commit 7754d3c

File tree

1 file changed

+72
-5
lines changed

1 file changed

+72
-5
lines changed

lib/index.d.ts

Lines changed: 72 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@ export declare namespace SegmentAnalytics {
6464
integrations?: SegmentIntegration;
6565
}
6666

67+
type PageProperties = Object;
68+
type PageOptions = Object;
69+
type PageCallback = () => void;
70+
6771
interface AnalyticsJS {
6872
Integrations: { [name: string]: unknown };
6973
require: any;
@@ -215,16 +219,79 @@ export declare namespace SegmentAnalytics {
215219
properties?: any
216220
): AnalyticsJS;
217221

222+
218223
/**
219-
* Trigger a pageview, labeling the current page with an optional `category`,
220-
* `name` and `properties`.
224+
* Trigger a pageview.
221225
*/
222226
page(
223227
category: string,
224228
name: string,
225-
properties: any,
226-
options: any,
227-
fn: unknown
229+
properties: PageProperties,
230+
options: PageOptions,
231+
callback: PageCallback,
232+
): AnalyticsJS;
233+
234+
/**
235+
* Trigger a pageview.
236+
*/
237+
page(
238+
category: string,
239+
name: string,
240+
properties: PageProperties,
241+
callback: PageCallback,
242+
): AnalyticsJS;
243+
244+
/**
245+
* Trigger a pageview.
246+
*/
247+
page(
248+
category: string,
249+
name: string,
250+
callback: PageCallback,
251+
): AnalyticsJS;
252+
253+
/**
254+
* Trigger a pageview.
255+
*/
256+
page(
257+
name: string,
258+
properties: PageProperties,
259+
options: PageOptions,
260+
callback: PageCallback,
261+
): AnalyticsJS;
262+
263+
/**
264+
* Trigger a pageview.
265+
*/
266+
page(
267+
name: string,
268+
properties: PageProperties,
269+
callback: PageCallback,
270+
): AnalyticsJS;
271+
272+
/**
273+
* Trigger a pageview.
274+
*/
275+
page(
276+
name: string,
277+
callback: PageCallback,
278+
): AnalyticsJS;
279+
280+
/**
281+
* Trigger a pageview.
282+
*/
283+
page(
284+
properties: PageProperties,
285+
options: PageOptions,
286+
callback: PageCallback,
287+
): AnalyticsJS;
288+
289+
/**
290+
* Trigger a pageview.
291+
*/
292+
page(
293+
properties: PageProperties,
294+
callback: PageCallback,
228295
): AnalyticsJS;
229296

230297
/**

0 commit comments

Comments
 (0)