File tree 3 files changed +8
-3
lines changed
3 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -96,7 +96,7 @@ export class Scope implements ScopeInterface {
96
96
/**
97
97
* @inheritDoc
98
98
*/
99
- public setUser ( user : User ) : this {
99
+ public setUser ( user : User | null ) : this {
100
100
this . _user = normalize ( user ) ;
101
101
this . _notifyScopeListeners ( ) ;
102
102
return this ;
Original file line number Diff line number Diff line change @@ -57,6 +57,11 @@ describe('Scope', () => {
57
57
scope . setUser ( { id : '1' } ) ;
58
58
expect ( ( scope as any ) . _user ) . toEqual ( { id : '1' } ) ;
59
59
} ) ;
60
+ test ( 'unset' , ( ) => {
61
+ const scope = new Scope ( ) ;
62
+ scope . setUser ( null ) ;
63
+ expect ( ( scope as any ) . _user ) . toEqual ( null ) ;
64
+ } ) ;
60
65
} ) ;
61
66
62
67
describe ( 'level' , ( ) => {
Original file line number Diff line number Diff line change @@ -14,9 +14,9 @@ export interface Scope {
14
14
/**
15
15
* Updates user context information for future events.
16
16
*
17
- * @param user User context object to be set in the current context.
17
+ * @param user User context object to be set in the current context. Pass `null` to unset the user.
18
18
*/
19
- setUser ( user : User ) : this;
19
+ setUser ( user : User | null ) : this;
20
20
21
21
/**
22
22
* Set an object that will be merged sent as tags data with the event.
You can’t perform that action at this time.
0 commit comments