From 6fe250fdc708d1f490225b1c4ff35f964b46b74b Mon Sep 17 00:00:00 2001 From: Jon Bevan Date: Tue, 10 Dec 2019 19:30:09 +0000 Subject: [PATCH] Add types for timeout option in Analytics constructor (#40706) This is passed to axios to control HTTP request timeouts --- types/analytics-node/analytics-node-tests.ts | 13 ++++++++++++- types/analytics-node/index.d.ts | 3 ++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/types/analytics-node/analytics-node-tests.ts b/types/analytics-node/analytics-node-tests.ts index a7dc5336ec..eef2065293 100644 --- a/types/analytics-node/analytics-node-tests.ts +++ b/types/analytics-node/analytics-node-tests.ts @@ -6,7 +6,18 @@ function testConfig(): void { flushAt: 20, flushInterval: 10000, host: "http://example.com", - enable: true + enable: true, + timeout: 1000, + }); +} + +function testConfigWithStringTimeout(): void { + analytics = new Analytics('YOUR_WRITE_KEY', { + flushAt: 20, + flushInterval: 10000, + host: "http://example.com", + enable: true, + timeout: '1000', }); } diff --git a/types/analytics-node/index.d.ts b/types/analytics-node/index.d.ts index d46fc09189..fba1ffc246 100644 --- a/types/analytics-node/index.d.ts +++ b/types/analytics-node/index.d.ts @@ -43,7 +43,8 @@ declare namespace AnalyticsNode { flushAt?: number, flushInterval?: number, host?: string, - enable?: boolean + enable?: boolean, + timeout?: number | string, }); /* The identify method lets you tie a user to their actions and record