Closed
Description
Although not originally mentioned in the laws of union types (#805), I would generally expect a union of types undergoing a transformation to be equivalent to the result of its constituents undergoing the same transformation (distributive law?).
TypeScript Version: 2.5.0-dev.20170626
, presumably any version from the introduction of union types
Code
type x = ({ a: 1 } | { a: 2 })['a'];
// 1 | 2
type y = { [k: string]: 3 }['a'];
// 3
type z = ({ a: 1 } | { a: 2 } | { [k: string]: 3 })['a'];
// ^ Property 'a' does not exist on type ...
Expected behavior:
z
: 1 | 2 | 3
Actual behavior:
Property 'a' does not exist on type ...