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 authored and matus-tomlein committed Jul 8, 2024
1 parent 4176956 commit 319f599
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 19 deletions.
5 changes: 1 addition & 4 deletions api-docs/docs/browser-tracker/browser-tracker.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -257,10 +257,7 @@ export type GetBatch = string[];
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
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"
}
15 changes: 0 additions & 15 deletions trackers/browser-tracker/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,21 +49,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 319f599

Please sign in to comment.