Sunday, 6 February 2022

Error: Type 'HTMLElement | null' is not assignable to type 'HTMLElement' ts(2322)

Add ! (exclamation mark) after a property/variable name. This feature is called “Non-null assertion operator“, basically it means that when you add the exclamation mark after a property/value, you are telling TypeScript that you are certain that value is not null or undefined.

No comments:

Post a Comment