Skip to content

Commit

Permalink
fix types
Browse files Browse the repository at this point in the history
  • Loading branch information
tim-smart committed Feb 12, 2025
1 parent 989a4db commit 3c9c3bd
Showing 1 changed file with 20 additions and 17 deletions.
37 changes: 20 additions & 17 deletions packages/effect/src/LayerMap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,27 +100,31 @@ export interface LayerMap<in K, in out I, out S, out E = never> {
* )
* ```
*/
export const make: <I, S, K, L extends Layer.Layer<Exclude<I, Scope.Scope>, any, any>, E = never>(
tagOrAccessor: Context.Tag<I, S> | Effect.Effect<S, E, I>,
export const make: <
Accessor extends Context.Tag<any, any> | Effect.Effect<any, any, any>,
K,
L extends Layer.Layer<Exclude<Effect.Effect.Context<Accessor>, Scope.Scope>, any, any>
>(
tagOrAccessor: Accessor,
lookup: (key: K) => L,
options?: {
readonly idleTimeToLive?: DurationInput | undefined
} | undefined
) => Effect.Effect<
LayerMap<
K,
Exclude<I, Scope.Scope>,
S,
E | (L extends Layer.Layer<infer _A, infer _E, infer _R> ? _E : never)
Exclude<Effect.Effect.Context<Accessor>, Scope.Scope>,
Effect.Effect.Success<Accessor>,
Effect.Effect.Error<Accessor> | (L extends Layer.Layer<infer _A, infer _E, infer _R> ? _E : never)
>,
never,
Scope.Scope | (L extends Layer.Layer<infer _A, infer _E, infer _R> ? _R : never)
> = Effect.fnUntraced(function*<I, S, K, L extends Layer.Layer<Exclude<I, Scope.Scope>, any, any>, E = never>(
tagOrAccessor: Context.Tag<I, S> | Effect.Effect<S, E, I>,
lookup: (key: K) => L,
> = Effect.fnUntraced(function*<I, S, K, EL, RL, E = never>(
tagOrAccessor: Effect.Effect<S, E, I>,
lookup: (key: K) => Layer.Layer<Exclude<I, Scope.Scope>, EL, RL>,
options?: {
readonly idleTimeToLive?: DurationInput | undefined
}
} | undefined
) {
const context = yield* Effect.context<never>()

Expand Down Expand Up @@ -160,22 +164,21 @@ export const make: <I, S, K, L extends Layer.Layer<Exclude<I, Scope.Scope>, any,
* @category Constructors
*/
export const fromRecord = <
I,
S,
const Layers extends Record<string, Layer.Layer<Exclude<I, Scope.Scope>, any, any>>,
E = never
Accessor extends Context.Tag<any, any> | Effect.Effect<any, any, any>,
const Layers extends Record<string, Layer.Layer<Exclude<Effect.Effect.Context<Accessor>, Scope.Scope>, any, any>>
>(
tagOrAccessor: Context.Tag<I, S> | Effect.Effect<S, E, I>,
tagOrAccessor: Accessor,
layers: Layers,
options?: {
readonly idleTimeToLive?: DurationInput | undefined
} | undefined
): Effect.Effect<
LayerMap<
keyof Layers,
Exclude<I, Scope.Scope>,
S,
E | (Layers[keyof Layers] extends Layer.Layer<infer _A, infer _E, infer _R> ? _E : never)
Exclude<Effect.Effect.Context<Accessor>, Scope.Scope>,
Effect.Effect.Success<Accessor>,
| Effect.Effect.Error<Accessor>
| (Layers[keyof Layers] extends Layer.Layer<infer _A, infer _E, infer _R> ? _E : never)
>,
never,
Scope.Scope | (Layers[keyof Layers] extends Layer.Layer<infer _A, infer _E, infer _R> ? _R : never)
Expand Down

0 comments on commit 3c9c3bd

Please sign in to comment.