import type React from "react"; export type GenericHook = (...args: TParams[]) => TReturn; export type GenericComponent = React.FunctionComponent; export type ComposedFunction = GenericHook; export type Decorator = (decoratee: T) => T; /** * Some decoratable components will always return `null`, by design. * To allow you to decorate these components, we must tell TS that the decorator is allowed to return not just `null` * (which is inferred from the component type), but also a JSX.Element. */ export type ComponentDecorator = (decoratee: T) => CanReturnNullOrElement; /** * @deprecated */ export type ComposableFC = T & { displayName?: string; original: T; originalName: string; }; export type Enumerable = T extends Array ? Array : never; export type ComposeWith = Decorator | Decorator[] | Decorator | Decorator[]; export type DecoratableHook = T & { original: T; originalName: string; }; export type DecoratableComponent = T & { original: T; originalName: string; displayName: string; }; export type Decoratable = DecoratableComponent | DecoratableHook; /** * @internal Add `null` to the ReturnType of the given function. */ export type CanReturnNullOrElement = T extends (...args: any) => any ? (...args: Parameters) => React.JSX.Element | null : never;