Skip to content

Commit 6a195a3

Browse files
committed
fix: allow for userId
1 parent 5b2d920 commit 6a195a3

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

packages/logging/src/analytics-helpers.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@ import type {
77

88
type Timestamp = SegmentTrackParams['timestamp'];
99

10-
export type MongoshAnalyticsIdentity = SegmentIdentifyParams & {
11-
anonymousId: string;
12-
};
10+
export type MongoshAnalyticsIdentity = SegmentIdentifyParams;
1311

1412
export type AnalyticsIdentifyMessage = MongoshAnalyticsIdentity & {
1513
traits: {
@@ -281,7 +279,8 @@ export class ThrottledAnalytics implements MongoshAnalytics {
281279
throw new Error('Identify can only be called once per user session');
282280
}
283281

284-
this.currentUserId = message.userId ?? message.anonymousId;
282+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
283+
this.currentUserId = message.userId ?? message.anonymousId!;
285284

286285
this.restorePromise = this.restoreThrottleState().then((enabled) => {
287286
if (!enabled) {

0 commit comments

Comments
 (0)