File tree Expand file tree Collapse file tree 3 files changed +8
-3
lines changed Expand file tree Collapse file tree 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 {
9696 /**
9797 * @inheritDoc
9898 */
99- public setUser ( user : User ) : this {
99+ public setUser ( user : User | null ) : this {
100100 this . _user = normalize ( user ) ;
101101 this . _notifyScopeListeners ( ) ;
102102 return this ;
Original file line number Diff line number Diff line change @@ -57,6 +57,11 @@ describe('Scope', () => {
5757 scope . setUser ( { id : '1' } ) ;
5858 expect ( ( scope as any ) . _user ) . toEqual ( { id : '1' } ) ;
5959 } ) ;
60+ test ( 'unset' , ( ) => {
61+ const scope = new Scope ( ) ;
62+ scope . setUser ( null ) ;
63+ expect ( ( scope as any ) . _user ) . toEqual ( null ) ;
64+ } ) ;
6065 } ) ;
6166
6267 describe ( 'level' , ( ) => {
Original file line number Diff line number Diff line change @@ -14,9 +14,9 @@ export interface Scope {
1414 /**
1515 * Updates user context information for future events.
1616 *
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.
1818 */
19- setUser ( user : User ) : this;
19+ setUser ( user : User | null ) : this;
2020
2121 /**
2222 * 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