Skip to content

Commit 3c9c3bd

Browse files
committed
fix types
1 parent 989a4db commit 3c9c3bd

File tree

1 file changed

+20
-17
lines changed

1 file changed

+20
-17
lines changed

packages/effect/src/LayerMap.ts

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -100,27 +100,31 @@ export interface LayerMap<in K, in out I, out S, out E = never> {
100100
* )
101101
* ```
102102
*/
103-
export const make: <I, S, K, L extends Layer.Layer<Exclude<I, Scope.Scope>, any, any>, E = never>(
104-
tagOrAccessor: Context.Tag<I, S> | Effect.Effect<S, E, I>,
103+
export const make: <
104+
Accessor extends Context.Tag<any, any> | Effect.Effect<any, any, any>,
105+
K,
106+
L extends Layer.Layer<Exclude<Effect.Effect.Context<Accessor>, Scope.Scope>, any, any>
107+
>(
108+
tagOrAccessor: Accessor,
105109
lookup: (key: K) => L,
106110
options?: {
107111
readonly idleTimeToLive?: DurationInput | undefined
108112
} | undefined
109113
) => Effect.Effect<
110114
LayerMap<
111115
K,
112-
Exclude<I, Scope.Scope>,
113-
S,
114-
E | (L extends Layer.Layer<infer _A, infer _E, infer _R> ? _E : never)
116+
Exclude<Effect.Effect.Context<Accessor>, Scope.Scope>,
117+
Effect.Effect.Success<Accessor>,
118+
Effect.Effect.Error<Accessor> | (L extends Layer.Layer<infer _A, infer _E, infer _R> ? _E : never)
115119
>,
116120
never,
117121
Scope.Scope | (L extends Layer.Layer<infer _A, infer _E, infer _R> ? _R : never)
118-
> = Effect.fnUntraced(function*<I, S, K, L extends Layer.Layer<Exclude<I, Scope.Scope>, any, any>, E = never>(
119-
tagOrAccessor: Context.Tag<I, S> | Effect.Effect<S, E, I>,
120-
lookup: (key: K) => L,
122+
> = Effect.fnUntraced(function*<I, S, K, EL, RL, E = never>(
123+
tagOrAccessor: Effect.Effect<S, E, I>,
124+
lookup: (key: K) => Layer.Layer<Exclude<I, Scope.Scope>, EL, RL>,
121125
options?: {
122126
readonly idleTimeToLive?: DurationInput | undefined
123-
}
127+
} | undefined
124128
) {
125129
const context = yield* Effect.context<never>()
126130

@@ -160,22 +164,21 @@ export const make: <I, S, K, L extends Layer.Layer<Exclude<I, Scope.Scope>, any,
160164
* @category Constructors
161165
*/
162166
export const fromRecord = <
163-
I,
164-
S,
165-
const Layers extends Record<string, Layer.Layer<Exclude<I, Scope.Scope>, any, any>>,
166-
E = never
167+
Accessor extends Context.Tag<any, any> | Effect.Effect<any, any, any>,
168+
const Layers extends Record<string, Layer.Layer<Exclude<Effect.Effect.Context<Accessor>, Scope.Scope>, any, any>>
167169
>(
168-
tagOrAccessor: Context.Tag<I, S> | Effect.Effect<S, E, I>,
170+
tagOrAccessor: Accessor,
169171
layers: Layers,
170172
options?: {
171173
readonly idleTimeToLive?: DurationInput | undefined
172174
} | undefined
173175
): Effect.Effect<
174176
LayerMap<
175177
keyof Layers,
176-
Exclude<I, Scope.Scope>,
177-
S,
178-
E | (Layers[keyof Layers] extends Layer.Layer<infer _A, infer _E, infer _R> ? _E : never)
178+
Exclude<Effect.Effect.Context<Accessor>, Scope.Scope>,
179+
Effect.Effect.Success<Accessor>,
180+
| Effect.Effect.Error<Accessor>
181+
| (Layers[keyof Layers] extends Layer.Layer<infer _A, infer _E, infer _R> ? _E : never)
179182
>,
180183
never,
181184
Scope.Scope | (Layers[keyof Layers] extends Layer.Layer<infer _A, infer _E, infer _R> ? _R : never)

0 commit comments

Comments
 (0)