Add Component.withSignature
Lint / lint (push) Successful in 14s

This commit is contained in:
Julien Valverdé
2026-05-04 01:36:10 +02:00
parent c23e3212de
commit 130614c4c3
3 changed files with 45 additions and 10 deletions
+23
View File
@@ -500,6 +500,29 @@ export const makeUntraced: (
)
)
export declare namespace withSignature {
export type Signature = (props: any) => React.ReactNode
export type Result<
T extends Component<any, any, any, any>,
F extends React.FC,
> = Omit<T, "use" | "asFunctionComponent"> & {
readonly use: Effect.Effect<F, never, Exclude<Component.Context<T>, Scope.Scope>>
asFunctionComponent(
runtimeRef: React.Ref<Runtime.Runtime<Exclude<Component.Context<T>, Scope.Scope>>>
): F
}
}
export const withSignature: {
<F extends withSignature.Signature>(): <T extends Component<any, any, any, any>>(
self: T
) => withSignature.Result<T, F>
<F extends withSignature.Signature, T extends Component<any, any, any, any>>(
self: T
): withSignature.Result<T, F>
} = Function.dual(1, identity)
/**
* Creates a new component with modified configuration options while preserving all original behavior.
*