From 4e4de4cfd15c75d044546b6e2cb0ff6bb8839651 Mon Sep 17 00:00:00 2001 From: Roland Warmerdam Date: Fri, 11 Sep 2020 17:30:51 -0700 Subject: [PATCH 1/4] Change the args of the main methods to be optional --- lib/analytics.ts | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/lib/analytics.ts b/lib/analytics.ts index 80f7d8b5..d053d1d6 100644 --- a/lib/analytics.ts +++ b/lib/analytics.ts @@ -297,10 +297,10 @@ Analytics.prototype.add = function(integration: { */ Analytics.prototype.identify = function( - id: string, - traits: unknown, - options: SegmentOpts, - fn: Function | SegmentOpts + id?: string, + traits?: unknown, + options?: SegmentOpts, + fn?: Function | SegmentOpts ): SegmentAnalytics { // Argument reshuffling. /* eslint-disable no-unused-expressions, no-sequences */ @@ -355,9 +355,9 @@ Analytics.prototype.user = function(): object { Analytics.prototype.group = function( id: string, - traits: unknown, - options: unknown, - fn: unknown + traits?: unknown, + options?: unknown, + fn?: unknown ): SegmentAnalytics { /* eslint-disable no-unused-expressions, no-sequences */ if (!arguments.length) return group; @@ -399,9 +399,9 @@ Analytics.prototype.group = function( Analytics.prototype.track = function( event: string, - properties: unknown, - options: unknown, - fn: unknown + properties?: unknown, + options?: unknown, + fn?: unknown ): SegmentAnalytics { // Argument reshuffling. /* eslint-disable no-unused-expressions, no-sequences */ @@ -564,11 +564,11 @@ Analytics.prototype.trackSubmit = Analytics.prototype.trackForm = function( */ Analytics.prototype.page = function( - category: string, - name: string, - properties: any, - options: any, - fn: unknown + category?: string, + name?: string, + properties?: any, + options?: any, + fn?: unknown ): SegmentAnalytics { // Argument reshuffling. /* eslint-disable no-unused-expressions, no-sequences */ From cd377ba4cb5a16a3f44668fe734161164c6d9ddc Mon Sep 17 00:00:00 2001 From: Roland Warmerdam Date: Fri, 11 Sep 2020 17:44:58 -0700 Subject: [PATCH 2/4] Update typedef --- lib/index.d.ts | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/lib/index.d.ts b/lib/index.d.ts index d78c7a90..855a58af 100644 --- a/lib/index.d.ts +++ b/lib/index.d.ts @@ -130,10 +130,10 @@ export declare namespace SegmentAnalytics { * Identify a user by optional `id` and `traits`. */ identify( - id: string, - traits: unknown, - options: SegmentOpts, - fn: Function | SegmentOpts + id?: string, + traits?: unknown, + options?: SegmentOpts, + fn?: Function | SegmentOpts ): AnalyticsJS; /** @@ -147,9 +147,9 @@ export declare namespace SegmentAnalytics { */ group( id: string, - traits: unknown, - options: unknown, - fn: unknown + traits?: unknown, + options?: unknown, + fn?: unknown ): AnalyticsJS; /** @@ -157,9 +157,9 @@ export declare namespace SegmentAnalytics { */ track( event: string, - properties: unknown, - options: unknown, - fn: unknown + properties?: unknown, + options?: unknown, + fn?: unknown ): AnalyticsJS; /** @@ -220,11 +220,11 @@ export declare namespace SegmentAnalytics { * `name` and `properties`. */ page( - category: string, - name: string, - properties: any, - options: any, - fn: unknown + category?: string, + name?: string, + properties?: any, + options?: any, + fn?: unknown ): AnalyticsJS; /** From a455f73a29e6ce62f4eea69761fc79f025df0b78 Mon Sep 17 00:00:00 2001 From: Roland Warmerdam Date: Fri, 11 Sep 2020 17:49:51 -0700 Subject: [PATCH 3/4] Bump version --- HISTORY.md | 4 ++++ package.json | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/HISTORY.md b/HISTORY.md index 73c4035b..7aa4d98a 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,3 +1,7 @@ +# 4.0.4 / 2020-09-11 + +- Change the arguments of the main methods to be optional in the typedef to match the documentation. (#202) + # 4.0.3 / 2020-09-11 - Bump `debug` to a version that fixed security vulnerabilities. diff --git a/package.json b/package.json index af078661..043975f9 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@segment/analytics.js-core", "author": "Segment ", - "version": "4.0.3", + "version": "4.0.4", "description": "The hassle-free way to integrate analytics into any web application.", "types": "lib/index.d.ts", "keywords": [ From f93ca381631cbef82938c8c502731c3a80a82bb2 Mon Sep 17 00:00:00 2001 From: Roland Warmerdam Date: Fri, 11 Sep 2020 17:51:39 -0700 Subject: [PATCH 4/4] Fix link --- HISTORY.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/HISTORY.md b/HISTORY.md index 7aa4d98a..7bf7d684 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,6 +1,6 @@ # 4.0.4 / 2020-09-11 -- Change the arguments of the main methods to be optional in the typedef to match the documentation. (#202) +- Change the arguments of the main methods to be optional in the typedef to match the documentation. (#203) # 4.0.3 / 2020-09-11