TS2.9 narrows MyType|undefined
to undefined (regression from 2.8)
#25268
Labels
Working as Intended
The behavior described is the intended behavior; this is not a bug
TypeScript Version:
Search Terms:
Code
Expected behavior: the code compiles
Actual behavior: since TypeScript 2.9, the compilations fails with:
Playground Link: http://www.typescriptlang.org/play/#src=declare%20const%20AddressSymbol%3A%20unique%20symbol%3B%0D%0Atype%20AddressString%20%3D%20typeof%20AddressSymbol%20%26%20string%3B%0D%0A%0D%0Afunction%20printout(data%3A%20AddressString%20%7C%20undefined)%20%7B%0D%0A%20%20console.log(data)%3B%0D%0A%7D%0D%0A%0D%0Aprintout(undefined)%3B%20%2F%2F%20ok%0D%0A%0D%0Aconst%20a%20%3D%20%22foo%22%20as%20AddressString%3B%0D%0Aprintout(a)%3B%20%2F%2F%20broken%20since%20TS%202.9
Related Issues: #25179
The text was updated successfully, but these errors were encountered: