Home > Enterprise >  Argument type 'string | null' not assignable to parameter type 'string | number | boo
Argument type 'string | null' not assignable to parameter type 'string | number | boo

Time:09-16

Argument of type 'string | null' is not assignable to parameter of type 'string | number | boolean'. Type 'null' is not assignable to type 'string | number | boolean'.ts(2345) (property) User.token: string | nullenter image description hereenter code here

enter image description here

CodePudding user response:

you can explicitly tell ts that this string is not null by the ! bang operator, if you are really sure it will be there

.set('auth', user.token!)
  • Related