0.1.0 #1

Merged
Thilawyn merged 81 commits from next into master 2025-07-17 21:17:57 +02:00
Showing only changes of commit 0bb2a2fa01 - Show all commits

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: {
<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>>()