할당단언

· TYPESCRIPT
타입 단언 // 단언 키워드 - as // Non-null 단언 연산자 = ! // 잘못 사용하면 any처럼 typescript 사용 이유가 없어질 수도 있다. // 1 const el = document.querySelector('body') as HTMLBodyElement // null이 아니고 HTMLBodyElement일 것임을 단언해줌 el.textContent = 'Hello World!' const el2 = document.querySelector('body') el2!.textContent = 'Hello World!' // 또는 non-null 연산자를 이용할 수 있다. const el3 = document.querySelector('.title'); if (el3) { el3.tex..