Home > Mobile >  I want to add local variable in Angular but error occur "type 'string null' is not as
I want to add local variable in Angular but error occur "type 'string null' is not as

Time:03-10

This is an image what exactly, i am facing the problem "type 'string null' is not assignable to type 'string'. typescript" [1]: https://i.stack.imgur.com/aORDB.png

CodePudding user response:

add '?' after type localItem:string?;

CodePudding user response:

I simply add This =>

localItem: string | null;

and finally it's working!

  • Related