let a = document.getElementById('hello'); if (a) { a.style.width = '100px'; } ! is used when you know that element cannot be null const a = document.getElementById('hello'); a!.style.width = '100px';