Closed
Description
Typescript Version: 3.1.1
I found a strange behavior about strictNullChecks. Why?
It works
let a: string | null = null;
(() => a = 'str')();
console.log(a.length);
Not working
let a: string | null = null;
const f = (() => a = 'str');
f();
console.log(a.length);
$ tsc --strictNullChecks ng.ts
ng.ts:4:13 - error TS2531: Object is possibly 'null'.
4 console.log(a.length);
~