1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
|
=== tests/cases/compiler/coAndContraVariantInferences5.ts ===
type Thing = 'a' | 'b';
>Thing : "a" | "b"
function f(
>f : (options: SelectOptions<Thing>, onChange: (status: Thing | null) => void) => void
options: SelectOptions<Thing>,
>options : SelectOptions<Thing>
onChange: (status: Thing | null) => void,
>onChange : (status: Thing | null) => void
>status : Thing | null
): void {
select({
>select({ options, onChange, }) : void
>select : <KeyT extends string>(props: SelectProps<KeyT>) => void
>{ options, onChange, } : { options: SelectOptions<Thing>; onChange: (status: Thing | null) => void; }
options,
>options : SelectOptions<Thing>
onChange,
>onChange : (status: Thing | null) => void
});
}
declare function select<KeyT extends string>(props: SelectProps<KeyT>): void;
>select : <KeyT extends string>(props: SelectProps<KeyT>) => void
>props : SelectProps<KeyT>
type SelectProps<KeyT extends string> = {
>SelectProps : SelectProps<KeyT>
options?: SelectOptions<KeyT>;
>options : SelectOptions<KeyT> | undefined
onChange: (key: KeyT) => void;
>onChange : (key: KeyT) => void
>key : KeyT
};
type SelectOptions<KeyT extends string> =
>SelectOptions : SelectOptions<KeyT>
| Array<{key: KeyT}>
>key : KeyT
| Array<KeyT>;
|