TypeScript Version: nightly (2.1.0-dev.20161008)
Code
(Compile with --strictNullChecks)
let n: number
doit(() => {
n = 0
})
n! + 1
function doit(action) { action() }
Expected behavior:
No error
Actual behavior:
a.ts(5,1): error TS2454: Variable 'n' is used before being assigned.
The problem is fixed by using let n: number | undefined, but it's not obvious that that's the solution, and it would be intuitive for the ! operator to work in this situation.
Aside: I don't see the ! operator documented in the handbook.