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

Commit 592dc1d

Browse files
authored
Change the args of the main methods to be optional (#203)
1 parent bfd0dd0 commit 592dc1d

File tree

4 files changed

+35
-31
lines changed

4 files changed

+35
-31
lines changed

HISTORY.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# 4.0.4 / 2020-09-11
2+
3+
- Change the arguments of the main methods to be optional in the typedef to match the documentation. (#203)
4+
15
# 4.0.3 / 2020-09-11
26

37
- Bump `debug` to a version that fixed security vulnerabilities.

lib/analytics.ts

+15-15
Original file line numberDiff line numberDiff line change
@@ -297,10 +297,10 @@ Analytics.prototype.add = function(integration: {
297297
*/
298298

299299
Analytics.prototype.identify = function(
300-
id: string,
301-
traits: unknown,
302-
options: SegmentOpts,
303-
fn: Function | SegmentOpts
300+
id?: string,
301+
traits?: unknown,
302+
options?: SegmentOpts,
303+
fn?: Function | SegmentOpts
304304
): SegmentAnalytics {
305305
// Argument reshuffling.
306306
/* eslint-disable no-unused-expressions, no-sequences */
@@ -355,9 +355,9 @@ Analytics.prototype.user = function(): object {
355355

356356
Analytics.prototype.group = function(
357357
id: string,
358-
traits: unknown,
359-
options: unknown,
360-
fn: unknown
358+
traits?: unknown,
359+
options?: unknown,
360+
fn?: unknown
361361
): SegmentAnalytics {
362362
/* eslint-disable no-unused-expressions, no-sequences */
363363
if (!arguments.length) return group;
@@ -399,9 +399,9 @@ Analytics.prototype.group = function(
399399

400400
Analytics.prototype.track = function(
401401
event: string,
402-
properties: unknown,
403-
options: unknown,
404-
fn: unknown
402+
properties?: unknown,
403+
options?: unknown,
404+
fn?: unknown
405405
): SegmentAnalytics {
406406
// Argument reshuffling.
407407
/* eslint-disable no-unused-expressions, no-sequences */
@@ -564,11 +564,11 @@ Analytics.prototype.trackSubmit = Analytics.prototype.trackForm = function(
564564
*/
565565

566566
Analytics.prototype.page = function(
567-
category: string,
568-
name: string,
569-
properties: any,
570-
options: any,
571-
fn: unknown
567+
category?: string,
568+
name?: string,
569+
properties?: any,
570+
options?: any,
571+
fn?: unknown
572572
): SegmentAnalytics {
573573
// Argument reshuffling.
574574
/* eslint-disable no-unused-expressions, no-sequences */

lib/index.d.ts

+15-15
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,10 @@ export declare namespace SegmentAnalytics {
130130
* Identify a user by optional `id` and `traits`.
131131
*/
132132
identify(
133-
id: string,
134-
traits: unknown,
135-
options: SegmentOpts,
136-
fn: Function | SegmentOpts
133+
id?: string,
134+
traits?: unknown,
135+
options?: SegmentOpts,
136+
fn?: Function | SegmentOpts
137137
): AnalyticsJS;
138138

139139
/**
@@ -147,19 +147,19 @@ export declare namespace SegmentAnalytics {
147147
*/
148148
group(
149149
id: string,
150-
traits: unknown,
151-
options: unknown,
152-
fn: unknown
150+
traits?: unknown,
151+
options?: unknown,
152+
fn?: unknown
153153
): AnalyticsJS;
154154

155155
/**
156156
* Track an `event` that a user has triggered with optional `properties`.
157157
*/
158158
track(
159159
event: string,
160-
properties: unknown,
161-
options: unknown,
162-
fn: unknown
160+
properties?: unknown,
161+
options?: unknown,
162+
fn?: unknown
163163
): AnalyticsJS;
164164

165165
/**
@@ -220,11 +220,11 @@ export declare namespace SegmentAnalytics {
220220
* `name` and `properties`.
221221
*/
222222
page(
223-
category: string,
224-
name: string,
225-
properties: any,
226-
options: any,
227-
fn: unknown
223+
category?: string,
224+
name?: string,
225+
properties?: any,
226+
options?: any,
227+
fn?: unknown
228228
): AnalyticsJS;
229229

230230
/**

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@segment/analytics.js-core",
33
"author": "Segment <[email protected]>",
4-
"version": "4.0.3",
4+
"version": "4.0.4",
55
"description": "The hassle-free way to integrate analytics into any web application.",
66
"types": "lib/index.d.ts",
77
"keywords": [

0 commit comments

Comments
 (0)