Skip to content

Commit 53047af

Browse files
committed
Don't skip generic functions when arity is not alright
1 parent 07e36ce commit 53047af

File tree

5 files changed

+392
-5
lines changed

5 files changed

+392
-5
lines changed

src/compiler/checker.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37002,9 +37002,12 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
3700237002
// use the resolvingSignature singleton to indicate that we deferred processing. This result will be
3700337003
// propagated out and eventually turned into silentNeverType (a type that is assignable to anything and
3700437004
// from which we never make inferences).
37005-
if (checkMode & CheckMode.SkipGenericFunctions && !node.typeArguments && callSignatures.some(isGenericFunctionReturningFunction)) {
37006-
skippedGenericFunction(node, checkMode);
37007-
return resolvingSignature;
37005+
if (checkMode & CheckMode.SkipGenericFunctions && !node.typeArguments) {
37006+
const args = getEffectiveCallArguments(node);
37007+
if (some(callSignatures, candidate => hasCorrectArity(node, args, candidate) && isGenericFunctionReturningFunction(candidate))) {
37008+
skippedGenericFunction(node, checkMode);
37009+
return resolvingSignature;
37010+
}
3700837011
}
3700937012
// If the function is explicitly marked with `@class`, then it must be constructed.
3701037013
if (callSignatures.some(sig => isInJSFile(sig.declaration) && !!getJSDocClassTag(sig.declaration!))) {

tests/baselines/reference/genericCallAtYieldExpressionInGenericCall2.types

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ fn(function* <T>(queue: Enqueue<T>, value: T) {
7070
> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
7171
>fn : <Eff extends Effect, AEff, Args extends Array<any>>(body: (...args: Args) => Generator<Eff, AEff, any>) => (...args: Args) => any
7272
> : ^ ^^^^^^^^^ ^^ ^^ ^^^^^^^^^ ^^ ^^ ^^^^^
73-
>function* <T>(queue: Enqueue<T>, value: T) { yield* offer(queue, value);} : <T>(queue: Enqueue<T>, value: T) => Generator<never, void, never>
74-
> : ^ ^^ ^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
73+
>function* <T>(queue: Enqueue<T>, value: T) { yield* offer(queue, value);} : <T>(queue: Enqueue<T>, value: T) => Generator<any, void, any>
74+
> : ^ ^^ ^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
7575
>queue : Enqueue<T>
7676
> : ^^^^^^^^^^
7777
>value : T
Lines changed: 181 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,181 @@
1+
//// [tests/cases/compiler/genericCallAtYieldExpressionInGenericCall3.ts] ////
2+
3+
=== genericCallAtYieldExpressionInGenericCall3.ts ===
4+
type ReadonlyRecord<in out K extends string | symbol, out A> = {
5+
>ReadonlyRecord : Symbol(ReadonlyRecord, Decl(genericCallAtYieldExpressionInGenericCall3.ts, 0, 0))
6+
>K : Symbol(K, Decl(genericCallAtYieldExpressionInGenericCall3.ts, 0, 20))
7+
>A : Symbol(A, Decl(genericCallAtYieldExpressionInGenericCall3.ts, 0, 53))
8+
9+
readonly [P in K]: A;
10+
>P : Symbol(P, Decl(genericCallAtYieldExpressionInGenericCall3.ts, 1, 12))
11+
>K : Symbol(K, Decl(genericCallAtYieldExpressionInGenericCall3.ts, 0, 20))
12+
>A : Symbol(A, Decl(genericCallAtYieldExpressionInGenericCall3.ts, 0, 53))
13+
14+
};
15+
16+
type Success<T> = T extends Micro<infer _A, infer _E, infer _R> ? _A : never;
17+
>Success : Symbol(Success, Decl(genericCallAtYieldExpressionInGenericCall3.ts, 2, 2))
18+
>T : Symbol(T, Decl(genericCallAtYieldExpressionInGenericCall3.ts, 4, 13))
19+
>T : Symbol(T, Decl(genericCallAtYieldExpressionInGenericCall3.ts, 4, 13))
20+
>Micro : Symbol(Micro, Decl(genericCallAtYieldExpressionInGenericCall3.ts, 8, 1))
21+
>_A : Symbol(_A, Decl(genericCallAtYieldExpressionInGenericCall3.ts, 4, 39))
22+
>_E : Symbol(_E, Decl(genericCallAtYieldExpressionInGenericCall3.ts, 4, 49))
23+
>_R : Symbol(_R, Decl(genericCallAtYieldExpressionInGenericCall3.ts, 4, 59))
24+
>_A : Symbol(_A, Decl(genericCallAtYieldExpressionInGenericCall3.ts, 4, 39))
25+
26+
interface MicroIterator<T extends Micro<any, any, any>> {
27+
>MicroIterator : Symbol(MicroIterator, Decl(genericCallAtYieldExpressionInGenericCall3.ts, 4, 77))
28+
>T : Symbol(T, Decl(genericCallAtYieldExpressionInGenericCall3.ts, 6, 24))
29+
>Micro : Symbol(Micro, Decl(genericCallAtYieldExpressionInGenericCall3.ts, 8, 1))
30+
31+
next(...args: ReadonlyArray<any>): IteratorResult<T, Success<T>>;
32+
>next : Symbol(MicroIterator.next, Decl(genericCallAtYieldExpressionInGenericCall3.ts, 6, 57))
33+
>args : Symbol(args, Decl(genericCallAtYieldExpressionInGenericCall3.ts, 7, 7))
34+
>ReadonlyArray : Symbol(ReadonlyArray, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2016.array.include.d.ts, --, --) ... and 3 more)
35+
>IteratorResult : Symbol(IteratorResult, Decl(lib.es2015.iterable.d.ts, --, --))
36+
>T : Symbol(T, Decl(genericCallAtYieldExpressionInGenericCall3.ts, 6, 24))
37+
>Success : Symbol(Success, Decl(genericCallAtYieldExpressionInGenericCall3.ts, 2, 2))
38+
>T : Symbol(T, Decl(genericCallAtYieldExpressionInGenericCall3.ts, 6, 24))
39+
}
40+
41+
interface Micro<out A, out E = never, out R = never> {
42+
>Micro : Symbol(Micro, Decl(genericCallAtYieldExpressionInGenericCall3.ts, 8, 1))
43+
>A : Symbol(A, Decl(genericCallAtYieldExpressionInGenericCall3.ts, 10, 16))
44+
>E : Symbol(E, Decl(genericCallAtYieldExpressionInGenericCall3.ts, 10, 22))
45+
>R : Symbol(R, Decl(genericCallAtYieldExpressionInGenericCall3.ts, 10, 37))
46+
47+
_A: A;
48+
>_A : Symbol(Micro._A, Decl(genericCallAtYieldExpressionInGenericCall3.ts, 10, 54))
49+
>A : Symbol(A, Decl(genericCallAtYieldExpressionInGenericCall3.ts, 10, 16))
50+
51+
_E: E;
52+
>_E : Symbol(Micro._E, Decl(genericCallAtYieldExpressionInGenericCall3.ts, 11, 8))
53+
>E : Symbol(E, Decl(genericCallAtYieldExpressionInGenericCall3.ts, 10, 22))
54+
55+
_R: R;
56+
>_R : Symbol(Micro._R, Decl(genericCallAtYieldExpressionInGenericCall3.ts, 12, 8))
57+
>R : Symbol(R, Decl(genericCallAtYieldExpressionInGenericCall3.ts, 10, 37))
58+
59+
[Symbol.iterator](): MicroIterator<Micro<A, E, R>>;
60+
>[Symbol.iterator] : Symbol(Micro[Symbol.iterator], Decl(genericCallAtYieldExpressionInGenericCall3.ts, 13, 8))
61+
>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --))
62+
>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2019.symbol.d.ts, --, --))
63+
>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --))
64+
>MicroIterator : Symbol(MicroIterator, Decl(genericCallAtYieldExpressionInGenericCall3.ts, 4, 77))
65+
>Micro : Symbol(Micro, Decl(genericCallAtYieldExpressionInGenericCall3.ts, 8, 1))
66+
>A : Symbol(A, Decl(genericCallAtYieldExpressionInGenericCall3.ts, 10, 16))
67+
>E : Symbol(E, Decl(genericCallAtYieldExpressionInGenericCall3.ts, 10, 22))
68+
>R : Symbol(R, Decl(genericCallAtYieldExpressionInGenericCall3.ts, 10, 37))
69+
}
70+
71+
declare function runPromise<A, E>(effect: Micro<A, E>): Promise<A>;
72+
>runPromise : Symbol(runPromise, Decl(genericCallAtYieldExpressionInGenericCall3.ts, 15, 1))
73+
>A : Symbol(A, Decl(genericCallAtYieldExpressionInGenericCall3.ts, 17, 28))
74+
>E : Symbol(E, Decl(genericCallAtYieldExpressionInGenericCall3.ts, 17, 30))
75+
>effect : Symbol(effect, Decl(genericCallAtYieldExpressionInGenericCall3.ts, 17, 34))
76+
>Micro : Symbol(Micro, Decl(genericCallAtYieldExpressionInGenericCall3.ts, 8, 1))
77+
>A : Symbol(A, Decl(genericCallAtYieldExpressionInGenericCall3.ts, 17, 28))
78+
>E : Symbol(E, Decl(genericCallAtYieldExpressionInGenericCall3.ts, 17, 30))
79+
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2018.promise.d.ts, --, --))
80+
>A : Symbol(A, Decl(genericCallAtYieldExpressionInGenericCall3.ts, 17, 28))
81+
82+
declare function gen<Eff extends Micro<any, any, any>, AEff>(
83+
>gen : Symbol(gen, Decl(genericCallAtYieldExpressionInGenericCall3.ts, 17, 67))
84+
>Eff : Symbol(Eff, Decl(genericCallAtYieldExpressionInGenericCall3.ts, 19, 21))
85+
>Micro : Symbol(Micro, Decl(genericCallAtYieldExpressionInGenericCall3.ts, 8, 1))
86+
>AEff : Symbol(AEff, Decl(genericCallAtYieldExpressionInGenericCall3.ts, 19, 54))
87+
88+
body: () => Generator<Eff, AEff, never>,
89+
>body : Symbol(body, Decl(genericCallAtYieldExpressionInGenericCall3.ts, 19, 61))
90+
>Generator : Symbol(Generator, Decl(lib.es2015.generator.d.ts, --, --))
91+
>Eff : Symbol(Eff, Decl(genericCallAtYieldExpressionInGenericCall3.ts, 19, 21))
92+
>AEff : Symbol(AEff, Decl(genericCallAtYieldExpressionInGenericCall3.ts, 19, 54))
93+
94+
): Micro<AEff, any, never>;
95+
>Micro : Symbol(Micro, Decl(genericCallAtYieldExpressionInGenericCall3.ts, 8, 1))
96+
>AEff : Symbol(AEff, Decl(genericCallAtYieldExpressionInGenericCall3.ts, 19, 54))
97+
98+
declare const traverse: {
99+
>traverse : Symbol(traverse, Decl(genericCallAtYieldExpressionInGenericCall3.ts, 23, 13))
100+
101+
<A, R, O, E, B>(
102+
>A : Symbol(A, Decl(genericCallAtYieldExpressionInGenericCall3.ts, 24, 3))
103+
>R : Symbol(R, Decl(genericCallAtYieldExpressionInGenericCall3.ts, 24, 5))
104+
>O : Symbol(O, Decl(genericCallAtYieldExpressionInGenericCall3.ts, 24, 8))
105+
>E : Symbol(E, Decl(genericCallAtYieldExpressionInGenericCall3.ts, 24, 11))
106+
>B : Symbol(B, Decl(genericCallAtYieldExpressionInGenericCall3.ts, 24, 14))
107+
108+
f: (a: A) => Micro<B, E, O>,
109+
>f : Symbol(f, Decl(genericCallAtYieldExpressionInGenericCall3.ts, 24, 18))
110+
>a : Symbol(a, Decl(genericCallAtYieldExpressionInGenericCall3.ts, 25, 8))
111+
>A : Symbol(A, Decl(genericCallAtYieldExpressionInGenericCall3.ts, 24, 3))
112+
>Micro : Symbol(Micro, Decl(genericCallAtYieldExpressionInGenericCall3.ts, 8, 1))
113+
>B : Symbol(B, Decl(genericCallAtYieldExpressionInGenericCall3.ts, 24, 14))
114+
>E : Symbol(E, Decl(genericCallAtYieldExpressionInGenericCall3.ts, 24, 11))
115+
>O : Symbol(O, Decl(genericCallAtYieldExpressionInGenericCall3.ts, 24, 8))
116+
117+
): (
118+
self: ReadonlyRecord<string, A>,
119+
>self : Symbol(self, Decl(genericCallAtYieldExpressionInGenericCall3.ts, 26, 6))
120+
>ReadonlyRecord : Symbol(ReadonlyRecord, Decl(genericCallAtYieldExpressionInGenericCall3.ts, 0, 0))
121+
>A : Symbol(A, Decl(genericCallAtYieldExpressionInGenericCall3.ts, 24, 3))
122+
123+
) => Micro<ReadonlyRecord<string, B>, E, O>;
124+
>Micro : Symbol(Micro, Decl(genericCallAtYieldExpressionInGenericCall3.ts, 8, 1))
125+
>ReadonlyRecord : Symbol(ReadonlyRecord, Decl(genericCallAtYieldExpressionInGenericCall3.ts, 0, 0))
126+
>B : Symbol(B, Decl(genericCallAtYieldExpressionInGenericCall3.ts, 24, 14))
127+
>E : Symbol(E, Decl(genericCallAtYieldExpressionInGenericCall3.ts, 24, 11))
128+
>O : Symbol(O, Decl(genericCallAtYieldExpressionInGenericCall3.ts, 24, 8))
129+
130+
<A, O, E, B>(
131+
>A : Symbol(A, Decl(genericCallAtYieldExpressionInGenericCall3.ts, 29, 3))
132+
>O : Symbol(O, Decl(genericCallAtYieldExpressionInGenericCall3.ts, 29, 5))
133+
>E : Symbol(E, Decl(genericCallAtYieldExpressionInGenericCall3.ts, 29, 8))
134+
>B : Symbol(B, Decl(genericCallAtYieldExpressionInGenericCall3.ts, 29, 11))
135+
136+
self: ReadonlyRecord<string, A>,
137+
>self : Symbol(self, Decl(genericCallAtYieldExpressionInGenericCall3.ts, 29, 15))
138+
>ReadonlyRecord : Symbol(ReadonlyRecord, Decl(genericCallAtYieldExpressionInGenericCall3.ts, 0, 0))
139+
>A : Symbol(A, Decl(genericCallAtYieldExpressionInGenericCall3.ts, 29, 3))
140+
141+
f: (a: A) => Micro<B, E, O>,
142+
>f : Symbol(f, Decl(genericCallAtYieldExpressionInGenericCall3.ts, 30, 36))
143+
>a : Symbol(a, Decl(genericCallAtYieldExpressionInGenericCall3.ts, 31, 8))
144+
>A : Symbol(A, Decl(genericCallAtYieldExpressionInGenericCall3.ts, 29, 3))
145+
>Micro : Symbol(Micro, Decl(genericCallAtYieldExpressionInGenericCall3.ts, 8, 1))
146+
>B : Symbol(B, Decl(genericCallAtYieldExpressionInGenericCall3.ts, 29, 11))
147+
>E : Symbol(E, Decl(genericCallAtYieldExpressionInGenericCall3.ts, 29, 8))
148+
>O : Symbol(O, Decl(genericCallAtYieldExpressionInGenericCall3.ts, 29, 5))
149+
150+
): Micro<ReadonlyRecord<string, B>, E, O>;
151+
>Micro : Symbol(Micro, Decl(genericCallAtYieldExpressionInGenericCall3.ts, 8, 1))
152+
>ReadonlyRecord : Symbol(ReadonlyRecord, Decl(genericCallAtYieldExpressionInGenericCall3.ts, 0, 0))
153+
>B : Symbol(B, Decl(genericCallAtYieldExpressionInGenericCall3.ts, 29, 11))
154+
>E : Symbol(E, Decl(genericCallAtYieldExpressionInGenericCall3.ts, 29, 8))
155+
>O : Symbol(O, Decl(genericCallAtYieldExpressionInGenericCall3.ts, 29, 5))
156+
157+
};
158+
159+
runPromise(
160+
>runPromise : Symbol(runPromise, Decl(genericCallAtYieldExpressionInGenericCall3.ts, 15, 1))
161+
162+
gen(function* () {
163+
>gen : Symbol(gen, Decl(genericCallAtYieldExpressionInGenericCall3.ts, 17, 67))
164+
165+
yield* traverse({ a: 1, b: 2 }, (n) =>
166+
>traverse : Symbol(traverse, Decl(genericCallAtYieldExpressionInGenericCall3.ts, 23, 13))
167+
>a : Symbol(a, Decl(genericCallAtYieldExpressionInGenericCall3.ts, 37, 21))
168+
>b : Symbol(b, Decl(genericCallAtYieldExpressionInGenericCall3.ts, 37, 27))
169+
>n : Symbol(n, Decl(genericCallAtYieldExpressionInGenericCall3.ts, 37, 37))
170+
171+
gen(function* () {
172+
>gen : Symbol(gen, Decl(genericCallAtYieldExpressionInGenericCall3.ts, 17, 67))
173+
174+
return n + 1;
175+
>n : Symbol(n, Decl(genericCallAtYieldExpressionInGenericCall3.ts, 37, 37))
176+
177+
}),
178+
);
179+
}),
180+
);
181+
Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
//// [tests/cases/compiler/genericCallAtYieldExpressionInGenericCall3.ts] ////
2+
3+
=== Performance Stats ===
4+
Type Count: 1,000
5+
Instantiation count: 2,500
6+
7+
=== genericCallAtYieldExpressionInGenericCall3.ts ===
8+
type ReadonlyRecord<in out K extends string | symbol, out A> = {
9+
>ReadonlyRecord : ReadonlyRecord<K, A>
10+
> : ^^^^^^^^^^^^^^^^^^^^
11+
12+
readonly [P in K]: A;
13+
};
14+
15+
type Success<T> = T extends Micro<infer _A, infer _E, infer _R> ? _A : never;
16+
>Success : Success<T>
17+
> : ^^^^^^^^^^
18+
19+
interface MicroIterator<T extends Micro<any, any, any>> {
20+
next(...args: ReadonlyArray<any>): IteratorResult<T, Success<T>>;
21+
>next : (...args: ReadonlyArray<any>) => IteratorResult<T, Success<T>>
22+
> : ^^^^ ^^ ^^^^^
23+
>args : readonly any[]
24+
> : ^^^^^^^^^^^^^^
25+
}
26+
27+
interface Micro<out A, out E = never, out R = never> {
28+
_A: A;
29+
>_A : A
30+
> : ^
31+
32+
_E: E;
33+
>_E : E
34+
> : ^
35+
36+
_R: R;
37+
>_R : R
38+
> : ^
39+
40+
[Symbol.iterator](): MicroIterator<Micro<A, E, R>>;
41+
>[Symbol.iterator] : () => MicroIterator<Micro<A, E, R>>
42+
> : ^^^^^^
43+
>Symbol.iterator : unique symbol
44+
> : ^^^^^^^^^^^^^
45+
>Symbol : SymbolConstructor
46+
> : ^^^^^^^^^^^^^^^^^
47+
>iterator : unique symbol
48+
> : ^^^^^^^^^^^^^
49+
}
50+
51+
declare function runPromise<A, E>(effect: Micro<A, E>): Promise<A>;
52+
>runPromise : <A, E>(effect: Micro<A, E>) => Promise<A>
53+
> : ^ ^^ ^^ ^^ ^^^^^
54+
>effect : Micro<A, E, never>
55+
> : ^^^^^^^^^^^^^^^^^^
56+
57+
declare function gen<Eff extends Micro<any, any, any>, AEff>(
58+
>gen : <Eff extends Micro<any, any, any>, AEff>(body: () => Generator<Eff, AEff, never>) => Micro<AEff, any, never>
59+
> : ^ ^^^^^^^^^ ^^ ^^ ^^ ^^^^^
60+
61+
body: () => Generator<Eff, AEff, never>,
62+
>body : () => Generator<Eff, AEff, never>
63+
> : ^^^^^^
64+
65+
): Micro<AEff, any, never>;
66+
67+
declare const traverse: {
68+
>traverse : { <A, R, O, E, B>(f: (a: A) => Micro<B, E, O>): (self: ReadonlyRecord<string, A>) => Micro<ReadonlyRecord<string, B>, E, O>; <A, O, E, B>(self: ReadonlyRecord<string, A>, f: (a: A) => Micro<B, E, O>): Micro<ReadonlyRecord<string, B>, E, O>; }
69+
> : ^^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^^ ^^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^^ ^^^
70+
71+
<A, R, O, E, B>(
72+
f: (a: A) => Micro<B, E, O>,
73+
>f : (a: A) => Micro<B, E, O>
74+
> : ^ ^^ ^^^^^
75+
>a : A
76+
> : ^
77+
78+
): (
79+
self: ReadonlyRecord<string, A>,
80+
>self : ReadonlyRecord<string, A>
81+
> : ^^^^^^^^^^^^^^^^^^^^^^^^^
82+
83+
) => Micro<ReadonlyRecord<string, B>, E, O>;
84+
<A, O, E, B>(
85+
self: ReadonlyRecord<string, A>,
86+
>self : ReadonlyRecord<string, A>
87+
> : ^^^^^^^^^^^^^^^^^^^^^^^^^
88+
89+
f: (a: A) => Micro<B, E, O>,
90+
>f : (a: A) => Micro<B, E, O>
91+
> : ^ ^^ ^^^^^
92+
>a : A
93+
> : ^
94+
95+
): Micro<ReadonlyRecord<string, B>, E, O>;
96+
};
97+
98+
runPromise(
99+
>runPromise( gen(function* () { yield* traverse({ a: 1, b: 2 }, (n) => gen(function* () { return n + 1; }), ); }),) : Promise<void>
100+
> : ^^^^^^^^^^^^^
101+
>runPromise : <A, E>(effect: Micro<A, E>) => Promise<A>
102+
> : ^ ^^ ^^ ^^ ^^^^^
103+
104+
gen(function* () {
105+
>gen(function* () { yield* traverse({ a: 1, b: 2 }, (n) => gen(function* () { return n + 1; }), ); }) : Micro<void, any, never>
106+
> : ^^^^^^^^^^^^^^^^^^^^^^^
107+
>gen : <Eff extends Micro<any, any, any>, AEff>(body: () => Generator<Eff, AEff, never>) => Micro<AEff, any, never>
108+
> : ^ ^^^^^^^^^ ^^ ^^ ^^ ^^^^^
109+
>function* () { yield* traverse({ a: 1, b: 2 }, (n) => gen(function* () { return n + 1; }), ); } : () => Generator<Micro<ReadonlyRecord<string, number>, any, never>, void, any>
110+
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
111+
112+
yield* traverse({ a: 1, b: 2 }, (n) =>
113+
>yield* traverse({ a: 1, b: 2 }, (n) => gen(function* () { return n + 1; }), ) : ReadonlyRecord<string, number>
114+
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
115+
>traverse({ a: 1, b: 2 }, (n) => gen(function* () { return n + 1; }), ) : Micro<ReadonlyRecord<string, number>, any, never>
116+
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
117+
>traverse : { <A, R, O, E, B>(f: (a: A) => Micro<B, E, O>): (self: ReadonlyRecord<string, A>) => Micro<ReadonlyRecord<string, B>, E, O>; <A, O, E, B>(self: ReadonlyRecord<string, A>, f: (a: A) => Micro<B, E, O>): Micro<ReadonlyRecord<string, B>, E, O>; }
118+
> : ^^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^^ ^^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^^ ^^^
119+
>{ a: 1, b: 2 } : { a: number; b: number; }
120+
> : ^^^^^^^^^^^^^^^^^^^^^^^^^
121+
>a : number
122+
> : ^^^^^^
123+
>1 : 1
124+
> : ^
125+
>b : number
126+
> : ^^^^^^
127+
>2 : 2
128+
> : ^
129+
>(n) => gen(function* () { return n + 1; }) : (n: number) => Micro<number, any, never>
130+
> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
131+
>n : number
132+
> : ^^^^^^
133+
134+
gen(function* () {
135+
>gen(function* () { return n + 1; }) : Micro<number, any, never>
136+
> : ^^^^^^^^^^^^^^^^^^^^^^^^^
137+
>gen : <Eff extends Micro<any, any, any>, AEff>(body: () => Generator<Eff, AEff, never>) => Micro<AEff, any, never>
138+
> : ^ ^^^^^^^^^ ^^ ^^ ^^ ^^^^^
139+
>function* () { return n + 1; } : () => Generator<never, number, never>
140+
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
141+
142+
return n + 1;
143+
>n + 1 : number
144+
> : ^^^^^^
145+
>n : number
146+
> : ^^^^^^
147+
>1 : 1
148+
> : ^
149+
150+
}),
151+
);
152+
}),
153+
);
154+

0 commit comments

Comments
 (0)