Fix
All checks were successful
Lint / lint (push) Successful in 12s

This commit is contained in:
Julien Valverdé
2025-07-14 01:45:59 +02:00
parent 5dd71f4eb0
commit 0bb2a2fa01

View File

@@ -106,14 +106,24 @@ export const memo: {
)) ))
export interface Suspense {
readonly suspense: true
}
export const suspense = <T extends Component<any, any, any>>(
self: ExcludeKeys<T, keyof Suspense>
): T & Suspense => Object.setPrototypeOf(
{ ...self, suspense: true },
Object.getPrototypeOf(self),
)
export const useFC: { export const useFC: {
<E, R, P extends {}>( <E, R, P extends {}>(
self: Component<E, R, P> self: Component<E, R, P>
): Effect.Effect<React.FC<P>, never, Exclude<R, Scope.Scope>> ): Effect.Effect<React.FC<P>, never, Exclude<R, Scope.Scope>>
} = Effect.fn("useFC")(function* <E, R, P extends {}>( } = Effect.fn("useFC")(function* <E, R, P extends {}>(
self: self: Component<E, R, P> & (Memoized<P> | Suspense | {})
| Component<E, R, P> & Memoized<P>
| Component<E, R, P>
) { ) {
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>>()