Answers for "type error: type 'string | null | undefined' is not assignable to type 'string | undefined'. type 'null' is not assignable to type 'string | undefined'."

12

Argument of type 'string | null' is not assignable to parameter of type 'string'. Type 'null' is not assignable to type 'string'

this.currentUser = JSON.parse(localStorage.getItem('currentUser') || '{}');
Posted by: Guest on December-18-2020
1

Type 'string | undefined' is not assignable to type 'string'.

let name1:string = person.name!; 
//                            ^ note the exclamation mark here
Posted by: Guest on April-02-2021

Code answers related to "type error: type 'string | null | undefined' is not assignable to type 'string | undefined'. type 'null' is not assignable to type 'string | undefined'."

Code answers related to "TypeScript"

Browse Popular Code Answers by Language