bugsnag / bugsnag-js

JavaScript error handling tool for BugSnag. Monitor and report JavaScript bugs & errors.
https://docs.bugsnag.com/platforms/javascript
MIT License
856 stars 251 forks source link

Corrected setUser TS interface to allow for null arguments #2262

Open agrzegorzewski opened 17 hours ago

agrzegorzewski commented 17 hours ago

Goal

The setUser method in the notifier can take null as a parameter to clear the value from the user object. The current TypeScript interface only allows for string | undefined, which causes type errors when trying to pass null as a parameter.

BugSnag documentation mentions passing null to setUser as a possibility.

Design

The type definition has been updated to accurately reflect the capabilities od the notifier.

Changeset

The type definition for setUser's arguments has been extended from id?: string to id?: string | null.

Testing

The change was tested manually.

mclack commented 17 hours ago

Highlighted in https://github.com/bugsnag/bugsnag-js/issues/1259#issuecomment-2465795944

github-actions[bot] commented 17 hours ago

@bugsnag/browser bundle size diff

Minified Minfied + Gzipped
Before 45.89 kB 13.78 kB
After 45.89 kB 13.78 kB
± No change No change

code coverage diff

<_temporarily disabled_>

Generated by :no_entry_sign: dangerJS against 5c92566dadae052f2b515be90f98ee35d7edcfcb