1// repro from #22093 2enum A { one = "one", two = "two" }; 3enum B { foo = "foo", bar = "bar" }; 4 5type C = A | B.foo; 6type D = A | "foo"; 7 8class List<T> 9{ 10 private readonly items: T[] = []; 11} 12 13function asList<T>(arg: T): List<T> { return new List(); } 14 15// TypeScript incorrectly infers the return type of "asList(x)" to be "List<A | B>" 16// The correct type is "List<A | B.foo>" 17function fn1(x: C): List<C> { return asList(x); } 18 19// If we use the literal "foo" instead of B.foo, the correct type is inferred 20function fn2(x: D): List<D> { return asList(x); }