@@ -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: {
|
||||
<E, R, P extends {}>(
|
||||
self: Component<E, R, P>
|
||||
): Effect.Effect<React.FC<P>, never, Exclude<R, Scope.Scope>>
|
||||
} = Effect.fn("useFC")(function* <E, R, P extends {}>(
|
||||
self:
|
||||
| Component<E, R, P> & Memoized<P>
|
||||
| Component<E, R, P>
|
||||
self: Component<E, R, P> & (Memoized<P> | Suspense | {})
|
||||
) {
|
||||
const runtimeRef = React.useRef<Runtime.Runtime<Exclude<R, Scope.Scope>>>(null!)
|
||||
runtimeRef.current = yield* Effect.runtime<Exclude<R, Scope.Scope>>()
|
||||
|
||||
Reference in New Issue
Block a user