@@ -4,8 +4,8 @@ import { Context, type Duration, Effect, Equivalence, ExecutionStrategy, Exit, F
|
|||||||
import * as React from "react"
|
import * as React from "react"
|
||||||
|
|
||||||
|
|
||||||
export const TypeId: unique symbol = Symbol.for("@effect-fc/Component/Component")
|
export const ComponentTypeId: unique symbol = Symbol.for("@effect-fc/Component/Component")
|
||||||
export type TypeId = typeof TypeId
|
export type ComponentTypeId = typeof ComponentTypeId
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents an Effect-based React Component that integrates the Effect system with React.
|
* Represents an Effect-based React Component that integrates the Effect system with React.
|
||||||
@@ -13,7 +13,7 @@ export type TypeId = typeof TypeId
|
|||||||
export interface Component<P extends {}, A extends React.ReactNode, E, R>
|
export interface Component<P extends {}, A extends React.ReactNode, E, R>
|
||||||
extends ComponentPrototype<P, A, R>, ComponentOptions {
|
extends ComponentPrototype<P, A, R>, ComponentOptions {
|
||||||
new(_: never): Record<string, never>
|
new(_: never): Record<string, never>
|
||||||
readonly [TypeId]: TypeId
|
readonly [ComponentTypeId]: ComponentTypeId
|
||||||
readonly "~Props": P
|
readonly "~Props": P
|
||||||
readonly "~Success": A
|
readonly "~Success": A
|
||||||
readonly "~Error": E
|
readonly "~Error": E
|
||||||
@@ -34,7 +34,7 @@ export declare namespace Component {
|
|||||||
|
|
||||||
export interface ComponentPrototype<P extends {}, A extends React.ReactNode, R>
|
export interface ComponentPrototype<P extends {}, A extends React.ReactNode, R>
|
||||||
extends Pipeable.Pipeable {
|
extends Pipeable.Pipeable {
|
||||||
readonly [TypeId]: TypeId
|
readonly [ComponentTypeId]: ComponentTypeId
|
||||||
readonly use: Effect.Effect<(props: P) => A, never, Exclude<R, Scope.Scope>>
|
readonly use: Effect.Effect<(props: P) => A, never, Exclude<R, Scope.Scope>>
|
||||||
|
|
||||||
asFunctionComponent(
|
asFunctionComponent(
|
||||||
@@ -46,7 +46,7 @@ extends Pipeable.Pipeable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const ComponentPrototype: ComponentPrototype<any, any, any> = Object.freeze({
|
export const ComponentPrototype: ComponentPrototype<any, any, any> = Object.freeze({
|
||||||
[TypeId]: TypeId,
|
[ComponentTypeId]: ComponentTypeId,
|
||||||
...Pipeable.Prototype,
|
...Pipeable.Prototype,
|
||||||
|
|
||||||
get use() { return use(this) },
|
get use() { return use(this) },
|
||||||
@@ -127,7 +127,7 @@ export const defaultOptions: ComponentOptions = {
|
|||||||
export const nonReactiveTags = [Tracer.ParentSpan] as const
|
export const nonReactiveTags = [Tracer.ParentSpan] as const
|
||||||
|
|
||||||
|
|
||||||
export const isComponent = (u: unknown): u is Component<{}, React.ReactNode, unknown, unknown> => Predicate.hasProperty(u, TypeId)
|
export const isComponent = (u: unknown): u is Component<{}, React.ReactNode, unknown, unknown> => Predicate.hasProperty(u, ComponentTypeId)
|
||||||
|
|
||||||
export declare namespace make {
|
export declare namespace make {
|
||||||
export type Gen = {
|
export type Gen = {
|
||||||
|
|||||||
Reference in New Issue
Block a user