forked from microsoft/TypeScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontextualSignatureConditionalTypeInstantiationUsingDefault.types
More file actions
79 lines (65 loc) · 3.03 KB
/
contextualSignatureConditionalTypeInstantiationUsingDefault.types
File metadata and controls
79 lines (65 loc) · 3.03 KB
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
//// [tests/cases/compiler/contextualSignatureConditionalTypeInstantiationUsingDefault.ts] ////
=== contextualSignatureConditionalTypeInstantiationUsingDefault.ts ===
// repro #46310
export interface TypegenDisabled {
"@@xstate/typegen": false;
>"@@xstate/typegen" : false
> : ^^^^^
>false : false
> : ^^^^^
}
export interface TypegenEnabled {
"@@xstate/typegen": true;
>"@@xstate/typegen" : true
> : ^^^^
>true : true
> : ^^^^
}
type ActionFunction<TEvent extends { type: string }> = (event: TEvent) => void;
>ActionFunction : ActionFunction<TEvent>
> : ^^^^^^^^^^^^^^^^^^^^^^
>type : string
> : ^^^^^^
>event : TEvent
> : ^^^^^^
declare function createMachine<
>createMachine : <TTypesMeta extends TypegenEnabled | TypegenDisabled = TypegenDisabled>(config: { types?: TTypesMeta; }, implementations: TTypesMeta extends TypegenEnabled ? ActionFunction<{ type: "test"; }> : ActionFunction<{ type: string; }>) => void
> : ^ ^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^ ^^ ^^ ^^ ^^^^^
TTypesMeta extends TypegenEnabled | TypegenDisabled = TypegenDisabled
>(
config: {
>config : { types?: TTypesMeta | undefined; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
types?: TTypesMeta;
>types : TTypesMeta | undefined
> : ^^^^^^^^^^^^^^^^^^^^^^
},
implementations: TTypesMeta extends TypegenEnabled
>implementations : TTypesMeta extends TypegenEnabled ? ActionFunction<{ type: "test"; }> : ActionFunction<{ type: string; }>
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^
? ActionFunction<{ type: "test" }>
>type : "test"
> : ^^^^^^
: ActionFunction<{ type: string }>
>type : string
> : ^^^^^^
): void;
createMachine({}, (ev) => {
>createMachine({}, (ev) => { ev.type; // should be `string`}) : void
> : ^^^^
>createMachine : <TTypesMeta extends TypegenEnabled | TypegenDisabled = TypegenDisabled>(config: { types?: TTypesMeta; }, implementations: TTypesMeta extends TypegenEnabled ? ActionFunction<{ type: "test"; }> : ActionFunction<{ type: string; }>) => void
> : ^ ^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^ ^^ ^^ ^^ ^^^^^
>{} : {}
> : ^^
>(ev) => { ev.type; // should be `string`} : (ev: { type: string; }) => void
> : ^ ^^^^^^^^^^ ^^^^^^^^^^^^
>ev : { type: string; }
> : ^^^^^^^^ ^^^
ev.type; // should be `string`
>ev.type : string
> : ^^^^^^
>ev : { type: string; }
> : ^^^^^^^^ ^^^
>type : string
> : ^^^^^^
});