This fails on the playground, and I believe it also fails on typescript@3.4.0-dev.20190323
TypeScript Version: typescript@3.4.0-dev.20190323
Search Terms: unknown intersection failure types narrow
Code
interfaceTypeA{Name: "TypeA";Value1: "Cool stuff!";}interfaceTypeB{Name: "TypeB";Value2: 0;}typeType=TypeA|TypeB;declarefunctionisType(x: unknown): x is Type;functionWorksProperly(data: Type){if(data.Name==="TypeA"){// data: TypeAconstvalue1=data.Value1;}}functionDoesNotWork(data: unknown){if(isType(data)){if(data.Name==="TypeA"){// data: Type// data should be TypeAconstvalue1=data.Value1;// type error!}}}Expected behavior: in DoesNotWork, data should be TypeA after we can guarentee it is named "TypeA"
Actual behavior:data is still only a Type
Playground Link: Here
Related Issues: I looked through several pages of issues and did not find anything similar.
This fails on the playground, and I believe it also fails on typescript@3.4.0-dev.20190323
TypeScript Version: typescript@3.4.0-dev.20190323
Search Terms: unknown intersection failure types narrow
Code
Expected behavior: in
DoesNotWork,datashould be TypeA after we can guarentee it is named "TypeA"Actual behavior:
datais still only aTypePlayground Link: Here
Related Issues: I looked through several pages of issues and did not find anything similar.