Update dependency typescript to v7 - autoclosed #54
@@ -1,5 +1,5 @@
|
|||||||
/** biome-ignore-all lint/complexity/useArrowFunction: necessary for class prototypes */
|
/** biome-ignore-all lint/complexity/useArrowFunction: necessary for class prototypes */
|
||||||
import { Context, Effect, type Equivalence, Function, Predicate, Scope } from "effect"
|
import { type Context, Effect, type Equivalence, Function, Predicate, Scope } from "effect"
|
||||||
import * as React from "react"
|
import * as React from "react"
|
||||||
import * as Component from "./Component.js"
|
import * as Component from "./Component.js"
|
||||||
|
|
||||||
@@ -45,7 +45,7 @@ export const AsyncPrototype: AsyncPrototype = Object.freeze({
|
|||||||
|
|
||||||
return ({ fallback, name, ...props }: AsyncProps) => {
|
return ({ fallback, name, ...props }: AsyncProps) => {
|
||||||
const promise = Effect.runPromiseWith(contextRef.current)(
|
const promise = Effect.runPromiseWith(contextRef.current)(
|
||||||
Effect.andThen(
|
Effect.flatMap(
|
||||||
Component.useScope([], this),
|
Component.useScope([], this),
|
||||||
scope => Effect.provideService(this.body(props as P), Scope.Scope, scope),
|
scope => Effect.provideService(this.body(props as P), Scope.Scope, scope),
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ export const ComponentImplPrototype: ComponentImplPrototype<any, any> = Object.f
|
|||||||
contextRef: React.RefObject<Context.Context<Exclude<R, Scope.Scope>>>,
|
contextRef: React.RefObject<Context.Context<Exclude<R, Scope.Scope>>>,
|
||||||
) {
|
) {
|
||||||
return (props: P) => Effect.runSyncWith(contextRef.current)(
|
return (props: P) => Effect.runSyncWith(contextRef.current)(
|
||||||
Effect.andThen(
|
Effect.flatMap(
|
||||||
useScope([], this),
|
useScope([], this),
|
||||||
scope => Effect.provideService(this.body(props), Scope.Scope, scope),
|
scope => Effect.provideService(this.body(props), Scope.Scope, scope),
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -29,16 +29,16 @@ export const preludeLayer: Layer.Layer<
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
export const isReactRuntime = (u: unknown): u is ReactRuntime<unknown, unknown> => Predicate.hasProperty(u, TypeId)
|
export const isReactRuntime = (u: unknown): u is ReactRuntime<unknown, unknown> => Predicate.hasProperty(u, ReactRuntimeTypeId)
|
||||||
|
|
||||||
export const make = <R, ER>(
|
export const make = <R, ER>(
|
||||||
layer: Layer.Layer<R, ER>,
|
layer: Layer.Layer<R, ER>,
|
||||||
memoMap?: Layer.MemoMap,
|
memoMap?: Layer.MemoMap,
|
||||||
): ReactRuntime<Layer.Success<typeof layer> | R, ER> => Object.setPrototypeOf(
|
): ReactRuntime<Layer.Success<typeof preludeLayer> | R, ER> => Object.setPrototypeOf(
|
||||||
Object.assign(function() {}, {
|
Object.assign(function() {}, {
|
||||||
runtime: ManagedRuntime.make(
|
runtime: ManagedRuntime.make(
|
||||||
Layer.merge(layer, preludeLayer),
|
Layer.merge(layer, preludeLayer),
|
||||||
memoMap,
|
{ memoMap },
|
||||||
),
|
),
|
||||||
// biome-ignore lint/style/noNonNullAssertion: context initialization
|
// biome-ignore lint/style/noNonNullAssertion: context initialization
|
||||||
context: React.createContext<Context.Context<R>>(null!),
|
context: React.createContext<Context.Context<R>>(null!),
|
||||||
|
|||||||
Reference in New Issue
Block a user