mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-12-10 00:20:22 -06:00
Add tests for contextual param type assignment in nested return type inference scenarios (#62189)
This commit is contained in:
parent
6618cf7069
commit
dafed7f25b
@ -0,0 +1,89 @@
|
||||
//// [tests/cases/compiler/contextualParamTypeVsNestedReturnTypeInference1.ts] ////
|
||||
|
||||
=== contextualParamTypeVsNestedReturnTypeInference1.ts ===
|
||||
interface Effect<A> {
|
||||
>Effect : Symbol(Effect, Decl(contextualParamTypeVsNestedReturnTypeInference1.ts, 0, 0))
|
||||
>A : Symbol(A, Decl(contextualParamTypeVsNestedReturnTypeInference1.ts, 0, 17))
|
||||
|
||||
_A: A;
|
||||
>_A : Symbol(Effect._A, Decl(contextualParamTypeVsNestedReturnTypeInference1.ts, 0, 21))
|
||||
>A : Symbol(A, Decl(contextualParamTypeVsNestedReturnTypeInference1.ts, 0, 17))
|
||||
}
|
||||
|
||||
declare function effectGen<AEff>(f: () => AEff): Effect<AEff>;
|
||||
>effectGen : Symbol(effectGen, Decl(contextualParamTypeVsNestedReturnTypeInference1.ts, 2, 1))
|
||||
>AEff : Symbol(AEff, Decl(contextualParamTypeVsNestedReturnTypeInference1.ts, 4, 27))
|
||||
>f : Symbol(f, Decl(contextualParamTypeVsNestedReturnTypeInference1.ts, 4, 33))
|
||||
>AEff : Symbol(AEff, Decl(contextualParamTypeVsNestedReturnTypeInference1.ts, 4, 27))
|
||||
>Effect : Symbol(Effect, Decl(contextualParamTypeVsNestedReturnTypeInference1.ts, 0, 0))
|
||||
>AEff : Symbol(AEff, Decl(contextualParamTypeVsNestedReturnTypeInference1.ts, 4, 27))
|
||||
|
||||
declare function effectFn<AEff, Args extends Array<any>>(
|
||||
>effectFn : Symbol(effectFn, Decl(contextualParamTypeVsNestedReturnTypeInference1.ts, 4, 62))
|
||||
>AEff : Symbol(AEff, Decl(contextualParamTypeVsNestedReturnTypeInference1.ts, 6, 26))
|
||||
>Args : Symbol(Args, Decl(contextualParamTypeVsNestedReturnTypeInference1.ts, 6, 31))
|
||||
>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 4 more)
|
||||
|
||||
body: (...args: Args) => unknown,
|
||||
>body : Symbol(body, Decl(contextualParamTypeVsNestedReturnTypeInference1.ts, 6, 57))
|
||||
>args : Symbol(args, Decl(contextualParamTypeVsNestedReturnTypeInference1.ts, 7, 9))
|
||||
>Args : Symbol(Args, Decl(contextualParamTypeVsNestedReturnTypeInference1.ts, 6, 31))
|
||||
|
||||
): (...args: Args) => Effect<AEff>;
|
||||
>args : Symbol(args, Decl(contextualParamTypeVsNestedReturnTypeInference1.ts, 8, 4))
|
||||
>Args : Symbol(Args, Decl(contextualParamTypeVsNestedReturnTypeInference1.ts, 6, 31))
|
||||
>Effect : Symbol(Effect, Decl(contextualParamTypeVsNestedReturnTypeInference1.ts, 0, 0))
|
||||
>AEff : Symbol(AEff, Decl(contextualParamTypeVsNestedReturnTypeInference1.ts, 6, 26))
|
||||
|
||||
declare function layerEffect<S>(tag: Tag<S>, effect: Effect<S>): unknown;
|
||||
>layerEffect : Symbol(layerEffect, Decl(contextualParamTypeVsNestedReturnTypeInference1.ts, 8, 35))
|
||||
>S : Symbol(S, Decl(contextualParamTypeVsNestedReturnTypeInference1.ts, 10, 29))
|
||||
>tag : Symbol(tag, Decl(contextualParamTypeVsNestedReturnTypeInference1.ts, 10, 32))
|
||||
>Tag : Symbol(Tag, Decl(contextualParamTypeVsNestedReturnTypeInference1.ts, 10, 73))
|
||||
>S : Symbol(S, Decl(contextualParamTypeVsNestedReturnTypeInference1.ts, 10, 29))
|
||||
>effect : Symbol(effect, Decl(contextualParamTypeVsNestedReturnTypeInference1.ts, 10, 44))
|
||||
>Effect : Symbol(Effect, Decl(contextualParamTypeVsNestedReturnTypeInference1.ts, 0, 0))
|
||||
>S : Symbol(S, Decl(contextualParamTypeVsNestedReturnTypeInference1.ts, 10, 29))
|
||||
|
||||
interface Tag<Type> {
|
||||
>Tag : Symbol(Tag, Decl(contextualParamTypeVsNestedReturnTypeInference1.ts, 10, 73))
|
||||
>Type : Symbol(Type, Decl(contextualParamTypeVsNestedReturnTypeInference1.ts, 12, 14))
|
||||
|
||||
_Type: Type;
|
||||
>_Type : Symbol(Tag._Type, Decl(contextualParamTypeVsNestedReturnTypeInference1.ts, 12, 21))
|
||||
>Type : Symbol(Type, Decl(contextualParamTypeVsNestedReturnTypeInference1.ts, 12, 14))
|
||||
}
|
||||
|
||||
declare const Foo: Tag<{
|
||||
>Foo : Symbol(Foo, Decl(contextualParamTypeVsNestedReturnTypeInference1.ts, 16, 13))
|
||||
>Tag : Symbol(Tag, Decl(contextualParamTypeVsNestedReturnTypeInference1.ts, 10, 73))
|
||||
|
||||
fn: (a: string) => unknown;
|
||||
>fn : Symbol(fn, Decl(contextualParamTypeVsNestedReturnTypeInference1.ts, 16, 24))
|
||||
>a : Symbol(a, Decl(contextualParamTypeVsNestedReturnTypeInference1.ts, 17, 7))
|
||||
|
||||
}>;
|
||||
|
||||
layerEffect(
|
||||
>layerEffect : Symbol(layerEffect, Decl(contextualParamTypeVsNestedReturnTypeInference1.ts, 8, 35))
|
||||
|
||||
Foo,
|
||||
>Foo : Symbol(Foo, Decl(contextualParamTypeVsNestedReturnTypeInference1.ts, 16, 13))
|
||||
|
||||
effectGen(function () {
|
||||
>effectGen : Symbol(effectGen, Decl(contextualParamTypeVsNestedReturnTypeInference1.ts, 2, 1))
|
||||
|
||||
return {
|
||||
fn: effectFn(function (a) {
|
||||
>fn : Symbol(fn, Decl(contextualParamTypeVsNestedReturnTypeInference1.ts, 23, 12))
|
||||
>effectFn : Symbol(effectFn, Decl(contextualParamTypeVsNestedReturnTypeInference1.ts, 4, 62))
|
||||
>a : Symbol(a, Decl(contextualParamTypeVsNestedReturnTypeInference1.ts, 24, 29))
|
||||
|
||||
a; // string
|
||||
>a : Symbol(a, Decl(contextualParamTypeVsNestedReturnTypeInference1.ts, 24, 29))
|
||||
|
||||
}),
|
||||
};
|
||||
}),
|
||||
);
|
||||
|
||||
@ -0,0 +1,98 @@
|
||||
//// [tests/cases/compiler/contextualParamTypeVsNestedReturnTypeInference1.ts] ////
|
||||
|
||||
=== contextualParamTypeVsNestedReturnTypeInference1.ts ===
|
||||
interface Effect<A> {
|
||||
_A: A;
|
||||
>_A : A
|
||||
> : ^
|
||||
}
|
||||
|
||||
declare function effectGen<AEff>(f: () => AEff): Effect<AEff>;
|
||||
>effectGen : <AEff>(f: () => AEff) => Effect<AEff>
|
||||
> : ^ ^^ ^^ ^^^^^
|
||||
>f : () => AEff
|
||||
> : ^^^^^^
|
||||
|
||||
declare function effectFn<AEff, Args extends Array<any>>(
|
||||
>effectFn : <AEff, Args extends Array<any>>(body: (...args: Args) => unknown) => (...args: Args) => Effect<AEff>
|
||||
> : ^ ^^ ^^^^^^^^^ ^^ ^^ ^^^^^
|
||||
|
||||
body: (...args: Args) => unknown,
|
||||
>body : (...args: Args) => unknown
|
||||
> : ^^^^ ^^ ^^^^^
|
||||
>args : Args
|
||||
> : ^^^^
|
||||
|
||||
): (...args: Args) => Effect<AEff>;
|
||||
>args : Args
|
||||
> : ^^^^
|
||||
|
||||
declare function layerEffect<S>(tag: Tag<S>, effect: Effect<S>): unknown;
|
||||
>layerEffect : <S>(tag: Tag<S>, effect: Effect<S>) => unknown
|
||||
> : ^ ^^ ^^ ^^ ^^ ^^^^^
|
||||
>tag : Tag<S>
|
||||
> : ^^^^^^
|
||||
>effect : Effect<S>
|
||||
> : ^^^^^^^^^
|
||||
|
||||
interface Tag<Type> {
|
||||
_Type: Type;
|
||||
>_Type : Type
|
||||
> : ^^^^
|
||||
}
|
||||
|
||||
declare const Foo: Tag<{
|
||||
>Foo : Tag<{ fn: (a: string) => unknown; }>
|
||||
> : ^^^^^^^^^^ ^^^^
|
||||
|
||||
fn: (a: string) => unknown;
|
||||
>fn : (a: string) => unknown
|
||||
> : ^ ^^ ^^^^^
|
||||
>a : string
|
||||
> : ^^^^^^
|
||||
|
||||
}>;
|
||||
|
||||
layerEffect(
|
||||
>layerEffect( Foo, effectGen(function () { return { fn: effectFn(function (a) { a; // string }), }; }),) : unknown
|
||||
> : ^^^^^^^
|
||||
>layerEffect : <S>(tag: Tag<S>, effect: Effect<S>) => unknown
|
||||
> : ^ ^^ ^^ ^^ ^^ ^^^^^
|
||||
|
||||
Foo,
|
||||
>Foo : Tag<{ fn: (a: string) => unknown; }>
|
||||
> : ^^^^^^^^^^ ^^^^
|
||||
|
||||
effectGen(function () {
|
||||
>effectGen(function () { return { fn: effectFn(function (a) { a; // string }), }; }) : Effect<{ fn: (a: string) => Effect<unknown>; }>
|
||||
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
>effectGen : <AEff>(f: () => AEff) => Effect<AEff>
|
||||
> : ^ ^^ ^^ ^^^^^
|
||||
>function () { return { fn: effectFn(function (a) { a; // string }), }; } : () => { fn: (a: string) => Effect<unknown>; }
|
||||
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
return {
|
||||
>{ fn: effectFn(function (a) { a; // string }), } : { fn: (a: string) => Effect<unknown>; }
|
||||
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
fn: effectFn(function (a) {
|
||||
>fn : (a: string) => Effect<unknown>
|
||||
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
>effectFn(function (a) { a; // string }) : (a: string) => Effect<unknown>
|
||||
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
>effectFn : <AEff, Args extends Array<any>>(body: (...args: Args) => unknown) => (...args: Args) => Effect<AEff>
|
||||
> : ^ ^^ ^^^^^^^^^ ^^ ^^ ^^^^^
|
||||
>function (a) { a; // string } : (a: string) => void
|
||||
> : ^ ^^^^^^^^^^^^^^^^^
|
||||
>a : string
|
||||
> : ^^^^^^
|
||||
|
||||
a; // string
|
||||
>a : string
|
||||
> : ^^^^^^
|
||||
|
||||
}),
|
||||
};
|
||||
}),
|
||||
);
|
||||
|
||||
@ -0,0 +1,273 @@
|
||||
//// [tests/cases/compiler/contextualParamTypeVsNestedReturnTypeInference2.ts] ////
|
||||
|
||||
=== contextualParamTypeVsNestedReturnTypeInference2.ts ===
|
||||
type Covariant<A> = (_: never) => A;
|
||||
>Covariant : Symbol(Covariant, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 0, 0))
|
||||
>A : Symbol(A, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 0, 15))
|
||||
>_ : Symbol(_, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 0, 21))
|
||||
>A : Symbol(A, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 0, 15))
|
||||
|
||||
interface Effect<out A, out E = never, out R = never> {
|
||||
>Effect : Symbol(Effect, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 0, 36))
|
||||
>A : Symbol(A, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 2, 17))
|
||||
>E : Symbol(E, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 2, 23))
|
||||
>R : Symbol(R, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 2, 38))
|
||||
|
||||
readonly _A: Covariant<A>;
|
||||
>_A : Symbol(Effect._A, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 2, 55))
|
||||
>Covariant : Symbol(Covariant, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 0, 0))
|
||||
>A : Symbol(A, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 2, 17))
|
||||
|
||||
readonly _E: Covariant<E>;
|
||||
>_E : Symbol(Effect._E, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 3, 28))
|
||||
>Covariant : Symbol(Covariant, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 0, 0))
|
||||
>E : Symbol(E, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 2, 23))
|
||||
|
||||
readonly _R: Covariant<R>;
|
||||
>_R : Symbol(Effect._R, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 4, 28))
|
||||
>Covariant : Symbol(Covariant, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 0, 0))
|
||||
>R : Symbol(R, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 2, 38))
|
||||
}
|
||||
|
||||
declare function effectGen<Eff extends Effect<any, any, any>, AEff>(
|
||||
>effectGen : Symbol(effectGen, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 6, 1))
|
||||
>Eff : Symbol(Eff, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 8, 27))
|
||||
>Effect : Symbol(Effect, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 0, 36))
|
||||
>AEff : Symbol(AEff, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 8, 61))
|
||||
|
||||
f: () => Generator<Eff, AEff, never>
|
||||
>f : Symbol(f, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 8, 68))
|
||||
>Generator : Symbol(Generator, Decl(lib.es2015.generator.d.ts, --, --))
|
||||
>Eff : Symbol(Eff, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 8, 27))
|
||||
>AEff : Symbol(AEff, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 8, 61))
|
||||
|
||||
): Effect<
|
||||
>Effect : Symbol(Effect, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 0, 36))
|
||||
|
||||
AEff,
|
||||
>AEff : Symbol(AEff, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 8, 61))
|
||||
|
||||
[Eff] extends [never]
|
||||
>Eff : Symbol(Eff, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 8, 27))
|
||||
|
||||
? never
|
||||
: [Eff] extends [Effect<infer _A, infer E, infer _R>]
|
||||
>Eff : Symbol(Eff, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 8, 27))
|
||||
>Effect : Symbol(Effect, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 0, 36))
|
||||
>_A : Symbol(_A, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 14, 33))
|
||||
>E : Symbol(E, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 14, 43))
|
||||
>_R : Symbol(_R, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 14, 52))
|
||||
|
||||
? E
|
||||
>E : Symbol(E, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 14, 43))
|
||||
|
||||
: never,
|
||||
[Eff] extends [never]
|
||||
>Eff : Symbol(Eff, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 8, 27))
|
||||
|
||||
? never
|
||||
: [Eff] extends [Effect<infer _A, infer _E, infer R>]
|
||||
>Eff : Symbol(Eff, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 8, 27))
|
||||
>Effect : Symbol(Effect, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 0, 36))
|
||||
>_A : Symbol(_A, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 19, 33))
|
||||
>_E : Symbol(_E, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 19, 43))
|
||||
>R : Symbol(R, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 19, 53))
|
||||
|
||||
? R
|
||||
>R : Symbol(R, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 19, 53))
|
||||
|
||||
: never
|
||||
>;
|
||||
|
||||
declare function effectFn<
|
||||
>effectFn : Symbol(effectFn, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 22, 2))
|
||||
|
||||
Eff extends Effect<any, any, any>,
|
||||
>Eff : Symbol(Eff, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 24, 26))
|
||||
>Effect : Symbol(Effect, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 0, 36))
|
||||
|
||||
AEff,
|
||||
>AEff : Symbol(AEff, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 25, 36))
|
||||
|
||||
Args extends Array<any>
|
||||
>Args : Symbol(Args, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 26, 7))
|
||||
>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 4 more)
|
||||
|
||||
>(
|
||||
body: (...args: Args) => Generator<Eff, AEff, never>
|
||||
>body : Symbol(body, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 28, 2))
|
||||
>args : Symbol(args, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 29, 9))
|
||||
>Args : Symbol(Args, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 26, 7))
|
||||
>Generator : Symbol(Generator, Decl(lib.es2015.generator.d.ts, --, --))
|
||||
>Eff : Symbol(Eff, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 24, 26))
|
||||
>AEff : Symbol(AEff, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 25, 36))
|
||||
|
||||
): (
|
||||
...args: Args
|
||||
>args : Symbol(args, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 30, 4))
|
||||
>Args : Symbol(Args, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 26, 7))
|
||||
|
||||
) => Effect<
|
||||
>Effect : Symbol(Effect, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 0, 36))
|
||||
|
||||
AEff,
|
||||
>AEff : Symbol(AEff, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 25, 36))
|
||||
|
||||
[Eff] extends [never]
|
||||
>Eff : Symbol(Eff, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 24, 26))
|
||||
|
||||
? never
|
||||
: [Eff] extends [Effect<infer _A, infer E, infer _R>]
|
||||
>Eff : Symbol(Eff, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 24, 26))
|
||||
>Effect : Symbol(Effect, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 0, 36))
|
||||
>_A : Symbol(_A, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 36, 33))
|
||||
>E : Symbol(E, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 36, 43))
|
||||
>_R : Symbol(_R, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 36, 52))
|
||||
|
||||
? E
|
||||
>E : Symbol(E, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 36, 43))
|
||||
|
||||
: never,
|
||||
[Eff] extends [never]
|
||||
>Eff : Symbol(Eff, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 24, 26))
|
||||
|
||||
? never
|
||||
: [Eff] extends [Effect<infer _A, infer _E, infer R>]
|
||||
>Eff : Symbol(Eff, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 24, 26))
|
||||
>Effect : Symbol(Effect, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 0, 36))
|
||||
>_A : Symbol(_A, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 41, 33))
|
||||
>_E : Symbol(_E, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 41, 43))
|
||||
>R : Symbol(R, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 41, 53))
|
||||
|
||||
? R
|
||||
>R : Symbol(R, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 41, 53))
|
||||
|
||||
: never
|
||||
>;
|
||||
|
||||
interface Tag<in out Id, in out Value> {
|
||||
>Tag : Symbol(Tag, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 65, 11), Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 44, 2))
|
||||
>Id : Symbol(Id, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 46, 14))
|
||||
>Value : Symbol(Value, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 46, 24))
|
||||
|
||||
readonly _op: "Tag";
|
||||
>_op : Symbol(Tag._op, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 46, 40))
|
||||
|
||||
readonly Service: Value;
|
||||
>Service : Symbol(Tag.Service, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 47, 22))
|
||||
>Value : Symbol(Value, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 46, 24))
|
||||
|
||||
readonly Identifier: Id;
|
||||
>Identifier : Symbol(Tag.Identifier, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 48, 26))
|
||||
>Id : Symbol(Id, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 46, 14))
|
||||
}
|
||||
|
||||
interface TagClassShape<Id, Shape> {
|
||||
>TagClassShape : Symbol(TagClassShape, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 50, 1))
|
||||
>Id : Symbol(Id, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 52, 24), Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 53, 23))
|
||||
>Shape : Symbol(Shape, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 52, 27))
|
||||
|
||||
readonly Type: Shape;
|
||||
>Type : Symbol(TagClassShape.Type, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 52, 36))
|
||||
>Shape : Symbol(Shape, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 52, 27))
|
||||
|
||||
readonly Id: Id;
|
||||
>Id : Symbol(Id, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 52, 24), Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 53, 23))
|
||||
>Id : Symbol(Id, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 52, 24), Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 53, 23))
|
||||
}
|
||||
|
||||
interface TagClass<Self, Id extends string, Type> extends Tag<Self, Type> {
|
||||
>TagClass : Symbol(TagClass, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 55, 1))
|
||||
>Self : Symbol(Self, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 57, 19))
|
||||
>Id : Symbol(Id, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 57, 24))
|
||||
>Type : Symbol(Type, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 57, 43))
|
||||
>Tag : Symbol(Tag, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 65, 11), Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 44, 2))
|
||||
>Self : Symbol(Self, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 57, 19))
|
||||
>Type : Symbol(Type, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 57, 43))
|
||||
|
||||
new (_: never): TagClassShape<Id, Type>;
|
||||
>_ : Symbol(_, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 58, 7))
|
||||
>TagClassShape : Symbol(TagClassShape, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 50, 1))
|
||||
>Id : Symbol(Id, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 57, 24))
|
||||
>Type : Symbol(Type, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 57, 43))
|
||||
|
||||
readonly key: Id;
|
||||
>key : Symbol(TagClass.key, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 58, 42))
|
||||
>Id : Symbol(Id, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 57, 24))
|
||||
}
|
||||
|
||||
declare function layerEffect<I, S, E, R>(
|
||||
>layerEffect : Symbol(layerEffect, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 60, 1))
|
||||
>I : Symbol(I, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 62, 29))
|
||||
>S : Symbol(S, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 62, 31))
|
||||
>E : Symbol(E, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 62, 34))
|
||||
>R : Symbol(R, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 62, 37))
|
||||
|
||||
tag: Tag<I, S>,
|
||||
>tag : Symbol(tag, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 62, 41))
|
||||
>Tag : Symbol(Tag, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 65, 11), Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 44, 2))
|
||||
>I : Symbol(I, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 62, 29))
|
||||
>S : Symbol(S, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 62, 31))
|
||||
|
||||
effect: Effect<S, E, R>
|
||||
>effect : Symbol(effect, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 63, 17))
|
||||
>Effect : Symbol(Effect, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 0, 36))
|
||||
>S : Symbol(S, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 62, 31))
|
||||
>E : Symbol(E, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 62, 34))
|
||||
>R : Symbol(R, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 62, 37))
|
||||
|
||||
): unknown;
|
||||
|
||||
declare function Tag<const Id extends string>(
|
||||
>Tag : Symbol(Tag, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 65, 11), Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 44, 2))
|
||||
>Id : Symbol(Id, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 67, 21))
|
||||
|
||||
id: Id
|
||||
>id : Symbol(id, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 67, 46))
|
||||
>Id : Symbol(Id, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 67, 21))
|
||||
|
||||
): <Self, Shape>() => TagClass<Self, Id, Shape>;
|
||||
>Self : Symbol(Self, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 69, 4))
|
||||
>Shape : Symbol(Shape, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 69, 9))
|
||||
>TagClass : Symbol(TagClass, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 55, 1))
|
||||
>Self : Symbol(Self, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 69, 4))
|
||||
>Id : Symbol(Id, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 67, 21))
|
||||
>Shape : Symbol(Shape, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 69, 9))
|
||||
|
||||
class Foo extends Tag("Foo")<
|
||||
>Foo : Symbol(Foo, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 69, 48))
|
||||
>Tag : Symbol(Tag, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 65, 11), Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 44, 2))
|
||||
|
||||
Foo,
|
||||
>Foo : Symbol(Foo, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 69, 48))
|
||||
{
|
||||
fn: (a: string) => Effect<void>;
|
||||
>fn : Symbol(fn, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 73, 3))
|
||||
>a : Symbol(a, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 74, 9))
|
||||
>Effect : Symbol(Effect, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 0, 36))
|
||||
}
|
||||
>() {}
|
||||
|
||||
layerEffect(
|
||||
>layerEffect : Symbol(layerEffect, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 60, 1))
|
||||
|
||||
Foo,
|
||||
>Foo : Symbol(Foo, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 69, 48))
|
||||
|
||||
effectGen(function* () {
|
||||
>effectGen : Symbol(effectGen, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 6, 1))
|
||||
|
||||
return {
|
||||
fn: effectFn(function* (a) {
|
||||
>fn : Symbol(fn, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 81, 12))
|
||||
>effectFn : Symbol(effectFn, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 22, 2))
|
||||
>a : Symbol(a, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 82, 30))
|
||||
|
||||
a; // string
|
||||
>a : Symbol(a, Decl(contextualParamTypeVsNestedReturnTypeInference2.ts, 82, 30))
|
||||
|
||||
}),
|
||||
};
|
||||
})
|
||||
);
|
||||
|
||||
@ -0,0 +1,205 @@
|
||||
//// [tests/cases/compiler/contextualParamTypeVsNestedReturnTypeInference2.ts] ////
|
||||
|
||||
=== Performance Stats ===
|
||||
Type Count: 1,000
|
||||
Instantiation count: 2,500
|
||||
|
||||
=== contextualParamTypeVsNestedReturnTypeInference2.ts ===
|
||||
type Covariant<A> = (_: never) => A;
|
||||
>Covariant : Covariant<A>
|
||||
> : ^^^^^^^^^^^^
|
||||
>_ : never
|
||||
> : ^^^^^
|
||||
|
||||
interface Effect<out A, out E = never, out R = never> {
|
||||
readonly _A: Covariant<A>;
|
||||
>_A : Covariant<A>
|
||||
> : ^^^^^^^^^^^^
|
||||
|
||||
readonly _E: Covariant<E>;
|
||||
>_E : Covariant<E>
|
||||
> : ^^^^^^^^^^^^
|
||||
|
||||
readonly _R: Covariant<R>;
|
||||
>_R : Covariant<R>
|
||||
> : ^^^^^^^^^^^^
|
||||
}
|
||||
|
||||
declare function effectGen<Eff extends Effect<any, any, any>, AEff>(
|
||||
>effectGen : <Eff extends Effect<any, any, any>, AEff>(f: () => Generator<Eff, AEff, never>) => Effect<AEff, [Eff] extends [never] ? never : [Eff] extends [Effect<infer _A, infer E, infer _R>] ? E : never, [Eff] extends [never] ? never : [Eff] extends [Effect<infer _A, infer _E, infer R>] ? R : never>
|
||||
> : ^ ^^^^^^^^^ ^^ ^^ ^^ ^^^^^
|
||||
|
||||
f: () => Generator<Eff, AEff, never>
|
||||
>f : () => Generator<Eff, AEff, never>
|
||||
> : ^^^^^^
|
||||
|
||||
): Effect<
|
||||
AEff,
|
||||
[Eff] extends [never]
|
||||
? never
|
||||
: [Eff] extends [Effect<infer _A, infer E, infer _R>]
|
||||
? E
|
||||
: never,
|
||||
[Eff] extends [never]
|
||||
? never
|
||||
: [Eff] extends [Effect<infer _A, infer _E, infer R>]
|
||||
? R
|
||||
: never
|
||||
>;
|
||||
|
||||
declare function effectFn<
|
||||
>effectFn : <Eff extends Effect<any, any, any>, AEff, Args extends Array<any>>(body: (...args: Args) => Generator<Eff, AEff, never>) => (...args: Args) => Effect<AEff, [Eff] extends [never] ? never : [Eff] extends [Effect<infer _A, infer E, infer _R>] ? E : never, [Eff] extends [never] ? never : [Eff] extends [Effect<infer _A, infer _E, infer R>] ? R : never>
|
||||
> : ^ ^^^^^^^^^ ^^ ^^ ^^^^^^^^^ ^^ ^^ ^^^^^
|
||||
|
||||
Eff extends Effect<any, any, any>,
|
||||
AEff,
|
||||
Args extends Array<any>
|
||||
>(
|
||||
body: (...args: Args) => Generator<Eff, AEff, never>
|
||||
>body : (...args: Args) => Generator<Eff, AEff, never>
|
||||
> : ^^^^ ^^ ^^^^^
|
||||
>args : Args
|
||||
> : ^^^^
|
||||
|
||||
): (
|
||||
...args: Args
|
||||
>args : Args
|
||||
> : ^^^^
|
||||
|
||||
) => Effect<
|
||||
AEff,
|
||||
[Eff] extends [never]
|
||||
? never
|
||||
: [Eff] extends [Effect<infer _A, infer E, infer _R>]
|
||||
? E
|
||||
: never,
|
||||
[Eff] extends [never]
|
||||
? never
|
||||
: [Eff] extends [Effect<infer _A, infer _E, infer R>]
|
||||
? R
|
||||
: never
|
||||
>;
|
||||
|
||||
interface Tag<in out Id, in out Value> {
|
||||
readonly _op: "Tag";
|
||||
>_op : "Tag"
|
||||
> : ^^^^^
|
||||
|
||||
readonly Service: Value;
|
||||
>Service : Value
|
||||
> : ^^^^^
|
||||
|
||||
readonly Identifier: Id;
|
||||
>Identifier : Id
|
||||
> : ^^
|
||||
}
|
||||
|
||||
interface TagClassShape<Id, Shape> {
|
||||
readonly Type: Shape;
|
||||
>Type : Shape
|
||||
> : ^^^^^
|
||||
|
||||
readonly Id: Id;
|
||||
>Id : Id
|
||||
> : ^^
|
||||
}
|
||||
|
||||
interface TagClass<Self, Id extends string, Type> extends Tag<Self, Type> {
|
||||
new (_: never): TagClassShape<Id, Type>;
|
||||
>_ : never
|
||||
> : ^^^^^
|
||||
|
||||
readonly key: Id;
|
||||
>key : Id
|
||||
> : ^^
|
||||
}
|
||||
|
||||
declare function layerEffect<I, S, E, R>(
|
||||
>layerEffect : <I, S, E, R>(tag: Tag<I, S>, effect: Effect<S, E, R>) => unknown
|
||||
> : ^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^^^^
|
||||
|
||||
tag: Tag<I, S>,
|
||||
>tag : Tag<I, S>
|
||||
> : ^^^^^^^^^
|
||||
|
||||
effect: Effect<S, E, R>
|
||||
>effect : Effect<S, E, R>
|
||||
> : ^^^^^^^^^^^^^^^
|
||||
|
||||
): unknown;
|
||||
|
||||
declare function Tag<const Id extends string>(
|
||||
>Tag : <const Id extends string>(id: Id) => <Self, Shape>() => TagClass<Self, Id, Shape>
|
||||
> : ^^^^^^^ ^^^^^^^^^ ^^ ^^ ^^^^^
|
||||
|
||||
id: Id
|
||||
>id : Id
|
||||
> : ^^
|
||||
|
||||
): <Self, Shape>() => TagClass<Self, Id, Shape>;
|
||||
|
||||
class Foo extends Tag("Foo")<
|
||||
>Foo : Foo
|
||||
> : ^^^
|
||||
>Tag("Foo")< Foo, { fn: (a: string) => Effect<void>; }>() : TagClassShape<"Foo", { fn: (a: string) => Effect<void>; }>
|
||||
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^
|
||||
>Tag("Foo") : <Self, Shape>() => TagClass<Self, "Foo", Shape>
|
||||
> : ^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
>Tag : <const Id extends string>(id: Id) => <Self, Shape>() => TagClass<Self, Id, Shape>
|
||||
> : ^^^^^^^ ^^^^^^^^^ ^^ ^^ ^^^^^
|
||||
>"Foo" : "Foo"
|
||||
> : ^^^^^
|
||||
|
||||
Foo,
|
||||
{
|
||||
fn: (a: string) => Effect<void>;
|
||||
>fn : (a: string) => Effect<void>
|
||||
> : ^ ^^ ^^^^^
|
||||
>a : string
|
||||
> : ^^^^^^
|
||||
}
|
||||
>() {}
|
||||
|
||||
layerEffect(
|
||||
>layerEffect( Foo, effectGen(function* () { return { fn: effectFn(function* (a) { a; // string }), }; })) : unknown
|
||||
> : ^^^^^^^
|
||||
>layerEffect : <I, S, E, R>(tag: Tag<I, S>, effect: Effect<S, E, R>) => unknown
|
||||
> : ^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^^^^
|
||||
|
||||
Foo,
|
||||
>Foo : typeof Foo
|
||||
> : ^^^^^^^^^^
|
||||
|
||||
effectGen(function* () {
|
||||
>effectGen(function* () { return { fn: effectFn(function* (a) { a; // string }), }; }) : Effect<{ fn: (a: string) => Effect<void, never, never>; }, never, never>
|
||||
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
>effectGen : <Eff extends Effect<any, any, any>, AEff>(f: () => Generator<Eff, AEff, never>) => Effect<AEff, [Eff] extends [never] ? never : [Eff] extends [Effect<infer _A, infer E, infer _R>] ? E : never, [Eff] extends [never] ? never : [Eff] extends [Effect<infer _A, infer _E, infer R>] ? R : never>
|
||||
> : ^ ^^^^^^^^^ ^^ ^^ ^^ ^^^^^
|
||||
>function* () { return { fn: effectFn(function* (a) { a; // string }), }; } : () => Generator<never, { fn: (a: string) => Effect<void, never, never>; }, never>
|
||||
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
return {
|
||||
>{ fn: effectFn(function* (a) { a; // string }), } : { fn: (a: string) => Effect<void, never, never>; }
|
||||
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
fn: effectFn(function* (a) {
|
||||
>fn : (a: string) => Effect<void, never, never>
|
||||
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
>effectFn(function* (a) { a; // string }) : (a: string) => Effect<void, never, never>
|
||||
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
>effectFn : <Eff extends Effect<any, any, any>, AEff, Args extends Array<any>>(body: (...args: Args) => Generator<Eff, AEff, never>) => (...args: Args) => Effect<AEff, [Eff] extends [never] ? never : [Eff] extends [Effect<infer _A, infer E, infer _R>] ? E : never, [Eff] extends [never] ? never : [Eff] extends [Effect<infer _A, infer _E, infer R>] ? R : never>
|
||||
> : ^ ^^^^^^^^^ ^^ ^^ ^^^^^^^^^ ^^ ^^ ^^^^^
|
||||
>function* (a) { a; // string } : (a: string) => Generator<never, void, never>
|
||||
> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
>a : string
|
||||
> : ^^^^^^
|
||||
|
||||
a; // string
|
||||
>a : string
|
||||
> : ^^^^^^
|
||||
|
||||
}),
|
||||
};
|
||||
})
|
||||
);
|
||||
|
||||
@ -0,0 +1,245 @@
|
||||
//// [tests/cases/compiler/contextualParamTypeVsNestedReturnTypeInference3.ts] ////
|
||||
|
||||
=== contextualParamTypeVsNestedReturnTypeInference3.ts ===
|
||||
type Covariant<A> = (_: never) => A;
|
||||
>Covariant : Symbol(Covariant, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 0, 0))
|
||||
>A : Symbol(A, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 0, 15))
|
||||
>_ : Symbol(_, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 0, 21))
|
||||
>A : Symbol(A, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 0, 15))
|
||||
|
||||
interface Effect<out A, out E = never, out R = never> {
|
||||
>Effect : Symbol(Effect, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 0, 36))
|
||||
>A : Symbol(A, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 2, 17))
|
||||
>E : Symbol(E, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 2, 23))
|
||||
>R : Symbol(R, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 2, 38))
|
||||
|
||||
readonly _A: Covariant<A>;
|
||||
>_A : Symbol(Effect._A, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 2, 55))
|
||||
>Covariant : Symbol(Covariant, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 0, 0))
|
||||
>A : Symbol(A, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 2, 17))
|
||||
|
||||
readonly _E: Covariant<E>;
|
||||
>_E : Symbol(Effect._E, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 3, 28))
|
||||
>Covariant : Symbol(Covariant, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 0, 0))
|
||||
>E : Symbol(E, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 2, 23))
|
||||
|
||||
readonly _R: Covariant<R>;
|
||||
>_R : Symbol(Effect._R, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 4, 28))
|
||||
>Covariant : Symbol(Covariant, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 0, 0))
|
||||
>R : Symbol(R, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 2, 38))
|
||||
}
|
||||
|
||||
declare function effectGen<Eff extends Effect<any, any, any>, AEff>(
|
||||
>effectGen : Symbol(effectGen, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 6, 1))
|
||||
>Eff : Symbol(Eff, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 8, 27))
|
||||
>Effect : Symbol(Effect, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 0, 36))
|
||||
>AEff : Symbol(AEff, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 8, 61))
|
||||
|
||||
f: () => Generator<Eff, AEff, never>,
|
||||
>f : Symbol(f, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 8, 68))
|
||||
>Generator : Symbol(Generator, Decl(lib.es2015.generator.d.ts, --, --))
|
||||
>Eff : Symbol(Eff, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 8, 27))
|
||||
>AEff : Symbol(AEff, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 8, 61))
|
||||
|
||||
): Effect<
|
||||
>Effect : Symbol(Effect, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 0, 36))
|
||||
|
||||
AEff,
|
||||
>AEff : Symbol(AEff, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 8, 61))
|
||||
|
||||
[Eff] extends [Effect<infer _A, infer E, infer _R>] ? E : never,
|
||||
>Eff : Symbol(Eff, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 8, 27))
|
||||
>Effect : Symbol(Effect, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 0, 36))
|
||||
>_A : Symbol(_A, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 12, 29))
|
||||
>E : Symbol(E, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 12, 39))
|
||||
>_R : Symbol(_R, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 12, 48))
|
||||
>E : Symbol(E, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 12, 39))
|
||||
|
||||
[Eff] extends [Effect<infer _A, infer _E, infer R>] ? R : never
|
||||
>Eff : Symbol(Eff, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 8, 27))
|
||||
>Effect : Symbol(Effect, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 0, 36))
|
||||
>_A : Symbol(_A, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 13, 29))
|
||||
>_E : Symbol(_E, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 13, 39))
|
||||
>R : Symbol(R, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 13, 49))
|
||||
>R : Symbol(R, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 13, 49))
|
||||
|
||||
>;
|
||||
|
||||
declare function effectFn<
|
||||
>effectFn : Symbol(effectFn, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 14, 2))
|
||||
|
||||
Eff extends Effect<any, any, any>,
|
||||
>Eff : Symbol(Eff, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 16, 26))
|
||||
>Effect : Symbol(Effect, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 0, 36))
|
||||
|
||||
AEff,
|
||||
>AEff : Symbol(AEff, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 17, 36))
|
||||
|
||||
Args extends Array<any>,
|
||||
>Args : Symbol(Args, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 18, 7))
|
||||
>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 4 more)
|
||||
|
||||
>(
|
||||
body: (...args: Args) => Generator<Eff, AEff, never>,
|
||||
>body : Symbol(body, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 20, 2))
|
||||
>args : Symbol(args, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 21, 9))
|
||||
>Args : Symbol(Args, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 18, 7))
|
||||
>Generator : Symbol(Generator, Decl(lib.es2015.generator.d.ts, --, --))
|
||||
>Eff : Symbol(Eff, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 16, 26))
|
||||
>AEff : Symbol(AEff, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 17, 36))
|
||||
|
||||
): (
|
||||
...args: Args
|
||||
>args : Symbol(args, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 22, 4))
|
||||
>Args : Symbol(Args, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 18, 7))
|
||||
|
||||
) => Effect<
|
||||
>Effect : Symbol(Effect, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 0, 36))
|
||||
|
||||
AEff,
|
||||
>AEff : Symbol(AEff, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 17, 36))
|
||||
|
||||
[Eff] extends [Effect<infer _A, infer E, infer _R>] ? E : never,
|
||||
>Eff : Symbol(Eff, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 16, 26))
|
||||
>Effect : Symbol(Effect, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 0, 36))
|
||||
>_A : Symbol(_A, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 26, 29))
|
||||
>E : Symbol(E, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 26, 39))
|
||||
>_R : Symbol(_R, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 26, 48))
|
||||
>E : Symbol(E, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 26, 39))
|
||||
|
||||
[Eff] extends [Effect<infer _A, infer _E, infer R>] ? R : never
|
||||
>Eff : Symbol(Eff, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 16, 26))
|
||||
>Effect : Symbol(Effect, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 0, 36))
|
||||
>_A : Symbol(_A, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 27, 29))
|
||||
>_E : Symbol(_E, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 27, 39))
|
||||
>R : Symbol(R, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 27, 49))
|
||||
>R : Symbol(R, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 27, 49))
|
||||
|
||||
>;
|
||||
|
||||
interface Tag<in out Id, in out Value> {
|
||||
>Tag : Symbol(Tag, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 49, 11), Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 28, 2))
|
||||
>Id : Symbol(Id, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 30, 14))
|
||||
>Value : Symbol(Value, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 30, 24))
|
||||
|
||||
readonly _op: "Tag";
|
||||
>_op : Symbol(Tag._op, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 30, 40))
|
||||
|
||||
readonly Service: Value;
|
||||
>Service : Symbol(Tag.Service, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 31, 22))
|
||||
>Value : Symbol(Value, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 30, 24))
|
||||
|
||||
readonly Identifier: Id;
|
||||
>Identifier : Symbol(Tag.Identifier, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 32, 26))
|
||||
>Id : Symbol(Id, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 30, 14))
|
||||
}
|
||||
|
||||
interface TagClassShape<Id, Shape> {
|
||||
>TagClassShape : Symbol(TagClassShape, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 34, 1))
|
||||
>Id : Symbol(Id, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 36, 24), Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 37, 23))
|
||||
>Shape : Symbol(Shape, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 36, 27))
|
||||
|
||||
readonly Type: Shape;
|
||||
>Type : Symbol(TagClassShape.Type, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 36, 36))
|
||||
>Shape : Symbol(Shape, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 36, 27))
|
||||
|
||||
readonly Id: Id;
|
||||
>Id : Symbol(Id, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 36, 24), Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 37, 23))
|
||||
>Id : Symbol(Id, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 36, 24), Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 37, 23))
|
||||
}
|
||||
|
||||
interface TagClass<Self, Id extends string, Type> extends Tag<Self, Type> {
|
||||
>TagClass : Symbol(TagClass, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 39, 1))
|
||||
>Self : Symbol(Self, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 41, 19))
|
||||
>Id : Symbol(Id, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 41, 24))
|
||||
>Type : Symbol(Type, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 41, 43))
|
||||
>Tag : Symbol(Tag, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 49, 11), Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 28, 2))
|
||||
>Self : Symbol(Self, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 41, 19))
|
||||
>Type : Symbol(Type, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 41, 43))
|
||||
|
||||
new (_: never): TagClassShape<Id, Type>;
|
||||
>_ : Symbol(_, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 42, 7))
|
||||
>TagClassShape : Symbol(TagClassShape, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 34, 1))
|
||||
>Id : Symbol(Id, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 41, 24))
|
||||
>Type : Symbol(Type, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 41, 43))
|
||||
|
||||
readonly key: Id;
|
||||
>key : Symbol(TagClass.key, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 42, 42))
|
||||
>Id : Symbol(Id, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 41, 24))
|
||||
}
|
||||
|
||||
declare function layerEffect<I, S, E, R>(
|
||||
>layerEffect : Symbol(layerEffect, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 44, 1))
|
||||
>I : Symbol(I, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 46, 29))
|
||||
>S : Symbol(S, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 46, 31))
|
||||
>E : Symbol(E, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 46, 34))
|
||||
>R : Symbol(R, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 46, 37))
|
||||
|
||||
tag: Tag<I, S>,
|
||||
>tag : Symbol(tag, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 46, 41))
|
||||
>Tag : Symbol(Tag, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 49, 11), Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 28, 2))
|
||||
>I : Symbol(I, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 46, 29))
|
||||
>S : Symbol(S, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 46, 31))
|
||||
|
||||
effect: Effect<S, E, R>,
|
||||
>effect : Symbol(effect, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 47, 17))
|
||||
>Effect : Symbol(Effect, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 0, 36))
|
||||
>S : Symbol(S, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 46, 31))
|
||||
>E : Symbol(E, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 46, 34))
|
||||
>R : Symbol(R, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 46, 37))
|
||||
|
||||
): unknown;
|
||||
|
||||
declare function Tag<const Id extends string>(
|
||||
>Tag : Symbol(Tag, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 49, 11), Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 28, 2))
|
||||
>Id : Symbol(Id, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 51, 21))
|
||||
|
||||
id: Id,
|
||||
>id : Symbol(id, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 51, 46))
|
||||
>Id : Symbol(Id, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 51, 21))
|
||||
|
||||
): <Self, Shape>() => TagClass<Self, Id, Shape>;
|
||||
>Self : Symbol(Self, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 53, 4))
|
||||
>Shape : Symbol(Shape, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 53, 9))
|
||||
>TagClass : Symbol(TagClass, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 39, 1))
|
||||
>Self : Symbol(Self, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 53, 4))
|
||||
>Id : Symbol(Id, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 51, 21))
|
||||
>Shape : Symbol(Shape, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 53, 9))
|
||||
|
||||
class Foo extends Tag("Foo")<
|
||||
>Foo : Symbol(Foo, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 53, 48))
|
||||
>Tag : Symbol(Tag, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 49, 11), Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 28, 2))
|
||||
|
||||
Foo,
|
||||
>Foo : Symbol(Foo, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 53, 48))
|
||||
{
|
||||
fn: (a: string) => Effect<void>;
|
||||
>fn : Symbol(fn, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 57, 3))
|
||||
>a : Symbol(a, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 58, 9))
|
||||
>Effect : Symbol(Effect, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 0, 36))
|
||||
}
|
||||
>() {}
|
||||
|
||||
layerEffect(
|
||||
>layerEffect : Symbol(layerEffect, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 44, 1))
|
||||
|
||||
Foo,
|
||||
>Foo : Symbol(Foo, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 53, 48))
|
||||
|
||||
effectGen(function* () {
|
||||
>effectGen : Symbol(effectGen, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 6, 1))
|
||||
|
||||
return {
|
||||
fn: effectFn(function* (a) {
|
||||
>fn : Symbol(fn, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 65, 12))
|
||||
>effectFn : Symbol(effectFn, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 14, 2))
|
||||
>a : Symbol(a, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 66, 30))
|
||||
|
||||
a; // string
|
||||
>a : Symbol(a, Decl(contextualParamTypeVsNestedReturnTypeInference3.ts, 66, 30))
|
||||
|
||||
}),
|
||||
};
|
||||
}),
|
||||
);
|
||||
|
||||
@ -0,0 +1,189 @@
|
||||
//// [tests/cases/compiler/contextualParamTypeVsNestedReturnTypeInference3.ts] ////
|
||||
|
||||
=== Performance Stats ===
|
||||
Type Count: 1,000
|
||||
Instantiation count: 2,500
|
||||
|
||||
=== contextualParamTypeVsNestedReturnTypeInference3.ts ===
|
||||
type Covariant<A> = (_: never) => A;
|
||||
>Covariant : Covariant<A>
|
||||
> : ^^^^^^^^^^^^
|
||||
>_ : never
|
||||
> : ^^^^^
|
||||
|
||||
interface Effect<out A, out E = never, out R = never> {
|
||||
readonly _A: Covariant<A>;
|
||||
>_A : Covariant<A>
|
||||
> : ^^^^^^^^^^^^
|
||||
|
||||
readonly _E: Covariant<E>;
|
||||
>_E : Covariant<E>
|
||||
> : ^^^^^^^^^^^^
|
||||
|
||||
readonly _R: Covariant<R>;
|
||||
>_R : Covariant<R>
|
||||
> : ^^^^^^^^^^^^
|
||||
}
|
||||
|
||||
declare function effectGen<Eff extends Effect<any, any, any>, AEff>(
|
||||
>effectGen : <Eff extends Effect<any, any, any>, AEff>(f: () => Generator<Eff, AEff, never>) => Effect<AEff, [Eff] extends [Effect<infer _A, infer E, infer _R>] ? E : never, [Eff] extends [Effect<infer _A, infer _E, infer R>] ? R : never>
|
||||
> : ^ ^^^^^^^^^ ^^ ^^ ^^ ^^^^^
|
||||
|
||||
f: () => Generator<Eff, AEff, never>,
|
||||
>f : () => Generator<Eff, AEff, never>
|
||||
> : ^^^^^^
|
||||
|
||||
): Effect<
|
||||
AEff,
|
||||
[Eff] extends [Effect<infer _A, infer E, infer _R>] ? E : never,
|
||||
[Eff] extends [Effect<infer _A, infer _E, infer R>] ? R : never
|
||||
>;
|
||||
|
||||
declare function effectFn<
|
||||
>effectFn : <Eff extends Effect<any, any, any>, AEff, Args extends Array<any>>(body: (...args: Args) => Generator<Eff, AEff, never>) => (...args: Args) => Effect<AEff, [Eff] extends [Effect<infer _A, infer E, infer _R>] ? E : never, [Eff] extends [Effect<infer _A, infer _E, infer R>] ? R : never>
|
||||
> : ^ ^^^^^^^^^ ^^ ^^ ^^^^^^^^^ ^^ ^^ ^^^^^
|
||||
|
||||
Eff extends Effect<any, any, any>,
|
||||
AEff,
|
||||
Args extends Array<any>,
|
||||
>(
|
||||
body: (...args: Args) => Generator<Eff, AEff, never>,
|
||||
>body : (...args: Args) => Generator<Eff, AEff, never>
|
||||
> : ^^^^ ^^ ^^^^^
|
||||
>args : Args
|
||||
> : ^^^^
|
||||
|
||||
): (
|
||||
...args: Args
|
||||
>args : Args
|
||||
> : ^^^^
|
||||
|
||||
) => Effect<
|
||||
AEff,
|
||||
[Eff] extends [Effect<infer _A, infer E, infer _R>] ? E : never,
|
||||
[Eff] extends [Effect<infer _A, infer _E, infer R>] ? R : never
|
||||
>;
|
||||
|
||||
interface Tag<in out Id, in out Value> {
|
||||
readonly _op: "Tag";
|
||||
>_op : "Tag"
|
||||
> : ^^^^^
|
||||
|
||||
readonly Service: Value;
|
||||
>Service : Value
|
||||
> : ^^^^^
|
||||
|
||||
readonly Identifier: Id;
|
||||
>Identifier : Id
|
||||
> : ^^
|
||||
}
|
||||
|
||||
interface TagClassShape<Id, Shape> {
|
||||
readonly Type: Shape;
|
||||
>Type : Shape
|
||||
> : ^^^^^
|
||||
|
||||
readonly Id: Id;
|
||||
>Id : Id
|
||||
> : ^^
|
||||
}
|
||||
|
||||
interface TagClass<Self, Id extends string, Type> extends Tag<Self, Type> {
|
||||
new (_: never): TagClassShape<Id, Type>;
|
||||
>_ : never
|
||||
> : ^^^^^
|
||||
|
||||
readonly key: Id;
|
||||
>key : Id
|
||||
> : ^^
|
||||
}
|
||||
|
||||
declare function layerEffect<I, S, E, R>(
|
||||
>layerEffect : <I, S, E, R>(tag: Tag<I, S>, effect: Effect<S, E, R>) => unknown
|
||||
> : ^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^^^^
|
||||
|
||||
tag: Tag<I, S>,
|
||||
>tag : Tag<I, S>
|
||||
> : ^^^^^^^^^
|
||||
|
||||
effect: Effect<S, E, R>,
|
||||
>effect : Effect<S, E, R>
|
||||
> : ^^^^^^^^^^^^^^^
|
||||
|
||||
): unknown;
|
||||
|
||||
declare function Tag<const Id extends string>(
|
||||
>Tag : <const Id extends string>(id: Id) => <Self, Shape>() => TagClass<Self, Id, Shape>
|
||||
> : ^^^^^^^ ^^^^^^^^^ ^^ ^^ ^^^^^
|
||||
|
||||
id: Id,
|
||||
>id : Id
|
||||
> : ^^
|
||||
|
||||
): <Self, Shape>() => TagClass<Self, Id, Shape>;
|
||||
|
||||
class Foo extends Tag("Foo")<
|
||||
>Foo : Foo
|
||||
> : ^^^
|
||||
>Tag("Foo")< Foo, { fn: (a: string) => Effect<void>; }>() : TagClassShape<"Foo", { fn: (a: string) => Effect<void>; }>
|
||||
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^
|
||||
>Tag("Foo") : <Self, Shape>() => TagClass<Self, "Foo", Shape>
|
||||
> : ^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
>Tag : <const Id extends string>(id: Id) => <Self, Shape>() => TagClass<Self, Id, Shape>
|
||||
> : ^^^^^^^ ^^^^^^^^^ ^^ ^^ ^^^^^
|
||||
>"Foo" : "Foo"
|
||||
> : ^^^^^
|
||||
|
||||
Foo,
|
||||
{
|
||||
fn: (a: string) => Effect<void>;
|
||||
>fn : (a: string) => Effect<void>
|
||||
> : ^ ^^ ^^^^^
|
||||
>a : string
|
||||
> : ^^^^^^
|
||||
}
|
||||
>() {}
|
||||
|
||||
layerEffect(
|
||||
>layerEffect( Foo, effectGen(function* () { return { fn: effectFn(function* (a) { a; // string }), }; }),) : unknown
|
||||
> : ^^^^^^^
|
||||
>layerEffect : <I, S, E, R>(tag: Tag<I, S>, effect: Effect<S, E, R>) => unknown
|
||||
> : ^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^^^^
|
||||
|
||||
Foo,
|
||||
>Foo : typeof Foo
|
||||
> : ^^^^^^^^^^
|
||||
|
||||
effectGen(function* () {
|
||||
>effectGen(function* () { return { fn: effectFn(function* (a) { a; // string }), }; }) : Effect<{ fn: (a: string) => Effect<void, unknown, unknown>; }, unknown, unknown>
|
||||
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
>effectGen : <Eff extends Effect<any, any, any>, AEff>(f: () => Generator<Eff, AEff, never>) => Effect<AEff, [Eff] extends [Effect<infer _A, infer E, infer _R>] ? E : never, [Eff] extends [Effect<infer _A, infer _E, infer R>] ? R : never>
|
||||
> : ^ ^^^^^^^^^ ^^ ^^ ^^ ^^^^^
|
||||
>function* () { return { fn: effectFn(function* (a) { a; // string }), }; } : () => Generator<never, { fn: (a: string) => Effect<void, unknown, unknown>; }, never>
|
||||
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
return {
|
||||
>{ fn: effectFn(function* (a) { a; // string }), } : { fn: (a: string) => Effect<void, unknown, unknown>; }
|
||||
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
fn: effectFn(function* (a) {
|
||||
>fn : (a: string) => Effect<void, unknown, unknown>
|
||||
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
>effectFn(function* (a) { a; // string }) : (a: string) => Effect<void, unknown, unknown>
|
||||
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
>effectFn : <Eff extends Effect<any, any, any>, AEff, Args extends Array<any>>(body: (...args: Args) => Generator<Eff, AEff, never>) => (...args: Args) => Effect<AEff, [Eff] extends [Effect<infer _A, infer E, infer _R>] ? E : never, [Eff] extends [Effect<infer _A, infer _E, infer R>] ? R : never>
|
||||
> : ^ ^^^^^^^^^ ^^ ^^ ^^^^^^^^^ ^^ ^^ ^^^^^
|
||||
>function* (a) { a; // string } : (a: string) => Generator<never, void, never>
|
||||
> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
>a : string
|
||||
> : ^^^^^^
|
||||
|
||||
a; // string
|
||||
>a : string
|
||||
> : ^^^^^^
|
||||
|
||||
}),
|
||||
};
|
||||
}),
|
||||
);
|
||||
|
||||
@ -0,0 +1,207 @@
|
||||
//// [tests/cases/compiler/contextualParamTypeVsNestedReturnTypeInference4.ts] ////
|
||||
|
||||
=== contextualParamTypeVsNestedReturnTypeInference4.ts ===
|
||||
type Covariant<A> = (_: never) => A;
|
||||
>Covariant : Symbol(Covariant, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 0, 0))
|
||||
>A : Symbol(A, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 0, 15))
|
||||
>_ : Symbol(_, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 0, 21))
|
||||
>A : Symbol(A, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 0, 15))
|
||||
|
||||
interface Effect<out A, out E = never, out R = never> {
|
||||
>Effect : Symbol(Effect, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 0, 36))
|
||||
>A : Symbol(A, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 2, 17))
|
||||
>E : Symbol(E, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 2, 23))
|
||||
>R : Symbol(R, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 2, 38))
|
||||
|
||||
readonly _A: Covariant<A>;
|
||||
>_A : Symbol(Effect._A, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 2, 55))
|
||||
>Covariant : Symbol(Covariant, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 0, 0))
|
||||
>A : Symbol(A, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 2, 17))
|
||||
|
||||
readonly _E: Covariant<E>;
|
||||
>_E : Symbol(Effect._E, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 3, 28))
|
||||
>Covariant : Symbol(Covariant, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 0, 0))
|
||||
>E : Symbol(E, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 2, 23))
|
||||
|
||||
readonly _R: Covariant<R>;
|
||||
>_R : Symbol(Effect._R, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 4, 28))
|
||||
>Covariant : Symbol(Covariant, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 0, 0))
|
||||
>R : Symbol(R, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 2, 38))
|
||||
}
|
||||
|
||||
declare function effectGen<A, E, R, AEff>(
|
||||
>effectGen : Symbol(effectGen, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 6, 1))
|
||||
>A : Symbol(A, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 8, 27))
|
||||
>E : Symbol(E, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 8, 29))
|
||||
>R : Symbol(R, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 8, 32))
|
||||
>AEff : Symbol(AEff, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 8, 35))
|
||||
|
||||
f: () => Generator<Effect<A, E, R>, AEff, never>,
|
||||
>f : Symbol(f, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 8, 42))
|
||||
>Generator : Symbol(Generator, Decl(lib.es2015.generator.d.ts, --, --))
|
||||
>Effect : Symbol(Effect, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 0, 36))
|
||||
>A : Symbol(A, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 8, 27))
|
||||
>E : Symbol(E, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 8, 29))
|
||||
>R : Symbol(R, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 8, 32))
|
||||
>AEff : Symbol(AEff, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 8, 35))
|
||||
|
||||
): Effect<AEff, E, R>;
|
||||
>Effect : Symbol(Effect, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 0, 36))
|
||||
>AEff : Symbol(AEff, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 8, 35))
|
||||
>E : Symbol(E, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 8, 29))
|
||||
>R : Symbol(R, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 8, 32))
|
||||
|
||||
declare function effectFn<A, E, R, AEff, Args extends Array<any>>(
|
||||
>effectFn : Symbol(effectFn, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 10, 22))
|
||||
>A : Symbol(A, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 12, 26))
|
||||
>E : Symbol(E, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 12, 28))
|
||||
>R : Symbol(R, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 12, 31))
|
||||
>AEff : Symbol(AEff, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 12, 34))
|
||||
>Args : Symbol(Args, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 12, 40))
|
||||
>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --) ... and 4 more)
|
||||
|
||||
body: (...args: Args) => Generator<Effect<A, E, R>, AEff, never>,
|
||||
>body : Symbol(body, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 12, 66))
|
||||
>args : Symbol(args, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 13, 9))
|
||||
>Args : Symbol(Args, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 12, 40))
|
||||
>Generator : Symbol(Generator, Decl(lib.es2015.generator.d.ts, --, --))
|
||||
>Effect : Symbol(Effect, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 0, 36))
|
||||
>A : Symbol(A, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 12, 26))
|
||||
>E : Symbol(E, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 12, 28))
|
||||
>R : Symbol(R, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 12, 31))
|
||||
>AEff : Symbol(AEff, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 12, 34))
|
||||
|
||||
): (...args: Args) => Effect<AEff, E, R>;
|
||||
>args : Symbol(args, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 14, 4))
|
||||
>Args : Symbol(Args, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 12, 40))
|
||||
>Effect : Symbol(Effect, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 0, 36))
|
||||
>AEff : Symbol(AEff, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 12, 34))
|
||||
>E : Symbol(E, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 12, 28))
|
||||
>R : Symbol(R, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 12, 31))
|
||||
|
||||
interface Tag<in out Id, in out Value> {
|
||||
>Tag : Symbol(Tag, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 35, 11), Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 14, 41))
|
||||
>Id : Symbol(Id, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 16, 14))
|
||||
>Value : Symbol(Value, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 16, 24))
|
||||
|
||||
readonly _op: "Tag";
|
||||
>_op : Symbol(Tag._op, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 16, 40))
|
||||
|
||||
readonly Service: Value;
|
||||
>Service : Symbol(Tag.Service, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 17, 22))
|
||||
>Value : Symbol(Value, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 16, 24))
|
||||
|
||||
readonly Identifier: Id;
|
||||
>Identifier : Symbol(Tag.Identifier, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 18, 26))
|
||||
>Id : Symbol(Id, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 16, 14))
|
||||
}
|
||||
|
||||
interface TagClassShape<Id, Shape> {
|
||||
>TagClassShape : Symbol(TagClassShape, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 20, 1))
|
||||
>Id : Symbol(Id, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 22, 24), Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 23, 23))
|
||||
>Shape : Symbol(Shape, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 22, 27))
|
||||
|
||||
readonly Type: Shape;
|
||||
>Type : Symbol(TagClassShape.Type, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 22, 36))
|
||||
>Shape : Symbol(Shape, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 22, 27))
|
||||
|
||||
readonly Id: Id;
|
||||
>Id : Symbol(Id, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 22, 24), Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 23, 23))
|
||||
>Id : Symbol(Id, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 22, 24), Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 23, 23))
|
||||
}
|
||||
|
||||
interface TagClass<Self, Id extends string, Type> extends Tag<Self, Type> {
|
||||
>TagClass : Symbol(TagClass, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 25, 1))
|
||||
>Self : Symbol(Self, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 27, 19))
|
||||
>Id : Symbol(Id, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 27, 24))
|
||||
>Type : Symbol(Type, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 27, 43))
|
||||
>Tag : Symbol(Tag, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 35, 11), Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 14, 41))
|
||||
>Self : Symbol(Self, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 27, 19))
|
||||
>Type : Symbol(Type, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 27, 43))
|
||||
|
||||
new (_: never): TagClassShape<Id, Type>;
|
||||
>_ : Symbol(_, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 28, 7))
|
||||
>TagClassShape : Symbol(TagClassShape, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 20, 1))
|
||||
>Id : Symbol(Id, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 27, 24))
|
||||
>Type : Symbol(Type, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 27, 43))
|
||||
|
||||
readonly key: Id;
|
||||
>key : Symbol(TagClass.key, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 28, 42))
|
||||
>Id : Symbol(Id, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 27, 24))
|
||||
}
|
||||
|
||||
declare function layerEffect<I, S, E, R>(
|
||||
>layerEffect : Symbol(layerEffect, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 30, 1))
|
||||
>I : Symbol(I, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 32, 29))
|
||||
>S : Symbol(S, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 32, 31))
|
||||
>E : Symbol(E, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 32, 34))
|
||||
>R : Symbol(R, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 32, 37))
|
||||
|
||||
tag: Tag<I, S>,
|
||||
>tag : Symbol(tag, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 32, 41))
|
||||
>Tag : Symbol(Tag, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 35, 11), Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 14, 41))
|
||||
>I : Symbol(I, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 32, 29))
|
||||
>S : Symbol(S, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 32, 31))
|
||||
|
||||
effect: Effect<S, E, R>,
|
||||
>effect : Symbol(effect, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 33, 17))
|
||||
>Effect : Symbol(Effect, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 0, 36))
|
||||
>S : Symbol(S, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 32, 31))
|
||||
>E : Symbol(E, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 32, 34))
|
||||
>R : Symbol(R, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 32, 37))
|
||||
|
||||
): unknown;
|
||||
|
||||
declare function Tag<const Id extends string>(
|
||||
>Tag : Symbol(Tag, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 35, 11), Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 14, 41))
|
||||
>Id : Symbol(Id, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 37, 21))
|
||||
|
||||
id: Id,
|
||||
>id : Symbol(id, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 37, 46))
|
||||
>Id : Symbol(Id, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 37, 21))
|
||||
|
||||
): <Self, Shape>() => TagClass<Self, Id, Shape>;
|
||||
>Self : Symbol(Self, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 39, 4))
|
||||
>Shape : Symbol(Shape, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 39, 9))
|
||||
>TagClass : Symbol(TagClass, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 25, 1))
|
||||
>Self : Symbol(Self, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 39, 4))
|
||||
>Id : Symbol(Id, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 37, 21))
|
||||
>Shape : Symbol(Shape, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 39, 9))
|
||||
|
||||
class Foo extends Tag("Foo")<
|
||||
>Foo : Symbol(Foo, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 39, 48))
|
||||
>Tag : Symbol(Tag, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 35, 11), Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 14, 41))
|
||||
|
||||
Foo,
|
||||
>Foo : Symbol(Foo, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 39, 48))
|
||||
{
|
||||
fn: (a: string) => Effect<void>;
|
||||
>fn : Symbol(fn, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 43, 3))
|
||||
>a : Symbol(a, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 44, 9))
|
||||
>Effect : Symbol(Effect, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 0, 36))
|
||||
}
|
||||
>() {}
|
||||
|
||||
layerEffect(
|
||||
>layerEffect : Symbol(layerEffect, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 30, 1))
|
||||
|
||||
Foo,
|
||||
>Foo : Symbol(Foo, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 39, 48))
|
||||
|
||||
effectGen(function* () {
|
||||
>effectGen : Symbol(effectGen, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 6, 1))
|
||||
|
||||
return {
|
||||
fn: effectFn(function* (a) {
|
||||
>fn : Symbol(fn, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 51, 12))
|
||||
>effectFn : Symbol(effectFn, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 10, 22))
|
||||
>a : Symbol(a, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 52, 30))
|
||||
|
||||
a; // string
|
||||
>a : Symbol(a, Decl(contextualParamTypeVsNestedReturnTypeInference4.ts, 52, 30))
|
||||
|
||||
}),
|
||||
};
|
||||
}),
|
||||
);
|
||||
|
||||
@ -0,0 +1,174 @@
|
||||
//// [tests/cases/compiler/contextualParamTypeVsNestedReturnTypeInference4.ts] ////
|
||||
|
||||
=== Performance Stats ===
|
||||
Type Count: 1,000
|
||||
Instantiation count: 2,500
|
||||
|
||||
=== contextualParamTypeVsNestedReturnTypeInference4.ts ===
|
||||
type Covariant<A> = (_: never) => A;
|
||||
>Covariant : Covariant<A>
|
||||
> : ^^^^^^^^^^^^
|
||||
>_ : never
|
||||
> : ^^^^^
|
||||
|
||||
interface Effect<out A, out E = never, out R = never> {
|
||||
readonly _A: Covariant<A>;
|
||||
>_A : Covariant<A>
|
||||
> : ^^^^^^^^^^^^
|
||||
|
||||
readonly _E: Covariant<E>;
|
||||
>_E : Covariant<E>
|
||||
> : ^^^^^^^^^^^^
|
||||
|
||||
readonly _R: Covariant<R>;
|
||||
>_R : Covariant<R>
|
||||
> : ^^^^^^^^^^^^
|
||||
}
|
||||
|
||||
declare function effectGen<A, E, R, AEff>(
|
||||
>effectGen : <A, E, R, AEff>(f: () => Generator<Effect<A, E, R>, AEff, never>) => Effect<AEff, E, R>
|
||||
> : ^ ^^ ^^ ^^ ^^ ^^ ^^^^^
|
||||
|
||||
f: () => Generator<Effect<A, E, R>, AEff, never>,
|
||||
>f : () => Generator<Effect<A, E, R>, AEff, never>
|
||||
> : ^^^^^^
|
||||
|
||||
): Effect<AEff, E, R>;
|
||||
|
||||
declare function effectFn<A, E, R, AEff, Args extends Array<any>>(
|
||||
>effectFn : <A, E, R, AEff, Args extends Array<any>>(body: (...args: Args) => Generator<Effect<A, E, R>, AEff, never>) => (...args: Args) => Effect<AEff, E, R>
|
||||
> : ^ ^^ ^^ ^^ ^^ ^^^^^^^^^ ^^ ^^ ^^^^^
|
||||
|
||||
body: (...args: Args) => Generator<Effect<A, E, R>, AEff, never>,
|
||||
>body : (...args: Args) => Generator<Effect<A, E, R>, AEff, never>
|
||||
> : ^^^^ ^^ ^^^^^
|
||||
>args : Args
|
||||
> : ^^^^
|
||||
|
||||
): (...args: Args) => Effect<AEff, E, R>;
|
||||
>args : Args
|
||||
> : ^^^^
|
||||
|
||||
interface Tag<in out Id, in out Value> {
|
||||
readonly _op: "Tag";
|
||||
>_op : "Tag"
|
||||
> : ^^^^^
|
||||
|
||||
readonly Service: Value;
|
||||
>Service : Value
|
||||
> : ^^^^^
|
||||
|
||||
readonly Identifier: Id;
|
||||
>Identifier : Id
|
||||
> : ^^
|
||||
}
|
||||
|
||||
interface TagClassShape<Id, Shape> {
|
||||
readonly Type: Shape;
|
||||
>Type : Shape
|
||||
> : ^^^^^
|
||||
|
||||
readonly Id: Id;
|
||||
>Id : Id
|
||||
> : ^^
|
||||
}
|
||||
|
||||
interface TagClass<Self, Id extends string, Type> extends Tag<Self, Type> {
|
||||
new (_: never): TagClassShape<Id, Type>;
|
||||
>_ : never
|
||||
> : ^^^^^
|
||||
|
||||
readonly key: Id;
|
||||
>key : Id
|
||||
> : ^^
|
||||
}
|
||||
|
||||
declare function layerEffect<I, S, E, R>(
|
||||
>layerEffect : <I, S, E, R>(tag: Tag<I, S>, effect: Effect<S, E, R>) => unknown
|
||||
> : ^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^^^^
|
||||
|
||||
tag: Tag<I, S>,
|
||||
>tag : Tag<I, S>
|
||||
> : ^^^^^^^^^
|
||||
|
||||
effect: Effect<S, E, R>,
|
||||
>effect : Effect<S, E, R>
|
||||
> : ^^^^^^^^^^^^^^^
|
||||
|
||||
): unknown;
|
||||
|
||||
declare function Tag<const Id extends string>(
|
||||
>Tag : <const Id extends string>(id: Id) => <Self, Shape>() => TagClass<Self, Id, Shape>
|
||||
> : ^^^^^^^ ^^^^^^^^^ ^^ ^^ ^^^^^
|
||||
|
||||
id: Id,
|
||||
>id : Id
|
||||
> : ^^
|
||||
|
||||
): <Self, Shape>() => TagClass<Self, Id, Shape>;
|
||||
|
||||
class Foo extends Tag("Foo")<
|
||||
>Foo : Foo
|
||||
> : ^^^
|
||||
>Tag("Foo")< Foo, { fn: (a: string) => Effect<void>; }>() : TagClassShape<"Foo", { fn: (a: string) => Effect<void>; }>
|
||||
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^
|
||||
>Tag("Foo") : <Self, Shape>() => TagClass<Self, "Foo", Shape>
|
||||
> : ^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
>Tag : <const Id extends string>(id: Id) => <Self, Shape>() => TagClass<Self, Id, Shape>
|
||||
> : ^^^^^^^ ^^^^^^^^^ ^^ ^^ ^^^^^
|
||||
>"Foo" : "Foo"
|
||||
> : ^^^^^
|
||||
|
||||
Foo,
|
||||
{
|
||||
fn: (a: string) => Effect<void>;
|
||||
>fn : (a: string) => Effect<void>
|
||||
> : ^ ^^ ^^^^^
|
||||
>a : string
|
||||
> : ^^^^^^
|
||||
}
|
||||
>() {}
|
||||
|
||||
layerEffect(
|
||||
>layerEffect( Foo, effectGen(function* () { return { fn: effectFn(function* (a) { a; // string }), }; }),) : unknown
|
||||
> : ^^^^^^^
|
||||
>layerEffect : <I, S, E, R>(tag: Tag<I, S>, effect: Effect<S, E, R>) => unknown
|
||||
> : ^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^^^^
|
||||
|
||||
Foo,
|
||||
>Foo : typeof Foo
|
||||
> : ^^^^^^^^^^
|
||||
|
||||
effectGen(function* () {
|
||||
>effectGen(function* () { return { fn: effectFn(function* (a) { a; // string }), }; }) : Effect<{ fn: (a: string) => Effect<void, never, never>; }, unknown, unknown>
|
||||
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
>effectGen : <A, E, R, AEff>(f: () => Generator<Effect<A, E, R>, AEff, never>) => Effect<AEff, E, R>
|
||||
> : ^ ^^ ^^ ^^ ^^ ^^ ^^^^^
|
||||
>function* () { return { fn: effectFn(function* (a) { a; // string }), }; } : () => Generator<never, { fn: (a: string) => Effect<void, never, never>; }, never>
|
||||
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
return {
|
||||
>{ fn: effectFn(function* (a) { a; // string }), } : { fn: (a: string) => Effect<void, never, never>; }
|
||||
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
fn: effectFn(function* (a) {
|
||||
>fn : (a: string) => Effect<void, never, never>
|
||||
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
>effectFn(function* (a) { a; // string }) : (a: string) => Effect<void, never, never>
|
||||
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
>effectFn : <A, E, R, AEff, Args extends Array<any>>(body: (...args: Args) => Generator<Effect<A, E, R>, AEff, never>) => (...args: Args) => Effect<AEff, E, R>
|
||||
> : ^ ^^ ^^ ^^ ^^ ^^^^^^^^^ ^^ ^^ ^^^^^
|
||||
>function* (a) { a; // string } : (a: string) => Generator<never, void, never>
|
||||
> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
>a : string
|
||||
> : ^^^^^^
|
||||
|
||||
a; // string
|
||||
>a : string
|
||||
> : ^^^^^^
|
||||
|
||||
}),
|
||||
};
|
||||
}),
|
||||
);
|
||||
|
||||
@ -0,0 +1,34 @@
|
||||
// @strict: true
|
||||
// @target: esnext
|
||||
// @noEmit: true
|
||||
|
||||
interface Effect<A> {
|
||||
_A: A;
|
||||
}
|
||||
|
||||
declare function effectGen<AEff>(f: () => AEff): Effect<AEff>;
|
||||
|
||||
declare function effectFn<AEff, Args extends Array<any>>(
|
||||
body: (...args: Args) => unknown,
|
||||
): (...args: Args) => Effect<AEff>;
|
||||
|
||||
declare function layerEffect<S>(tag: Tag<S>, effect: Effect<S>): unknown;
|
||||
|
||||
interface Tag<Type> {
|
||||
_Type: Type;
|
||||
}
|
||||
|
||||
declare const Foo: Tag<{
|
||||
fn: (a: string) => unknown;
|
||||
}>;
|
||||
|
||||
layerEffect(
|
||||
Foo,
|
||||
effectGen(function () {
|
||||
return {
|
||||
fn: effectFn(function (a) {
|
||||
a; // string
|
||||
}),
|
||||
};
|
||||
}),
|
||||
);
|
||||
@ -0,0 +1,92 @@
|
||||
// @strict: true
|
||||
// @target: esnext
|
||||
// @noEmit: true
|
||||
|
||||
type Covariant<A> = (_: never) => A;
|
||||
|
||||
interface Effect<out A, out E = never, out R = never> {
|
||||
readonly _A: Covariant<A>;
|
||||
readonly _E: Covariant<E>;
|
||||
readonly _R: Covariant<R>;
|
||||
}
|
||||
|
||||
declare function effectGen<Eff extends Effect<any, any, any>, AEff>(
|
||||
f: () => Generator<Eff, AEff, never>
|
||||
): Effect<
|
||||
AEff,
|
||||
[Eff] extends [never]
|
||||
? never
|
||||
: [Eff] extends [Effect<infer _A, infer E, infer _R>]
|
||||
? E
|
||||
: never,
|
||||
[Eff] extends [never]
|
||||
? never
|
||||
: [Eff] extends [Effect<infer _A, infer _E, infer R>]
|
||||
? R
|
||||
: never
|
||||
>;
|
||||
|
||||
declare function effectFn<
|
||||
Eff extends Effect<any, any, any>,
|
||||
AEff,
|
||||
Args extends Array<any>
|
||||
>(
|
||||
body: (...args: Args) => Generator<Eff, AEff, never>
|
||||
): (
|
||||
...args: Args
|
||||
) => Effect<
|
||||
AEff,
|
||||
[Eff] extends [never]
|
||||
? never
|
||||
: [Eff] extends [Effect<infer _A, infer E, infer _R>]
|
||||
? E
|
||||
: never,
|
||||
[Eff] extends [never]
|
||||
? never
|
||||
: [Eff] extends [Effect<infer _A, infer _E, infer R>]
|
||||
? R
|
||||
: never
|
||||
>;
|
||||
|
||||
interface Tag<in out Id, in out Value> {
|
||||
readonly _op: "Tag";
|
||||
readonly Service: Value;
|
||||
readonly Identifier: Id;
|
||||
}
|
||||
|
||||
interface TagClassShape<Id, Shape> {
|
||||
readonly Type: Shape;
|
||||
readonly Id: Id;
|
||||
}
|
||||
|
||||
interface TagClass<Self, Id extends string, Type> extends Tag<Self, Type> {
|
||||
new (_: never): TagClassShape<Id, Type>;
|
||||
readonly key: Id;
|
||||
}
|
||||
|
||||
declare function layerEffect<I, S, E, R>(
|
||||
tag: Tag<I, S>,
|
||||
effect: Effect<S, E, R>
|
||||
): unknown;
|
||||
|
||||
declare function Tag<const Id extends string>(
|
||||
id: Id
|
||||
): <Self, Shape>() => TagClass<Self, Id, Shape>;
|
||||
|
||||
class Foo extends Tag("Foo")<
|
||||
Foo,
|
||||
{
|
||||
fn: (a: string) => Effect<void>;
|
||||
}
|
||||
>() {}
|
||||
|
||||
layerEffect(
|
||||
Foo,
|
||||
effectGen(function* () {
|
||||
return {
|
||||
fn: effectFn(function* (a) {
|
||||
a; // string
|
||||
}),
|
||||
};
|
||||
})
|
||||
);
|
||||
@ -0,0 +1,76 @@
|
||||
// @strict: true
|
||||
// @target: esnext
|
||||
// @noEmit: true
|
||||
|
||||
type Covariant<A> = (_: never) => A;
|
||||
|
||||
interface Effect<out A, out E = never, out R = never> {
|
||||
readonly _A: Covariant<A>;
|
||||
readonly _E: Covariant<E>;
|
||||
readonly _R: Covariant<R>;
|
||||
}
|
||||
|
||||
declare function effectGen<Eff extends Effect<any, any, any>, AEff>(
|
||||
f: () => Generator<Eff, AEff, never>,
|
||||
): Effect<
|
||||
AEff,
|
||||
[Eff] extends [Effect<infer _A, infer E, infer _R>] ? E : never,
|
||||
[Eff] extends [Effect<infer _A, infer _E, infer R>] ? R : never
|
||||
>;
|
||||
|
||||
declare function effectFn<
|
||||
Eff extends Effect<any, any, any>,
|
||||
AEff,
|
||||
Args extends Array<any>,
|
||||
>(
|
||||
body: (...args: Args) => Generator<Eff, AEff, never>,
|
||||
): (
|
||||
...args: Args
|
||||
) => Effect<
|
||||
AEff,
|
||||
[Eff] extends [Effect<infer _A, infer E, infer _R>] ? E : never,
|
||||
[Eff] extends [Effect<infer _A, infer _E, infer R>] ? R : never
|
||||
>;
|
||||
|
||||
interface Tag<in out Id, in out Value> {
|
||||
readonly _op: "Tag";
|
||||
readonly Service: Value;
|
||||
readonly Identifier: Id;
|
||||
}
|
||||
|
||||
interface TagClassShape<Id, Shape> {
|
||||
readonly Type: Shape;
|
||||
readonly Id: Id;
|
||||
}
|
||||
|
||||
interface TagClass<Self, Id extends string, Type> extends Tag<Self, Type> {
|
||||
new (_: never): TagClassShape<Id, Type>;
|
||||
readonly key: Id;
|
||||
}
|
||||
|
||||
declare function layerEffect<I, S, E, R>(
|
||||
tag: Tag<I, S>,
|
||||
effect: Effect<S, E, R>,
|
||||
): unknown;
|
||||
|
||||
declare function Tag<const Id extends string>(
|
||||
id: Id,
|
||||
): <Self, Shape>() => TagClass<Self, Id, Shape>;
|
||||
|
||||
class Foo extends Tag("Foo")<
|
||||
Foo,
|
||||
{
|
||||
fn: (a: string) => Effect<void>;
|
||||
}
|
||||
>() {}
|
||||
|
||||
layerEffect(
|
||||
Foo,
|
||||
effectGen(function* () {
|
||||
return {
|
||||
fn: effectFn(function* (a) {
|
||||
a; // string
|
||||
}),
|
||||
};
|
||||
}),
|
||||
);
|
||||
@ -0,0 +1,62 @@
|
||||
// @strict: true
|
||||
// @target: esnext
|
||||
// @noEmit: true
|
||||
|
||||
type Covariant<A> = (_: never) => A;
|
||||
|
||||
interface Effect<out A, out E = never, out R = never> {
|
||||
readonly _A: Covariant<A>;
|
||||
readonly _E: Covariant<E>;
|
||||
readonly _R: Covariant<R>;
|
||||
}
|
||||
|
||||
declare function effectGen<A, E, R, AEff>(
|
||||
f: () => Generator<Effect<A, E, R>, AEff, never>,
|
||||
): Effect<AEff, E, R>;
|
||||
|
||||
declare function effectFn<A, E, R, AEff, Args extends Array<any>>(
|
||||
body: (...args: Args) => Generator<Effect<A, E, R>, AEff, never>,
|
||||
): (...args: Args) => Effect<AEff, E, R>;
|
||||
|
||||
interface Tag<in out Id, in out Value> {
|
||||
readonly _op: "Tag";
|
||||
readonly Service: Value;
|
||||
readonly Identifier: Id;
|
||||
}
|
||||
|
||||
interface TagClassShape<Id, Shape> {
|
||||
readonly Type: Shape;
|
||||
readonly Id: Id;
|
||||
}
|
||||
|
||||
interface TagClass<Self, Id extends string, Type> extends Tag<Self, Type> {
|
||||
new (_: never): TagClassShape<Id, Type>;
|
||||
readonly key: Id;
|
||||
}
|
||||
|
||||
declare function layerEffect<I, S, E, R>(
|
||||
tag: Tag<I, S>,
|
||||
effect: Effect<S, E, R>,
|
||||
): unknown;
|
||||
|
||||
declare function Tag<const Id extends string>(
|
||||
id: Id,
|
||||
): <Self, Shape>() => TagClass<Self, Id, Shape>;
|
||||
|
||||
class Foo extends Tag("Foo")<
|
||||
Foo,
|
||||
{
|
||||
fn: (a: string) => Effect<void>;
|
||||
}
|
||||
>() {}
|
||||
|
||||
layerEffect(
|
||||
Foo,
|
||||
effectGen(function* () {
|
||||
return {
|
||||
fn: effectFn(function* (a) {
|
||||
a; // string
|
||||
}),
|
||||
};
|
||||
}),
|
||||
);
|
||||
Loading…
x
Reference in New Issue
Block a user