Unsound type inference with in
operator on union
#34975
Labels
Working as Intended
The behavior described is the intended behavior; this is not a bug
TypeScript Version: 3.8.0-dev.20191105
Search Terms: in operator, union, unsound
Code
Expected behavior: Type of
union
should be narrowed toUnion & { foo: any }
, or not narrowed.Actual behavior: Type of
union
is narrowed to{ foo: string, foo2: string }
despite having nofoo2
property.Playground Link: http://www.typescriptlang.org/play/?ts=3.8.0-dev.20191105&ssl=1&ssc=1&pln=8&pc=1#code/C4TwDgpgBAqgdgSwPZygXigbygMyUgLigGdgAnBOAcwG5d8AmI0i6qAXygB8soAjAIZkicAK4BbPhDJ1BZJlDGTpHGgCg1AYxSkooxCiLxkqDNjyEoAcgFWANPyFEAjA7kKGqjQhwAKKxZWUJR6BnAAlFhqUDGhJnQA9AnBcNpkZBCawAA2ICk40hkAJlACxLwWzOSUVA4WCiw1HGrsakA
The text was updated successfully, but these errors were encountered: