UNPKG

react-to-imperative

Version:
16 lines 886 B
import type { JSXElementConstructor, PropsWithChildren, ReactElement, ReactNode } from 'react'; export type Props = Readonly<Record<string, any>>; export type PropsExtractor<I extends Props, O extends Props = I> = (element: { props: I; type: ReactElement<I>['type']; depth: number; }) => O | boolean; export type ElementCreator = <I>(type: JSXElementConstructor<I>, props: PropsWithChildren<I>) => ReactElement<I> | null; export declare const inspectElements: <I extends Readonly<Record<string, any>>, O extends Readonly<Record<string, any>> = I>(inputReactElements: ReactNode | ReactNode[], opts: PropsExtractor<I, O> | { propsExtractor: PropsExtractor<I, O>; maxDepth?: number | undefined; elementCreator?: ElementCreator | undefined; }) => O[]; export default inspectElements; export declare const callSafe: ElementCreator; //# sourceMappingURL=index.d.ts.map