56f81075f9
* Properly check whether union type contains only primitive types * Add regression test * Remove 'export' modifier from test
21 lines
828 B
Plaintext
21 lines
828 B
Plaintext
=== tests/cases/compiler/primitiveUnionDetection.ts ===
|
|
// Repro from #46624
|
|
|
|
type Kind = "one" | "two" | "three";
|
|
>Kind : Kind
|
|
|
|
declare function getInterfaceFromString<T extends Kind>(options?: { type?: T } & { type?: Kind }): T;
|
|
>getInterfaceFromString : <T extends Kind>(options?: ({ type?: T | undefined; } & { type?: Kind | undefined; }) | undefined) => T
|
|
>options : ({ type?: T | undefined; } & { type?: Kind | undefined; }) | undefined
|
|
>type : T | undefined
|
|
>type : Kind | undefined
|
|
|
|
const result = getInterfaceFromString({ type: 'two' });
|
|
>result : "two"
|
|
>getInterfaceFromString({ type: 'two' }) : "two"
|
|
>getInterfaceFromString : <T extends Kind>(options?: ({ type?: T | undefined; } & { type?: Kind | undefined; }) | undefined) => T
|
|
>{ type: 'two' } : { type: "two"; }
|
|
>type : "two"
|
|
>'two' : "two"
|
|
|