snowplow / snowplow/snowplow-javascript-tracker
Type Signature Mismatch: getUserId() Function Returns void but Actually Returns userId
@igneel64 is already working on this.
Since Sep 27, 2023.
- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.