@@ -1,4 +1,4 @@
|
|||||||
import { Context, Layer } from "effect"
|
import { Context, Effect, Layer } from "effect"
|
||||||
import React from "react"
|
import React from "react"
|
||||||
|
|
||||||
|
|
||||||
@@ -8,7 +8,7 @@ export interface ReffuseContext<R> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export type ReffuseContextReactProvider<R> = React.FC<{
|
export type ReffuseContextReactProvider<R> = React.FC<{
|
||||||
readonly layer: Layer.Layer<R, unknown>
|
readonly layer: Layer.Layer<R, unknown, never>
|
||||||
readonly children?: React.ReactNode
|
readonly children?: React.ReactNode
|
||||||
}>
|
}>
|
||||||
|
|
||||||
@@ -30,3 +30,18 @@ export function make<R>(): ReffuseContext<R> {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
declare const MyService1: ReturnType<typeof Context.GenericTag<"MyService1", { readonly myService1: true }>>
|
||||||
|
declare const MyService2: ReturnType<typeof Context.GenericTag<"MyService2", { readonly myService2: true }>>
|
||||||
|
|
||||||
|
declare const Context1: Context.Context<typeof MyService1>
|
||||||
|
declare const Context2: Context.Context<typeof MyService2>
|
||||||
|
|
||||||
|
declare const MyService3: ReturnType<typeof Context.GenericTag<"MyService3", { readonly myService3: true }>>
|
||||||
|
declare const MyService3Live: Layer.Layer<typeof MyService3, never, typeof MyService1>
|
||||||
|
|
||||||
|
|
||||||
|
const res = MyService3Live.pipe(
|
||||||
|
Layer.provide(Layer.effectContext(Effect.succeed(Context1)))
|
||||||
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user