TypeScript · Narrowing and unions
Non-null assertion
Tells the compiler a value is not null. It performs no runtime check, so use it only when the fact is guaranteed.
Syntax
value!Example
Example
const input = document.querySelector("input");
console.log(input!.tagName);More in this group
Learn this in the course
Reference pages are the quick answer. The course explains the why, shows the full example and ends with a challenge.