With StrictNullChecks enabled in TypeScript 2.0, the code
var el: HTMLElement = document.getElementById('element_id');
produces the error
Type 'HTMLElement | null' is not assignable to type 'HTMLElement'.
Type 'null' is not assignable to type 'HTMLElement'.
Why is this and how can I get the code to compile without making el
nullable?