|
| 1 | +//// [tests/cases/compiler/returnTypeInferenceContextualParameterTypesInGenerator1.ts] //// |
| 2 | + |
| 3 | +=== returnTypeInferenceContextualParameterTypesInGenerator1.ts === |
| 4 | +interface Effect<out A> { |
| 5 | +>Effect : Symbol(Effect, Decl(returnTypeInferenceContextualParameterTypesInGenerator1.ts, 0, 0)) |
| 6 | +>A : Symbol(A, Decl(returnTypeInferenceContextualParameterTypesInGenerator1.ts, 0, 17)) |
| 7 | + |
| 8 | + readonly _A: A; |
| 9 | +>_A : Symbol(Effect._A, Decl(returnTypeInferenceContextualParameterTypesInGenerator1.ts, 0, 25)) |
| 10 | +>A : Symbol(A, Decl(returnTypeInferenceContextualParameterTypesInGenerator1.ts, 0, 17)) |
| 11 | +} |
| 12 | + |
| 13 | +declare function gen<Eff extends Effect<any>, AEff>( |
| 14 | +>gen : Symbol(gen, Decl(returnTypeInferenceContextualParameterTypesInGenerator1.ts, 2, 1)) |
| 15 | +>Eff : Symbol(Eff, Decl(returnTypeInferenceContextualParameterTypesInGenerator1.ts, 4, 21)) |
| 16 | +>Effect : Symbol(Effect, Decl(returnTypeInferenceContextualParameterTypesInGenerator1.ts, 0, 0)) |
| 17 | +>AEff : Symbol(AEff, Decl(returnTypeInferenceContextualParameterTypesInGenerator1.ts, 4, 45)) |
| 18 | + |
| 19 | + f: () => Generator<Eff, AEff> |
| 20 | +>f : Symbol(f, Decl(returnTypeInferenceContextualParameterTypesInGenerator1.ts, 4, 52)) |
| 21 | +>Generator : Symbol(Generator, Decl(lib.es2015.generator.d.ts, --, --)) |
| 22 | +>Eff : Symbol(Eff, Decl(returnTypeInferenceContextualParameterTypesInGenerator1.ts, 4, 21)) |
| 23 | +>AEff : Symbol(AEff, Decl(returnTypeInferenceContextualParameterTypesInGenerator1.ts, 4, 45)) |
| 24 | + |
| 25 | +): Effect<AEff>; |
| 26 | +>Effect : Symbol(Effect, Decl(returnTypeInferenceContextualParameterTypesInGenerator1.ts, 0, 0)) |
| 27 | +>AEff : Symbol(AEff, Decl(returnTypeInferenceContextualParameterTypesInGenerator1.ts, 4, 45)) |
| 28 | + |
| 29 | +interface Rpc< |
| 30 | +>Rpc : Symbol(Rpc, Decl(returnTypeInferenceContextualParameterTypesInGenerator1.ts, 6, 16)) |
| 31 | + |
| 32 | + in out Tag extends string, |
| 33 | +>Tag : Symbol(Tag, Decl(returnTypeInferenceContextualParameterTypesInGenerator1.ts, 8, 14)) |
| 34 | + |
| 35 | + out Payload = unknown, |
| 36 | +>Payload : Symbol(Payload, Decl(returnTypeInferenceContextualParameterTypesInGenerator1.ts, 9, 28)) |
| 37 | + |
| 38 | + out Success = unknown |
| 39 | +>Success : Symbol(Success, Decl(returnTypeInferenceContextualParameterTypesInGenerator1.ts, 10, 24)) |
| 40 | + |
| 41 | +> { |
| 42 | + readonly _tag: Tag; |
| 43 | +>_tag : Symbol(Rpc._tag, Decl(returnTypeInferenceContextualParameterTypesInGenerator1.ts, 12, 3)) |
| 44 | +>Tag : Symbol(Tag, Decl(returnTypeInferenceContextualParameterTypesInGenerator1.ts, 8, 14)) |
| 45 | + |
| 46 | + readonly payloadSchema: Payload; |
| 47 | +>payloadSchema : Symbol(Rpc.payloadSchema, Decl(returnTypeInferenceContextualParameterTypesInGenerator1.ts, 13, 21)) |
| 48 | +>Payload : Symbol(Payload, Decl(returnTypeInferenceContextualParameterTypesInGenerator1.ts, 9, 28)) |
| 49 | + |
| 50 | + readonly successSchema: Success; |
| 51 | +>successSchema : Symbol(Rpc.successSchema, Decl(returnTypeInferenceContextualParameterTypesInGenerator1.ts, 14, 34)) |
| 52 | +>Success : Symbol(Success, Decl(returnTypeInferenceContextualParameterTypesInGenerator1.ts, 10, 24)) |
| 53 | +} |
| 54 | + |
| 55 | +interface RpcAny { |
| 56 | +>RpcAny : Symbol(RpcAny, Decl(returnTypeInferenceContextualParameterTypesInGenerator1.ts, 16, 1)) |
| 57 | + |
| 58 | + readonly _tag: string; |
| 59 | +>_tag : Symbol(RpcAny._tag, Decl(returnTypeInferenceContextualParameterTypesInGenerator1.ts, 18, 18)) |
| 60 | +} |
| 61 | + |
| 62 | +type Payload<R> = R extends Rpc<infer _Tag, infer _Payload, infer _Success> |
| 63 | +>Payload : Symbol(Payload, Decl(returnTypeInferenceContextualParameterTypesInGenerator1.ts, 20, 1)) |
| 64 | +>R : Symbol(R, Decl(returnTypeInferenceContextualParameterTypesInGenerator1.ts, 22, 13)) |
| 65 | +>R : Symbol(R, Decl(returnTypeInferenceContextualParameterTypesInGenerator1.ts, 22, 13)) |
| 66 | +>Rpc : Symbol(Rpc, Decl(returnTypeInferenceContextualParameterTypesInGenerator1.ts, 6, 16)) |
| 67 | +>_Tag : Symbol(_Tag, Decl(returnTypeInferenceContextualParameterTypesInGenerator1.ts, 22, 37)) |
| 68 | +>_Payload : Symbol(_Payload, Decl(returnTypeInferenceContextualParameterTypesInGenerator1.ts, 22, 49)) |
| 69 | +>_Success : Symbol(_Success, Decl(returnTypeInferenceContextualParameterTypesInGenerator1.ts, 22, 65)) |
| 70 | + |
| 71 | + ? _Payload |
| 72 | +>_Payload : Symbol(_Payload, Decl(returnTypeInferenceContextualParameterTypesInGenerator1.ts, 22, 49)) |
| 73 | + |
| 74 | + : never; |
| 75 | + |
| 76 | +type ResultFrom<R extends RpcAny> = R extends Rpc< |
| 77 | +>ResultFrom : Symbol(ResultFrom, Decl(returnTypeInferenceContextualParameterTypesInGenerator1.ts, 24, 10)) |
| 78 | +>R : Symbol(R, Decl(returnTypeInferenceContextualParameterTypesInGenerator1.ts, 26, 16)) |
| 79 | +>RpcAny : Symbol(RpcAny, Decl(returnTypeInferenceContextualParameterTypesInGenerator1.ts, 16, 1)) |
| 80 | +>R : Symbol(R, Decl(returnTypeInferenceContextualParameterTypesInGenerator1.ts, 26, 16)) |
| 81 | +>Rpc : Symbol(Rpc, Decl(returnTypeInferenceContextualParameterTypesInGenerator1.ts, 6, 16)) |
| 82 | + |
| 83 | + infer _Tag, |
| 84 | +>_Tag : Symbol(_Tag, Decl(returnTypeInferenceContextualParameterTypesInGenerator1.ts, 27, 7)) |
| 85 | + |
| 86 | + infer _Payload, |
| 87 | +>_Payload : Symbol(_Payload, Decl(returnTypeInferenceContextualParameterTypesInGenerator1.ts, 28, 7)) |
| 88 | + |
| 89 | + infer _Success |
| 90 | +>_Success : Symbol(_Success, Decl(returnTypeInferenceContextualParameterTypesInGenerator1.ts, 29, 7)) |
| 91 | + |
| 92 | +> |
| 93 | + ? _Success |
| 94 | +>_Success : Symbol(_Success, Decl(returnTypeInferenceContextualParameterTypesInGenerator1.ts, 29, 7)) |
| 95 | + |
| 96 | + : never; |
| 97 | + |
| 98 | +type ToHandlerFn<Current extends RpcAny> = ( |
| 99 | +>ToHandlerFn : Symbol(ToHandlerFn, Decl(returnTypeInferenceContextualParameterTypesInGenerator1.ts, 32, 10)) |
| 100 | +>Current : Symbol(Current, Decl(returnTypeInferenceContextualParameterTypesInGenerator1.ts, 34, 17)) |
| 101 | +>RpcAny : Symbol(RpcAny, Decl(returnTypeInferenceContextualParameterTypesInGenerator1.ts, 16, 1)) |
| 102 | + |
| 103 | + payload: Payload<Current> |
| 104 | +>payload : Symbol(payload, Decl(returnTypeInferenceContextualParameterTypesInGenerator1.ts, 34, 44)) |
| 105 | +>Payload : Symbol(Payload, Decl(returnTypeInferenceContextualParameterTypesInGenerator1.ts, 20, 1)) |
| 106 | +>Current : Symbol(Current, Decl(returnTypeInferenceContextualParameterTypesInGenerator1.ts, 34, 17)) |
| 107 | + |
| 108 | +) => ResultFrom<Current>; |
| 109 | +>ResultFrom : Symbol(ResultFrom, Decl(returnTypeInferenceContextualParameterTypesInGenerator1.ts, 24, 10)) |
| 110 | +>Current : Symbol(Current, Decl(returnTypeInferenceContextualParameterTypesInGenerator1.ts, 34, 17)) |
| 111 | + |
| 112 | +type HandlersFrom<Rpc extends RpcAny> = { |
| 113 | +>HandlersFrom : Symbol(HandlersFrom, Decl(returnTypeInferenceContextualParameterTypesInGenerator1.ts, 36, 25)) |
| 114 | +>Rpc : Symbol(Rpc, Decl(returnTypeInferenceContextualParameterTypesInGenerator1.ts, 38, 18)) |
| 115 | +>RpcAny : Symbol(RpcAny, Decl(returnTypeInferenceContextualParameterTypesInGenerator1.ts, 16, 1)) |
| 116 | + |
| 117 | + readonly [Current in Rpc as Current["_tag"]]: ToHandlerFn<Current>; |
| 118 | +>Current : Symbol(Current, Decl(returnTypeInferenceContextualParameterTypesInGenerator1.ts, 39, 12)) |
| 119 | +>Rpc : Symbol(Rpc, Decl(returnTypeInferenceContextualParameterTypesInGenerator1.ts, 38, 18)) |
| 120 | +>Current : Symbol(Current, Decl(returnTypeInferenceContextualParameterTypesInGenerator1.ts, 39, 12)) |
| 121 | +>ToHandlerFn : Symbol(ToHandlerFn, Decl(returnTypeInferenceContextualParameterTypesInGenerator1.ts, 32, 10)) |
| 122 | +>Current : Symbol(Current, Decl(returnTypeInferenceContextualParameterTypesInGenerator1.ts, 39, 12)) |
| 123 | + |
| 124 | +}; |
| 125 | + |
| 126 | +interface RpcGroup<in out R extends RpcAny> { |
| 127 | +>RpcGroup : Symbol(RpcGroup, Decl(returnTypeInferenceContextualParameterTypesInGenerator1.ts, 40, 2)) |
| 128 | +>R : Symbol(R, Decl(returnTypeInferenceContextualParameterTypesInGenerator1.ts, 42, 19)) |
| 129 | +>RpcAny : Symbol(RpcAny, Decl(returnTypeInferenceContextualParameterTypesInGenerator1.ts, 16, 1)) |
| 130 | + |
| 131 | + toLayer<Handlers extends HandlersFrom<R>>(build: Effect<Handlers>): unknown; |
| 132 | +>toLayer : Symbol(RpcGroup.toLayer, Decl(returnTypeInferenceContextualParameterTypesInGenerator1.ts, 42, 45)) |
| 133 | +>Handlers : Symbol(Handlers, Decl(returnTypeInferenceContextualParameterTypesInGenerator1.ts, 43, 10)) |
| 134 | +>HandlersFrom : Symbol(HandlersFrom, Decl(returnTypeInferenceContextualParameterTypesInGenerator1.ts, 36, 25)) |
| 135 | +>R : Symbol(R, Decl(returnTypeInferenceContextualParameterTypesInGenerator1.ts, 42, 19)) |
| 136 | +>build : Symbol(build, Decl(returnTypeInferenceContextualParameterTypesInGenerator1.ts, 43, 44)) |
| 137 | +>Effect : Symbol(Effect, Decl(returnTypeInferenceContextualParameterTypesInGenerator1.ts, 0, 0)) |
| 138 | +>Handlers : Symbol(Handlers, Decl(returnTypeInferenceContextualParameterTypesInGenerator1.ts, 43, 10)) |
| 139 | +} |
| 140 | + |
| 141 | +declare const Rpcs: RpcGroup<Rpc<"Register", number, string>>; |
| 142 | +>Rpcs : Symbol(Rpcs, Decl(returnTypeInferenceContextualParameterTypesInGenerator1.ts, 46, 13)) |
| 143 | +>RpcGroup : Symbol(RpcGroup, Decl(returnTypeInferenceContextualParameterTypesInGenerator1.ts, 40, 2)) |
| 144 | +>Rpc : Symbol(Rpc, Decl(returnTypeInferenceContextualParameterTypesInGenerator1.ts, 6, 16)) |
| 145 | + |
| 146 | +export const layerServerHandlers = Rpcs.toLayer( |
| 147 | +>layerServerHandlers : Symbol(layerServerHandlers, Decl(returnTypeInferenceContextualParameterTypesInGenerator1.ts, 48, 12)) |
| 148 | +>Rpcs.toLayer : Symbol(RpcGroup.toLayer, Decl(returnTypeInferenceContextualParameterTypesInGenerator1.ts, 42, 45)) |
| 149 | +>Rpcs : Symbol(Rpcs, Decl(returnTypeInferenceContextualParameterTypesInGenerator1.ts, 46, 13)) |
| 150 | +>toLayer : Symbol(RpcGroup.toLayer, Decl(returnTypeInferenceContextualParameterTypesInGenerator1.ts, 42, 45)) |
| 151 | + |
| 152 | + gen(function* () { |
| 153 | +>gen : Symbol(gen, Decl(returnTypeInferenceContextualParameterTypesInGenerator1.ts, 2, 1)) |
| 154 | + |
| 155 | + return { |
| 156 | + Register: (id) => String(id), |
| 157 | +>Register : Symbol(Register, Decl(returnTypeInferenceContextualParameterTypesInGenerator1.ts, 50, 12)) |
| 158 | +>id : Symbol(id, Decl(returnTypeInferenceContextualParameterTypesInGenerator1.ts, 51, 17)) |
| 159 | +>String : Symbol(String, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --) ... and 7 more) |
| 160 | +>id : Symbol(id, Decl(returnTypeInferenceContextualParameterTypesInGenerator1.ts, 51, 17)) |
| 161 | + |
| 162 | + }; |
| 163 | + }) |
| 164 | +); |
| 165 | + |
0 commit comments