TypeScript Version: 2.2.2
Code
On playground
typeEg={foo: string,bar: number}typeVariantRec<T>={[KinkeyofT]: {type: K,value: T[K]}}typeAlpha1=VariantRec<Eg>[keyofEg]typeVariantType<T>=VariantRec<T>[keyofT]typeAlpha2=VariantType<Eg>constassignable12: Alpha2=nullasAlpha1constassignable21: Alpha1=nullasAlpha2Expected behavior:
Types Alpha1 and Alpha2 should be the identical.
Actual behavior:
Alpha2 incorrectly becomes: { type: 'foo' | 'bar', value: string | number }
It should be: { type: 'foo', value: string } | { type: 'bar', value: number }
TypeScript Version: 2.2.2
Code
On playground
Expected behavior:
Types
Alpha1andAlpha2should be the identical.Actual behavior:
Alpha2incorrectly becomes:{ type: 'foo' | 'bar', value: string | number }It should be:
{ type: 'foo', value: string } | { type: 'bar', value: number }