The exclamation mark (!) is the non-null assertion operator in TypeScript. It tells the compiler that we are sure that the value returned by document.getElementById('root') is not null or undefined.
const dom = document.getElementById('root')! // dom is not null
'✘✘✘ Javascript > Typescript' 카테고리의 다른 글
[type] keyof, typeof 를 사용해 type 지정 (0) | 2023.04.08 |
---|---|
Constructor overloading with default (0) | 2022.06.25 |
댓글