snowplow / snowplow/snowplow-javascript-tracker

Type Signature Mismatch: getUserId() Function Returns void but Actually Returns userId

Open
#1,240 0 comments 1 reaction 1 assignee View on GitHub

@igneel64 is already working on this.

Since Sep 27, 2023.

type:defect
Dominant language
TypeScript
Stars
590
Forks
232
Avg merge
2h 22m
Merged PRs (30d)
3

Description

Describe the bug

The getUserId() function in the BrowserTracker API returns void according to its type signature, even though the function behaves as expected and actually returns the userId.

To Reproduce

To reproduce this issue, you can look at the API definition for BrowserTracker. The getUserId() function is defined as:

getUserId: () => void;
Expected behavior

I would expect the getUserId() function's type signature to reflect its actual behavior by specifying a return type of string, like so:

getUserId: () => string;
Additional context

While the function itself returns the userId as expected when called, the type signature incorrectly indicates a void return type. This discrepancy could lead to confusion and potential type errors in code that relies on this API.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.