import type { JSX } from "../jsx";
export declare function enableHydration(): void;
/**
* A general `Component` has no implicit `children` prop. If desired, you can
* specify one as in `Component<{name: String, children: JSX.Element>}`.
*/
export declare type Component
= (props: P) => JSX.Element;
/**
* Extend props to forbid the `children` prop.
* Use this to prevent accidentally passing `children` to components that
* would silently throw them away.
*/
export declare type VoidProps
= P & {
children?: never;
};
/**
* `VoidComponent` forbids the `children` prop.
* Use this to prevent accidentally passing `children` to components that
* would silently throw them away.
*/
export declare type VoidComponent
= Component>;
/**
* Extend props to allow an optional `children` prop with the usual
* type in JSX, `JSX.Element` (which allows elements, arrays, functions, etc.).
* Use this for components that you want to accept children.
*/
export declare type ParentProps = P & {
children?: JSX.Element;
};
/**
* `ParentComponent` allows an optional `children` prop with the usual
* type in JSX, `JSX.Element` (which allows elements, arrays, functions, etc.).
* Use this for components that you want to accept children.
*/
export declare type ParentComponent
= Component>;
/**
* Extend props to require a `children` prop with the specified type.
* Use this for components where you need a specific child type,
* typically a function that receives specific argument types.
* Note that all JSX are of the type `JSX.Element`.
*/
export declare type FlowProps = P & {
children: C;
};
/**
* `FlowComponent` requires a `children` prop with the specified type.
* Use this for components where you need a specific child type,
* typically a function that receives specific argument types.
* Note that all JSX are of the type `JSX.Element`.
*/
export declare type FlowComponent = Component>;
/** @deprecated: use `ParentProps` instead */
export declare type PropsWithChildren = ParentProps
;
/**
* Takes the props of the passed component and returns its type
*
* @example
* ComponentProps // { mount?: Node; useShadow?: boolean; children: JSX.Element }
* ComponentProps<'div'> // JSX.HTMLAttributes
*/
export declare type ComponentProps> = T extends Component ? P : T extends keyof JSX.IntrinsicElements ? JSX.IntrinsicElements[T] : {};
/**
* Type of `props.ref`, for use in `Component` or `props` typing.
*
* @example Component<{ref: Ref}>
*/
export declare type Ref = T | ((val: T) => void);
export declare function createComponent(Comp: Component, props: T): JSX.Element;
declare type Override = T extends any ? U extends any ? {
[K in keyof T]: K extends keyof U ? undefined extends U[K] ? Exclude | T[K] : U[K] : T[K];
} & {
[K in keyof U]: K extends keyof T ? undefined extends U[K] ? Exclude | T[K] : U[K] : U[K];
} : T & U : T & U;
export declare type MergeProps = T extends [
infer Next | (() => infer Next),
...infer Rest
] ? MergeProps> : Curr;
export declare function mergeProps(...sources: T): MergeProps;
export declare type SplitProps = [
...{
[P in keyof K]: P extends `${number}` ? Pick[number]> : never;
},
Omit
];
export declare function splitProps(props: T, ...keys: K): SplitProps;
export declare function lazy>(fn: () => Promise<{
default: T;
}>): T & {
preload: () => Promise<{
default: T;
}>;
};
export declare function createUniqueId(): string;
export {};