Skip to content

Commit

Permalink
Fix newTracker typing to accurately return null or undefined (fix #1167)
Browse files Browse the repository at this point in the history
  • Loading branch information
igneel64 committed Sep 13, 2023
1 parent 7bbb74a commit 027d539
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 19 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@snowplow/browser-tracker",
"comment": "Fix newTracker typing to accurately return null or undefined (fix #1167)",
"type": "none"
}
],
"packageName": "@snowplow/browser-tracker"
}
5 changes: 1 addition & 4 deletions trackers/browser-tracker/docs/browser-tracker.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -238,10 +238,7 @@ export interface FlushBufferConfiguration {
export function newSession(trackers?: Array<string>): void;

// @public
export function newTracker(trackerId: string, endpoint: string): BrowserTracker;

// @public
export function newTracker(trackerId: string, endpoint: string, configuration: TrackerConfiguration): BrowserTracker;
export function newTracker(trackerId: string, endpoint: string, configuration?: TrackerConfiguration): BrowserTracker | null | undefined;

// @public
export interface PageViewEvent {
Expand Down
15 changes: 0 additions & 15 deletions trackers/browser-tracker/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,21 +43,6 @@ import { version } from '@snowplow/tracker-core';

const state = typeof window !== 'undefined' ? createSharedState() : undefined;

/**
* Initialise a new tracker
*
* @param trackerId - The tracker id - also known as tracker namespace
* @param endpoint - Collector endpoint in the form collector.mysite.com
*/
export function newTracker(trackerId: string, endpoint: string): BrowserTracker;
/**
* Initialise a new tracker
*
* @param trackerId - The tracker id - also known as tracker namespace
* @param endpoint - Collector endpoint in the form collector.mysite.com
* @param configuration - The initialisation options of the tracker
*/
export function newTracker(trackerId: string, endpoint: string, configuration: TrackerConfiguration): BrowserTracker;
/**
* Initialise a new tracker
*
Expand Down

0 comments on commit 027d539

Please sign in to comment.