type Signs = { kind: 'a'; a: 3; } | { kind: 'b'; b: 2; } | { kind: 'c'; c: 1; }; interface Opts { low?: number; sign?: T } interface Wrapper { } declare function sepsis(opts: Opts): Wrapper; declare function unwrap(w: Wrapper): T; export const y = sepsis({ low: 1, sign: { kind: 'a', a: 3 }}); // $ExpectType { kind: "a"; a: 3; } export const yun = unwrap(y); // $ExpectType { kind: "a"; a: 3; } export const yone = unwrap(sepsis({ low: 1, sign: { kind: 'a', a: 3 }}));