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 80 81 82 83 84 85 86 87 88 89 90 91 92
|
=== tests/cases/conformance/types/typeRelationships/typeInference/genericContextualTypes3.ts ===
type LowInfer<T> = T & {};
>LowInfer : LowInfer<T>
type PartialAssigner<TContext, TKey extends keyof TContext> = (
>PartialAssigner : PartialAssigner<TContext, TKey>
context: TContext
>context : TContext
) => TContext[TKey];
type PropertyAssigner<TContext> = {
>PropertyAssigner : PropertyAssigner<TContext>
[K in keyof TContext]?: PartialAssigner<TContext, K> | TContext[K];
};
type Meta<TContext> = {
>Meta : Meta<TContext>
action: (ctx: TContext) => void
>action : (ctx: TContext) => void
>ctx : TContext
}
interface AssignAction<TContext> {
type: "xstate.assign";
>type : "xstate.assign"
(arg: TContext, meta: Meta<TContext>): void;
>arg : TContext
>meta : Meta<TContext>
}
declare function assign<TContext>(
>assign : <TContext>(assignment: PropertyAssigner<LowInfer<TContext>>) => AssignAction<TContext>
assignment: PropertyAssigner<LowInfer<TContext>>
>assignment : PropertyAssigner<LowInfer<TContext>>
): AssignAction<TContext>;
type Config<TContext> = {
>Config : Config<TContext>
context: TContext;
>context : TContext
entry?: AssignAction<TContext>;
>entry : AssignAction<TContext> | undefined
};
declare function createMachine<TContext>(config: Config<TContext>): void;
>createMachine : <TContext>(config: Config<TContext>) => void
>config : Config<TContext>
createMachine<{ count: number }>({
>createMachine<{ count: number }>({ context: { count: 0, }, entry: assign({ count: (ctx: { count: number }) => ++ctx.count, }),}) : void
>createMachine : <TContext>(config: Config<TContext>) => void
>count : number
>{ context: { count: 0, }, entry: assign({ count: (ctx: { count: number }) => ++ctx.count, }),} : { context: { count: number; }; entry: AssignAction<{ count: number; }>; }
context: {
>context : { count: number; }
>{ count: 0, } : { count: number; }
count: 0,
>count : number
>0 : 0
},
entry: assign({
>entry : AssignAction<{ count: number; }>
>assign({ count: (ctx: { count: number }) => ++ctx.count, }) : AssignAction<{ count: number; }>
>assign : <TContext>(assignment: PropertyAssigner<LowInfer<TContext>>) => AssignAction<TContext>
>{ count: (ctx: { count: number }) => ++ctx.count, } : { count: (ctx: { count: number;}) => number; }
count: (ctx: { count: number }) => ++ctx.count,
>count : (ctx: { count: number;}) => number
>(ctx: { count: number }) => ++ctx.count : (ctx: { count: number;}) => number
>ctx : { count: number; }
>count : number
>++ctx.count : number
>ctx.count : number
>ctx : { count: number; }
>count : number
}),
});
|