Type 'string | null | undefined' is not assignable to type 'string | null'. Type 'undefined' is not assignable to type 'string | null'.ts(2322) code example
Example 1: 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') || '{}');
Example 2: Type 'string | undefined' is not assignable to type 'string'.
let name1:string = person.name!;
// ^ note the exclamation mark here