<!-- BUGS: Please use this template. --> <!-- QUESTIONS: This is not a general support forum! Ask Qs at http://stackoverflow.com/questions/tagged/typescript --> <!-- SUGGESTIONS: See https://github.com/Microsoft/TypeScript-wiki/blob/master/Writing-Good-Design-Proposals.md --> **TypeScript Version:** 2.1.1 / nightly (2.2.0-dev.201xxxxx) 2.1.4 **Code** ```ts let f:string | null = 'xx'; let v:string; if(f){ [].forEach(item=>{ v = f; }) } ``` **Expected behavior:** Compile successfully **Actual behavior:** > test.ts(5,9): error TS2322: Type 'string | null' is not assignable to type 'string'. Type 'null' is not assignable to type 'string'.
Activity
HerringtonDarkholme commentedon Dec 23, 2016
#9998