type dosen't infered correctly in loop when strictNullChecks
turns on
#30308
Labels
Design Limitation
Constraints of the existing architecture prevent this from being fixed
TypeScript Version: 3.4.0-dev.20190310
Search Terms:
loop
,for
,while
,strictNullChecks
,implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.
Code
Expected behavior: infer
why
asstring
Actual behavior:
why
inferred asany
Playground Link: https://www.typescriptlang.org/play/#src=class%20A%20%7B%20constructor(a%3A%20string)%20%7B%20%7D%20%7D%0D%0Alet%20a%3A%20A%20%7C%20null%20%3D%20null%3B%0D%0Awhile%20(true)%20%7B%0D%0A%20%20%20%20const%20why%20%3D%20a%20%3F%20'a'%20%3A%20'b'%3B%0D%0A%20%20%20%20a%20%3D%20new%20A(why)%3B%0D%0A%7D%0D%0A
Related Issues:
The text was updated successfully, but these errors were encountered: