import type { JSX } from "../jsx.js";
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 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 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 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 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 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 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 type FlowComponent = Component>;
/** @deprecated: use `ParentProps` instead */
export type PropsWithChildren = ParentProps
;
export type ValidComponent = keyof JSX.IntrinsicElements | Component | (string & {});
/**
* 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 type ComponentProps = T extends Component ? P : T extends keyof JSX.IntrinsicElements ? JSX.IntrinsicElements[T] : Record;
/**
* Type of `props.ref`, for use in `Component` or `props` typing.
*
* @example Component<{ref: Ref}>
*/
export type Ref = T | ((val: T) => void);
export declare function createComponent(Comp: Component, props: T): JSX.Element;
type DistributeOverride = T extends undefined ? F : T;
type Override = T extends any ? U extends any ? {
[K in keyof T]: K extends keyof U ? DistributeOverride : T[K];
} & {
[K in keyof U]: K extends keyof T ? DistributeOverride : U[K];
} : T & U : T & U;
type OverrideSpread = T extends any ? {
[K in keyof ({
[K in keyof T]: any;
} & {
[K in keyof U]?: any;
} & {
[K in U extends any ? keyof U : keyof U]?: any;
})]: K extends keyof T ? Exclude | T[K] : U extends any ? U[K & keyof U] : never;
} : T & U;
type Simplify = T extends any ? {
[K in keyof T]: T[K];
} : T;
type _MergeProps = T extends [
infer Next | (() => infer Next),
...infer Rest
] ? _MergeProps> : T extends [...infer Rest, infer Next | (() => infer Next)] ? Override<_MergeProps, Next> : T extends [] ? Curr : T extends (infer I | (() => infer I))[] ? OverrideSpread : Curr;
export type MergeProps = Simplify<_MergeProps>;
export declare function mergeProps(...sources: T): MergeProps;
export type SplitProps = [
...{
[P in keyof K]: P extends `${number}` ? Pick[number]> : never;
},
Omit
];
export declare function splitProps, K extends [readonly (keyof T)[], ...(readonly (keyof T)[])[]]>(props: T, ...keys: K): SplitProps;
export declare function lazy>(fn: () => Promise<{
default: T;
}>): T & {
preload: () => Promise<{
default: T;
}>;
};
export declare function createUniqueId(): string;
export {};