|
| 1 | +=== tests/cases/compiler/contextualSignatureConditionalTypeInstantiationUsingDefault.ts === |
| 2 | +// repro #46310 |
| 3 | + |
| 4 | +export interface TypegenDisabled { |
| 5 | +>TypegenDisabled : Symbol(TypegenDisabled, Decl(contextualSignatureConditionalTypeInstantiationUsingDefault.ts, 0, 0)) |
| 6 | + |
| 7 | + "@@xstate/typegen": false; |
| 8 | +>"@@xstate/typegen" : Symbol(TypegenDisabled["@@xstate/typegen"], Decl(contextualSignatureConditionalTypeInstantiationUsingDefault.ts, 2, 34)) |
| 9 | +} |
| 10 | +export interface TypegenEnabled { |
| 11 | +>TypegenEnabled : Symbol(TypegenEnabled, Decl(contextualSignatureConditionalTypeInstantiationUsingDefault.ts, 4, 1)) |
| 12 | + |
| 13 | + "@@xstate/typegen": true; |
| 14 | +>"@@xstate/typegen" : Symbol(TypegenEnabled["@@xstate/typegen"], Decl(contextualSignatureConditionalTypeInstantiationUsingDefault.ts, 5, 33)) |
| 15 | +} |
| 16 | + |
| 17 | +type ActionFunction<TEvent extends { type: string }> = (event: TEvent) => void; |
| 18 | +>ActionFunction : Symbol(ActionFunction, Decl(contextualSignatureConditionalTypeInstantiationUsingDefault.ts, 7, 1)) |
| 19 | +>TEvent : Symbol(TEvent, Decl(contextualSignatureConditionalTypeInstantiationUsingDefault.ts, 9, 20)) |
| 20 | +>type : Symbol(type, Decl(contextualSignatureConditionalTypeInstantiationUsingDefault.ts, 9, 36)) |
| 21 | +>event : Symbol(event, Decl(contextualSignatureConditionalTypeInstantiationUsingDefault.ts, 9, 56)) |
| 22 | +>TEvent : Symbol(TEvent, Decl(contextualSignatureConditionalTypeInstantiationUsingDefault.ts, 9, 20)) |
| 23 | + |
| 24 | +declare function createMachine< |
| 25 | +>createMachine : Symbol(createMachine, Decl(contextualSignatureConditionalTypeInstantiationUsingDefault.ts, 9, 79)) |
| 26 | + |
| 27 | + TTypesMeta extends TypegenEnabled | TypegenDisabled = TypegenDisabled |
| 28 | +>TTypesMeta : Symbol(TTypesMeta, Decl(contextualSignatureConditionalTypeInstantiationUsingDefault.ts, 11, 31)) |
| 29 | +>TypegenEnabled : Symbol(TypegenEnabled, Decl(contextualSignatureConditionalTypeInstantiationUsingDefault.ts, 4, 1)) |
| 30 | +>TypegenDisabled : Symbol(TypegenDisabled, Decl(contextualSignatureConditionalTypeInstantiationUsingDefault.ts, 0, 0)) |
| 31 | +>TypegenDisabled : Symbol(TypegenDisabled, Decl(contextualSignatureConditionalTypeInstantiationUsingDefault.ts, 0, 0)) |
| 32 | + |
| 33 | +>( |
| 34 | + config: { |
| 35 | +>config : Symbol(config, Decl(contextualSignatureConditionalTypeInstantiationUsingDefault.ts, 13, 2)) |
| 36 | + |
| 37 | + types?: TTypesMeta; |
| 38 | +>types : Symbol(types, Decl(contextualSignatureConditionalTypeInstantiationUsingDefault.ts, 14, 11)) |
| 39 | +>TTypesMeta : Symbol(TTypesMeta, Decl(contextualSignatureConditionalTypeInstantiationUsingDefault.ts, 11, 31)) |
| 40 | + |
| 41 | + }, |
| 42 | + implementations: TTypesMeta extends TypegenEnabled |
| 43 | +>implementations : Symbol(implementations, Decl(contextualSignatureConditionalTypeInstantiationUsingDefault.ts, 16, 4)) |
| 44 | +>TTypesMeta : Symbol(TTypesMeta, Decl(contextualSignatureConditionalTypeInstantiationUsingDefault.ts, 11, 31)) |
| 45 | +>TypegenEnabled : Symbol(TypegenEnabled, Decl(contextualSignatureConditionalTypeInstantiationUsingDefault.ts, 4, 1)) |
| 46 | + |
| 47 | + ? ActionFunction<{ type: "test" }> |
| 48 | +>ActionFunction : Symbol(ActionFunction, Decl(contextualSignatureConditionalTypeInstantiationUsingDefault.ts, 7, 1)) |
| 49 | +>type : Symbol(type, Decl(contextualSignatureConditionalTypeInstantiationUsingDefault.ts, 18, 22)) |
| 50 | + |
| 51 | + : ActionFunction<{ type: string }> |
| 52 | +>ActionFunction : Symbol(ActionFunction, Decl(contextualSignatureConditionalTypeInstantiationUsingDefault.ts, 7, 1)) |
| 53 | +>type : Symbol(type, Decl(contextualSignatureConditionalTypeInstantiationUsingDefault.ts, 19, 22)) |
| 54 | + |
| 55 | +): void; |
| 56 | + |
| 57 | +createMachine({}, (ev) => { |
| 58 | +>createMachine : Symbol(createMachine, Decl(contextualSignatureConditionalTypeInstantiationUsingDefault.ts, 9, 79)) |
| 59 | +>ev : Symbol(ev, Decl(contextualSignatureConditionalTypeInstantiationUsingDefault.ts, 22, 19)) |
| 60 | + |
| 61 | + ev.type; // should be `string` |
| 62 | +>ev.type : Symbol(type, Decl(contextualSignatureConditionalTypeInstantiationUsingDefault.ts, 19, 22)) |
| 63 | +>ev : Symbol(ev, Decl(contextualSignatureConditionalTypeInstantiationUsingDefault.ts, 22, 19)) |
| 64 | +>type : Symbol(type, Decl(contextualSignatureConditionalTypeInstantiationUsingDefault.ts, 19, 22)) |
| 65 | + |
| 66 | +}); |
| 67 | + |
0 commit comments