Skip to content

Commit

Permalink
fix: make properties optional
Browse files Browse the repository at this point in the history
  • Loading branch information
christianmat committed Nov 28, 2024
1 parent 3ba964a commit 30910fe
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/blue-emus-deliver.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'trench-js': patch
---

Make all `properties` optional
8 changes: 4 additions & 4 deletions packages/trench-js/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,11 @@ class Trench {
}
}

track(event: string, properties: Record<string, unknown>) {
track(event: string, properties?: Record<string, unknown>) {
this.analytics.track(event, properties);
}

page(properties: Record<string, unknown>) {
page(properties?: Record<string, unknown>) {
const mergedProperties = {
referrer: typeof document !== 'undefined' ? document.referrer : undefined,
userAgent: typeof navigator !== 'undefined' ? navigator.userAgent : undefined,
Expand All @@ -95,11 +95,11 @@ class Trench {
this.analytics.page(mergedProperties);
}

identify(userId: string, traits: Record<string, unknown>) {
identify(userId: string, traits?: Record<string, unknown>) {
this.analytics.identify(userId, traits);
}

group(groupId: string, traits: Record<string, unknown>) {
group(groupId: string, traits?: Record<string, unknown>) {
// @ts-ignore
this.analytics.plugins.trench.group(groupId, traits);
}
Expand Down

0 comments on commit 30910fe

Please sign in to comment.