This commit is contained in:
@@ -7,7 +7,7 @@ import * as Memoized from "./Memoized.js"
|
|||||||
export const TypeId: unique symbol = Symbol.for("effect-fc/Component")
|
export const TypeId: unique symbol = Symbol.for("effect-fc/Component")
|
||||||
export type TypeId = typeof TypeId
|
export type TypeId = typeof TypeId
|
||||||
|
|
||||||
export interface Component<E, R, P extends {}>
|
export interface Component<P extends {} = {}, E = never, R = never>
|
||||||
extends Effect.Effect<React.FC<P>, never, Exclude<R, Scope.Scope>>, Component.Options {
|
extends Effect.Effect<React.FC<P>, never, Exclude<R, Scope.Scope>>, Component.Options {
|
||||||
new(_: never): {}
|
new(_: never): {}
|
||||||
readonly [TypeId]: TypeId
|
readonly [TypeId]: TypeId
|
||||||
@@ -18,9 +18,9 @@ extends Effect.Effect<React.FC<P>, never, Exclude<R, Scope.Scope>>, Component.Op
|
|||||||
}
|
}
|
||||||
|
|
||||||
export namespace Component {
|
export namespace Component {
|
||||||
export type Error<T> = T extends Component<infer E, infer _R, infer _P> ? E : never
|
export type Props<T> = T extends Component<infer P, infer _E, infer _R> ? P : never
|
||||||
export type Context<T> = T extends Component<infer _E, infer R, infer _P> ? R : never
|
export type Error<T> = T extends Component<infer _P, infer E, infer _R> ? E : never
|
||||||
export type Props<T> = T extends Component<infer _E, infer _R, infer P> ? P : never
|
export type Context<T> = T extends Component<infer _P, infer _E, infer R> ? R : never
|
||||||
|
|
||||||
export interface Options {
|
export interface Options {
|
||||||
readonly displayName?: string
|
readonly displayName?: string
|
||||||
@@ -34,7 +34,7 @@ const ComponentProto = Object.freeze({
|
|||||||
...Effectable.CommitPrototype,
|
...Effectable.CommitPrototype,
|
||||||
[TypeId]: TypeId,
|
[TypeId]: TypeId,
|
||||||
|
|
||||||
commit: Effect.fnUntraced(function* <E, R, P extends {}>(this: Component<E, R, P>) {
|
commit: Effect.fnUntraced(function* <P extends {}, E, R>(this: Component<P, E, R>) {
|
||||||
const self = this
|
const self = this
|
||||||
const runtimeRef = React.useRef<Runtime.Runtime<Exclude<R, Scope.Scope>>>(null!)
|
const runtimeRef = React.useRef<Runtime.Runtime<Exclude<R, Scope.Scope>>>(null!)
|
||||||
runtimeRef.current = yield* Effect.runtime<Exclude<R, Scope.Scope>>()
|
runtimeRef.current = yield* Effect.runtime<Exclude<R, Scope.Scope>>()
|
||||||
@@ -59,8 +59,8 @@ const ComponentProto = Object.freeze({
|
|||||||
}, [])
|
}, [])
|
||||||
}),
|
}),
|
||||||
|
|
||||||
makeFunctionComponent <E, R, P extends {}>(
|
makeFunctionComponent <P extends {}, E, R>(
|
||||||
this: Component<E, R, P>,
|
this: Component<P, E, R>,
|
||||||
runtimeRef: React.RefObject<Runtime.Runtime<Exclude<R, Scope.Scope>>>,
|
runtimeRef: React.RefObject<Runtime.Runtime<Exclude<R, Scope.Scope>>>,
|
||||||
scope: Scope.Scope,
|
scope: Scope.Scope,
|
||||||
): React.FC<P> {
|
): React.FC<P> {
|
||||||
@@ -77,17 +77,16 @@ const defaultOptions = {
|
|||||||
|
|
||||||
const nonReactiveTags = [Tracer.ParentSpan] as const
|
const nonReactiveTags = [Tracer.ParentSpan] as const
|
||||||
|
|
||||||
|
export const isComponent = (u: unknown): u is Component<{}, unknown, unknown> => Predicate.hasProperty(u, TypeId)
|
||||||
export const isComponent = (u: unknown): u is Component<unknown, unknown, {}> => Predicate.hasProperty(u, TypeId)
|
|
||||||
|
|
||||||
export namespace make {
|
export namespace make {
|
||||||
export type Gen = {
|
export type Gen = {
|
||||||
<Eff extends Utils.YieldWrap<Effect.Effect<any, any, any>>, P extends {} = {}>(
|
<Eff extends Utils.YieldWrap<Effect.Effect<any, any, any>>, P extends {} = {}>(
|
||||||
body: (props: P) => Generator<Eff, React.ReactNode, never>,
|
body: (props: P) => Generator<Eff, React.ReactNode, never>,
|
||||||
): Component<
|
): Component<
|
||||||
|
P,
|
||||||
[Eff] extends [never] ? never : [Eff] extends [Utils.YieldWrap<Effect.Effect<infer _A, infer E, infer _R>>] ? E : never,
|
[Eff] extends [never] ? never : [Eff] extends [Utils.YieldWrap<Effect.Effect<infer _A, infer E, infer _R>>] ? E : never,
|
||||||
[Eff] extends [never] ? never : [Eff] extends [Utils.YieldWrap<Effect.Effect<infer _A, infer _E, infer R>>] ? R : never,
|
[Eff] extends [never] ? never : [Eff] extends [Utils.YieldWrap<Effect.Effect<infer _A, infer _E, infer R>>] ? R : never
|
||||||
P
|
|
||||||
>
|
>
|
||||||
<Eff extends Utils.YieldWrap<Effect.Effect<any, any, any>>, A, B extends Effect.Effect<React.ReactNode, any, any>, P extends {} = {}>(
|
<Eff extends Utils.YieldWrap<Effect.Effect<any, any, any>>, A, B extends Effect.Effect<React.ReactNode, any, any>, P extends {} = {}>(
|
||||||
body: (props: P) => Generator<Eff, A, never>,
|
body: (props: P) => Generator<Eff, A, never>,
|
||||||
@@ -99,7 +98,7 @@ export namespace make {
|
|||||||
>,
|
>,
|
||||||
props: NoInfer<P>,
|
props: NoInfer<P>,
|
||||||
) => B
|
) => B
|
||||||
): Component<Effect.Effect.Error<B>, Effect.Effect.Context<B>, P>
|
): Component<P, Effect.Effect.Error<B>, Effect.Effect.Context<B>>
|
||||||
<Eff extends Utils.YieldWrap<Effect.Effect<any, any, any>>, A, B, C extends Effect.Effect<React.ReactNode, any, any>, P extends {} = {}>(
|
<Eff extends Utils.YieldWrap<Effect.Effect<any, any, any>>, A, B, C extends Effect.Effect<React.ReactNode, any, any>, P extends {} = {}>(
|
||||||
body: (props: P) => Generator<Eff, A, never>,
|
body: (props: P) => Generator<Eff, A, never>,
|
||||||
a: (
|
a: (
|
||||||
@@ -111,7 +110,7 @@ export namespace make {
|
|||||||
props: NoInfer<P>,
|
props: NoInfer<P>,
|
||||||
) => B,
|
) => B,
|
||||||
b: (_: B, props: NoInfer<P>) => C,
|
b: (_: B, props: NoInfer<P>) => C,
|
||||||
): Component<Effect.Effect.Error<C>, Effect.Effect.Context<C>, P>
|
): Component<P, Effect.Effect.Error<C>, Effect.Effect.Context<C>>
|
||||||
<Eff extends Utils.YieldWrap<Effect.Effect<any, any, any>>, A, B, C, D extends Effect.Effect<React.ReactNode, any, any>, P extends {} = {}>(
|
<Eff extends Utils.YieldWrap<Effect.Effect<any, any, any>>, A, B, C, D extends Effect.Effect<React.ReactNode, any, any>, P extends {} = {}>(
|
||||||
body: (props: P) => Generator<Eff, A, never>,
|
body: (props: P) => Generator<Eff, A, never>,
|
||||||
a: (
|
a: (
|
||||||
@@ -124,7 +123,7 @@ export namespace make {
|
|||||||
) => B,
|
) => B,
|
||||||
b: (_: B, props: NoInfer<P>) => C,
|
b: (_: B, props: NoInfer<P>) => C,
|
||||||
c: (_: C, props: NoInfer<P>) => D,
|
c: (_: C, props: NoInfer<P>) => D,
|
||||||
): Component<Effect.Effect.Error<D>, Effect.Effect.Context<D>, P>
|
): Component<P, Effect.Effect.Error<D>, Effect.Effect.Context<D>>
|
||||||
<Eff extends Utils.YieldWrap<Effect.Effect<any, any, any>>, A, B, C, D, E extends Effect.Effect<React.ReactNode, any, any>, P extends {} = {}>(
|
<Eff extends Utils.YieldWrap<Effect.Effect<any, any, any>>, A, B, C, D, E extends Effect.Effect<React.ReactNode, any, any>, P extends {} = {}>(
|
||||||
body: (props: P) => Generator<Eff, A, never>,
|
body: (props: P) => Generator<Eff, A, never>,
|
||||||
a: (
|
a: (
|
||||||
@@ -138,7 +137,7 @@ export namespace make {
|
|||||||
b: (_: B, props: NoInfer<P>) => C,
|
b: (_: B, props: NoInfer<P>) => C,
|
||||||
c: (_: C, props: NoInfer<P>) => D,
|
c: (_: C, props: NoInfer<P>) => D,
|
||||||
d: (_: D, props: NoInfer<P>) => E,
|
d: (_: D, props: NoInfer<P>) => E,
|
||||||
): Component<Effect.Effect.Error<E>, Effect.Effect.Context<E>, P>
|
): Component<P, Effect.Effect.Error<E>, Effect.Effect.Context<E>>
|
||||||
<Eff extends Utils.YieldWrap<Effect.Effect<any, any, any>>, A, B, C, D, E, F extends Effect.Effect<React.ReactNode, any, any>, P extends {} = {}>(
|
<Eff extends Utils.YieldWrap<Effect.Effect<any, any, any>>, A, B, C, D, E, F extends Effect.Effect<React.ReactNode, any, any>, P extends {} = {}>(
|
||||||
body: (props: P) => Generator<Eff, A, never>,
|
body: (props: P) => Generator<Eff, A, never>,
|
||||||
a: (
|
a: (
|
||||||
@@ -153,7 +152,7 @@ export namespace make {
|
|||||||
c: (_: C, props: NoInfer<P>) => D,
|
c: (_: C, props: NoInfer<P>) => D,
|
||||||
d: (_: D, props: NoInfer<P>) => E,
|
d: (_: D, props: NoInfer<P>) => E,
|
||||||
e: (_: E, props: NoInfer<P>) => F,
|
e: (_: E, props: NoInfer<P>) => F,
|
||||||
): Component<Effect.Effect.Error<F>, Effect.Effect.Context<F>, P>
|
): Component<P, Effect.Effect.Error<F>, Effect.Effect.Context<F>>
|
||||||
<Eff extends Utils.YieldWrap<Effect.Effect<any, any, any>>, A, B, C, D, E, F, G extends Effect.Effect<React.ReactNode, any, any>, P extends {} = {}>(
|
<Eff extends Utils.YieldWrap<Effect.Effect<any, any, any>>, A, B, C, D, E, F, G extends Effect.Effect<React.ReactNode, any, any>, P extends {} = {}>(
|
||||||
body: (props: P) => Generator<Eff, A, never>,
|
body: (props: P) => Generator<Eff, A, never>,
|
||||||
a: (
|
a: (
|
||||||
@@ -169,7 +168,7 @@ export namespace make {
|
|||||||
d: (_: D, props: NoInfer<P>) => E,
|
d: (_: D, props: NoInfer<P>) => E,
|
||||||
e: (_: E, props: NoInfer<P>) => F,
|
e: (_: E, props: NoInfer<P>) => F,
|
||||||
f: (_: F, props: NoInfer<P>) => G,
|
f: (_: F, props: NoInfer<P>) => G,
|
||||||
): Component<Effect.Effect.Error<G>, Effect.Effect.Context<G>, P>
|
): Component<P, Effect.Effect.Error<G>, Effect.Effect.Context<G>>
|
||||||
<Eff extends Utils.YieldWrap<Effect.Effect<any, any, any>>, A, B, C, D, E, F, G, H extends Effect.Effect<React.ReactNode, any, any>, P extends {} = {}>(
|
<Eff extends Utils.YieldWrap<Effect.Effect<any, any, any>>, A, B, C, D, E, F, G, H extends Effect.Effect<React.ReactNode, any, any>, P extends {} = {}>(
|
||||||
body: (props: P) => Generator<Eff, A, never>,
|
body: (props: P) => Generator<Eff, A, never>,
|
||||||
a: (
|
a: (
|
||||||
@@ -186,7 +185,7 @@ export namespace make {
|
|||||||
e: (_: E, props: NoInfer<P>) => F,
|
e: (_: E, props: NoInfer<P>) => F,
|
||||||
f: (_: F, props: NoInfer<P>) => G,
|
f: (_: F, props: NoInfer<P>) => G,
|
||||||
g: (_: G, props: NoInfer<P>) => H,
|
g: (_: G, props: NoInfer<P>) => H,
|
||||||
): Component<Effect.Effect.Error<H>, Effect.Effect.Context<H>, P>
|
): Component<P, Effect.Effect.Error<H>, Effect.Effect.Context<H>>
|
||||||
<Eff extends Utils.YieldWrap<Effect.Effect<any, any, any>>, A, B, C, D, E, F, G, H, I extends Effect.Effect<React.ReactNode, any, any>, P extends {} = {}>(
|
<Eff extends Utils.YieldWrap<Effect.Effect<any, any, any>>, A, B, C, D, E, F, G, H, I extends Effect.Effect<React.ReactNode, any, any>, P extends {} = {}>(
|
||||||
body: (props: P) => Generator<Eff, A, never>,
|
body: (props: P) => Generator<Eff, A, never>,
|
||||||
a: (
|
a: (
|
||||||
@@ -204,7 +203,7 @@ export namespace make {
|
|||||||
f: (_: F, props: NoInfer<P>) => G,
|
f: (_: F, props: NoInfer<P>) => G,
|
||||||
g: (_: G, props: NoInfer<P>) => H,
|
g: (_: G, props: NoInfer<P>) => H,
|
||||||
h: (_: H, props: NoInfer<P>) => I,
|
h: (_: H, props: NoInfer<P>) => I,
|
||||||
): Component<Effect.Effect.Error<I>, Effect.Effect.Context<I>, P>
|
): Component<P, Effect.Effect.Error<I>, Effect.Effect.Context<I>>
|
||||||
<Eff extends Utils.YieldWrap<Effect.Effect<any, any, any>>, A, B, C, D, E, F, G, H, I, J extends Effect.Effect<React.ReactNode, any, any>, P extends {} = {}>(
|
<Eff extends Utils.YieldWrap<Effect.Effect<any, any, any>>, A, B, C, D, E, F, G, H, I, J extends Effect.Effect<React.ReactNode, any, any>, P extends {} = {}>(
|
||||||
body: (props: P) => Generator<Eff, A, never>,
|
body: (props: P) => Generator<Eff, A, never>,
|
||||||
a: (
|
a: (
|
||||||
@@ -223,35 +222,35 @@ export namespace make {
|
|||||||
g: (_: G, props: NoInfer<P>) => H,
|
g: (_: G, props: NoInfer<P>) => H,
|
||||||
h: (_: H, props: NoInfer<P>) => I,
|
h: (_: H, props: NoInfer<P>) => I,
|
||||||
i: (_: I, props: NoInfer<P>) => J,
|
i: (_: I, props: NoInfer<P>) => J,
|
||||||
): Component<Effect.Effect.Error<J>, Effect.Effect.Context<J>, P>
|
): Component<P, Effect.Effect.Error<J>, Effect.Effect.Context<J>>
|
||||||
}
|
}
|
||||||
|
|
||||||
export type NonGen = {
|
export type NonGen = {
|
||||||
<Eff extends Effect.Effect<React.ReactNode, any, any>, P extends {} = {}>(
|
<Eff extends Effect.Effect<React.ReactNode, any, any>, P extends {} = {}>(
|
||||||
body: (props: P) => Eff
|
body: (props: P) => Eff
|
||||||
): Component<Effect.Effect.Error<Eff>, Effect.Effect.Context<Eff>, P>
|
): Component<P, Effect.Effect.Error<Eff>, Effect.Effect.Context<Eff>>
|
||||||
<Eff extends Effect.Effect<React.ReactNode, any, any>, A, P extends {} = {}>(
|
<Eff extends Effect.Effect<React.ReactNode, any, any>, A, P extends {} = {}>(
|
||||||
body: (props: P) => A,
|
body: (props: P) => A,
|
||||||
a: (_: A, props: NoInfer<P>) => Eff,
|
a: (_: A, props: NoInfer<P>) => Eff,
|
||||||
): Component<Effect.Effect.Error<Eff>, Effect.Effect.Context<Eff>, P>
|
): Component<P, Effect.Effect.Error<Eff>, Effect.Effect.Context<Eff>>
|
||||||
<Eff extends Effect.Effect<React.ReactNode, any, any>, A, B, P extends {} = {}>(
|
<Eff extends Effect.Effect<React.ReactNode, any, any>, A, B, P extends {} = {}>(
|
||||||
body: (props: P) => A,
|
body: (props: P) => A,
|
||||||
a: (_: A, props: NoInfer<P>) => B,
|
a: (_: A, props: NoInfer<P>) => B,
|
||||||
b: (_: B, props: NoInfer<P>) => Eff,
|
b: (_: B, props: NoInfer<P>) => Eff,
|
||||||
): Component<Effect.Effect.Error<Eff>, Effect.Effect.Context<Eff>, P>
|
): Component<P, Effect.Effect.Error<Eff>, Effect.Effect.Context<Eff>>
|
||||||
<Eff extends Effect.Effect<React.ReactNode, any, any>, A, B, C, P extends {} = {}>(
|
<Eff extends Effect.Effect<React.ReactNode, any, any>, A, B, C, P extends {} = {}>(
|
||||||
body: (props: P) => A,
|
body: (props: P) => A,
|
||||||
a: (_: A, props: NoInfer<P>) => B,
|
a: (_: A, props: NoInfer<P>) => B,
|
||||||
b: (_: B, props: NoInfer<P>) => C,
|
b: (_: B, props: NoInfer<P>) => C,
|
||||||
c: (_: C, props: NoInfer<P>) => Eff,
|
c: (_: C, props: NoInfer<P>) => Eff,
|
||||||
): Component<Effect.Effect.Error<Eff>, Effect.Effect.Context<Eff>, P>
|
): Component<P, Effect.Effect.Error<Eff>, Effect.Effect.Context<Eff>>
|
||||||
<Eff extends Effect.Effect<React.ReactNode, any, any>, A, B, C, D, P extends {} = {}>(
|
<Eff extends Effect.Effect<React.ReactNode, any, any>, A, B, C, D, P extends {} = {}>(
|
||||||
body: (props: P) => A,
|
body: (props: P) => A,
|
||||||
a: (_: A, props: NoInfer<P>) => B,
|
a: (_: A, props: NoInfer<P>) => B,
|
||||||
b: (_: B, props: NoInfer<P>) => C,
|
b: (_: B, props: NoInfer<P>) => C,
|
||||||
c: (_: C, props: NoInfer<P>) => D,
|
c: (_: C, props: NoInfer<P>) => D,
|
||||||
d: (_: D, props: NoInfer<P>) => Eff,
|
d: (_: D, props: NoInfer<P>) => Eff,
|
||||||
): Component<Effect.Effect.Error<Eff>, Effect.Effect.Context<Eff>, P>
|
): Component<P, Effect.Effect.Error<Eff>, Effect.Effect.Context<Eff>>
|
||||||
<Eff extends Effect.Effect<React.ReactNode, any, any>, A, B, C, D, E, P extends {} = {}>(
|
<Eff extends Effect.Effect<React.ReactNode, any, any>, A, B, C, D, E, P extends {} = {}>(
|
||||||
body: (props: P) => A,
|
body: (props: P) => A,
|
||||||
a: (_: A, props: NoInfer<P>) => B,
|
a: (_: A, props: NoInfer<P>) => B,
|
||||||
@@ -259,7 +258,7 @@ export namespace make {
|
|||||||
c: (_: C, props: NoInfer<P>) => D,
|
c: (_: C, props: NoInfer<P>) => D,
|
||||||
d: (_: D, props: NoInfer<P>) => E,
|
d: (_: D, props: NoInfer<P>) => E,
|
||||||
e: (_: E, props: NoInfer<P>) => Eff,
|
e: (_: E, props: NoInfer<P>) => Eff,
|
||||||
): Component<Effect.Effect.Error<Eff>, Effect.Effect.Context<Eff>, P>
|
): Component<P, Effect.Effect.Error<Eff>, Effect.Effect.Context<Eff>>
|
||||||
<Eff extends Effect.Effect<React.ReactNode, any, any>, A, B, C, D, E, F, P extends {} = {}>(
|
<Eff extends Effect.Effect<React.ReactNode, any, any>, A, B, C, D, E, F, P extends {} = {}>(
|
||||||
body: (props: P) => A,
|
body: (props: P) => A,
|
||||||
a: (_: A, props: NoInfer<P>) => B,
|
a: (_: A, props: NoInfer<P>) => B,
|
||||||
@@ -268,7 +267,7 @@ export namespace make {
|
|||||||
d: (_: D, props: NoInfer<P>) => E,
|
d: (_: D, props: NoInfer<P>) => E,
|
||||||
e: (_: E, props: NoInfer<P>) => F,
|
e: (_: E, props: NoInfer<P>) => F,
|
||||||
f: (_: F, props: NoInfer<P>) => Eff,
|
f: (_: F, props: NoInfer<P>) => Eff,
|
||||||
): Component<Effect.Effect.Error<Eff>, Effect.Effect.Context<Eff>, P>
|
): Component<P, Effect.Effect.Error<Eff>, Effect.Effect.Context<Eff>>
|
||||||
<Eff extends Effect.Effect<React.ReactNode, any, any>, A, B, C, D, E, F, G, P extends {} = {}>(
|
<Eff extends Effect.Effect<React.ReactNode, any, any>, A, B, C, D, E, F, G, P extends {} = {}>(
|
||||||
body: (props: P) => A,
|
body: (props: P) => A,
|
||||||
a: (_: A, props: NoInfer<P>) => B,
|
a: (_: A, props: NoInfer<P>) => B,
|
||||||
@@ -278,7 +277,7 @@ export namespace make {
|
|||||||
e: (_: E, props: NoInfer<P>) => F,
|
e: (_: E, props: NoInfer<P>) => F,
|
||||||
f: (_: F, props: NoInfer<P>) => G,
|
f: (_: F, props: NoInfer<P>) => G,
|
||||||
g: (_: G, props: NoInfer<P>) => Eff,
|
g: (_: G, props: NoInfer<P>) => Eff,
|
||||||
): Component<Effect.Effect.Error<Eff>, Effect.Effect.Context<Eff>, P>
|
): Component<P, Effect.Effect.Error<Eff>, Effect.Effect.Context<Eff>>
|
||||||
<Eff extends Effect.Effect<React.ReactNode, any, any>, A, B, C, D, E, F, G, H, P extends {} = {}>(
|
<Eff extends Effect.Effect<React.ReactNode, any, any>, A, B, C, D, E, F, G, H, P extends {} = {}>(
|
||||||
body: (props: P) => A,
|
body: (props: P) => A,
|
||||||
a: (_: A, props: NoInfer<P>) => B,
|
a: (_: A, props: NoInfer<P>) => B,
|
||||||
@@ -289,7 +288,7 @@ export namespace make {
|
|||||||
f: (_: F, props: NoInfer<P>) => G,
|
f: (_: F, props: NoInfer<P>) => G,
|
||||||
g: (_: G, props: NoInfer<P>) => H,
|
g: (_: G, props: NoInfer<P>) => H,
|
||||||
h: (_: H, props: NoInfer<P>) => Eff,
|
h: (_: H, props: NoInfer<P>) => Eff,
|
||||||
): Component<Effect.Effect.Error<Eff>, Effect.Effect.Context<Eff>, P>
|
): Component<P, Effect.Effect.Error<Eff>, Effect.Effect.Context<Eff>>
|
||||||
<Eff extends Effect.Effect<React.ReactNode, any, any>, A, B, C, D, E, F, G, H, I, P extends {} = {}>(
|
<Eff extends Effect.Effect<React.ReactNode, any, any>, A, B, C, D, E, F, G, H, I, P extends {} = {}>(
|
||||||
body: (props: P) => A,
|
body: (props: P) => A,
|
||||||
a: (_: A, props: NoInfer<P>) => B,
|
a: (_: A, props: NoInfer<P>) => B,
|
||||||
@@ -301,7 +300,7 @@ export namespace make {
|
|||||||
g: (_: G, props: NoInfer<P>) => H,
|
g: (_: G, props: NoInfer<P>) => H,
|
||||||
h: (_: H, props: NoInfer<P>) => I,
|
h: (_: H, props: NoInfer<P>) => I,
|
||||||
i: (_: I, props: NoInfer<P>) => Eff,
|
i: (_: I, props: NoInfer<P>) => Eff,
|
||||||
): Component<Effect.Effect.Error<Eff>, Effect.Effect.Context<Eff>, P>
|
): Component<P, Effect.Effect.Error<Eff>, Effect.Effect.Context<Eff>>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -367,15 +366,15 @@ export const withOptions: {
|
|||||||
))
|
))
|
||||||
|
|
||||||
export const withRuntime: {
|
export const withRuntime: {
|
||||||
<E, R, P extends {}>(
|
<P extends {}, E, R>(
|
||||||
context: React.Context<Runtime.Runtime<R>>,
|
context: React.Context<Runtime.Runtime<R>>,
|
||||||
): (self: Component<E, R, P>) => React.FC<P>
|
): (self: Component<P, E, R>) => React.FC<P>
|
||||||
<E, R, P extends {}>(
|
<P extends {}, E, R>(
|
||||||
self: Component<E, R, P>,
|
self: Component<P, E, R>,
|
||||||
context: React.Context<Runtime.Runtime<R>>,
|
context: React.Context<Runtime.Runtime<R>>,
|
||||||
): React.FC<P>
|
): React.FC<P>
|
||||||
} = Function.dual(2, <E, R, P extends {}>(
|
} = Function.dual(2, <P extends {}, E, R>(
|
||||||
self: Component<E, R, P>,
|
self: Component<P, E, R>,
|
||||||
context: React.Context<Runtime.Runtime<R>>,
|
context: React.Context<Runtime.Runtime<R>>,
|
||||||
): React.FC<P> => function WithRuntime(props) {
|
): React.FC<P> => function WithRuntime(props) {
|
||||||
const runtime = React.useContext(context)
|
const runtime = React.useContext(context)
|
||||||
|
|||||||
@@ -46,11 +46,11 @@ const SuspenseProto = Object.freeze({
|
|||||||
|
|
||||||
export const isSuspense = (u: unknown): u is Suspense => Predicate.hasProperty(u, TypeId)
|
export const isSuspense = (u: unknown): u is Suspense => Predicate.hasProperty(u, TypeId)
|
||||||
|
|
||||||
export const suspense = <T extends Component.Component<any, any, P>, P extends {}>(
|
export const suspense = <T extends Component.Component<P, any, any>, P extends {}>(
|
||||||
self: T & Component.Component<any, any, ExcludeKeys<P, keyof Suspense.Props>>
|
self: T & Component.Component<ExcludeKeys<P, keyof Suspense.Props>, any, any>
|
||||||
): (
|
): (
|
||||||
& Omit<T, keyof Component.Component<Component.Component.Error<T>, Component.Component.Context<T>, P>>
|
& Omit<T, keyof Component.Component<P, Component.Component.Error<T>, Component.Component.Context<T>>>
|
||||||
& Component.Component<Component.Component.Error<T>, Component.Component.Context<T>, P & Suspense.Props>
|
& Component.Component<P & Suspense.Props, Component.Component.Error<T>, Component.Component.Context<T>>
|
||||||
& Suspense
|
& Suspense
|
||||||
) => Object.setPrototypeOf(
|
) => Object.setPrototypeOf(
|
||||||
Object.assign(function() {}, self, SuspenseProto),
|
Object.assign(function() {}, self, SuspenseProto),
|
||||||
|
|||||||
Reference in New Issue
Block a user