@@ -10,10 +10,8 @@ export type TypeId = typeof TypeId
|
||||
|
||||
export interface Component<E, R, P extends {}> extends Pipeable.Pipeable, Component.Options {
|
||||
new(_: never): {}
|
||||
|
||||
readonly [TypeId]: TypeId
|
||||
readonly body: (props: P) => Effect.Effect<React.ReactNode, E, R>
|
||||
readonly displayName?: string
|
||||
}
|
||||
|
||||
export namespace Component {
|
||||
@@ -22,6 +20,7 @@ export namespace Component {
|
||||
export type Props<T> = T extends Component<infer _E, infer _R, infer P> ? P : never
|
||||
|
||||
export interface Options {
|
||||
readonly displayName?: string
|
||||
readonly finalizerExecutionMode: "sync" | "fork"
|
||||
readonly finalizerExecutionStrategy: ExecutionStrategy.ExecutionStrategy
|
||||
}
|
||||
@@ -306,23 +305,6 @@ export const makeUntraced: make.Gen & make.NonGen = (
|
||||
|
||||
const displayNameFromBody = (body: Function) => !String.isEmpty(body.name) ? body.name : undefined
|
||||
|
||||
|
||||
export const withDisplayName: {
|
||||
<T extends Component<any, any, any>>(
|
||||
displayName: string
|
||||
): (self: T) => T
|
||||
<T extends Component<any, any, any>>(
|
||||
self: T,
|
||||
displayName: string,
|
||||
): T
|
||||
} = Function.dual(2, <T extends Component<any, any, any>>(
|
||||
self: T,
|
||||
displayName: string,
|
||||
): T => Object.setPrototypeOf(
|
||||
{ ...self, displayName },
|
||||
Object.getPrototypeOf(self),
|
||||
))
|
||||
|
||||
export const withOptions: {
|
||||
<T extends Component<any, any, any>>(
|
||||
options: Partial<Component.Options>
|
||||
|
||||
Reference in New Issue
Block a user