export type ReactComponentLike = | string | ((props: any, context?: any) => any) | (new(props: any, context?: any) => any); export interface ReactElementLike { type: ReactComponentLike; props: any; key: string | null; } export interface ReactNodeArray extends Iterable {} export type ReactNodeLike = | ReactElementLike | ReactNodeArray | string | number | boolean | null | undefined; export const nominalTypeHack: unique symbol; export type IsOptional = undefined extends T ? true : false; export type RequiredKeys = { [K in keyof V]-?: Exclude extends Validator ? IsOptional extends true ? never : K : never; }[keyof V]; export type OptionalKeys = Exclude>; export type InferPropsInner = { [K in keyof V]-?: InferType }; export interface Validator { ( props: { [key: string]: any }, propName: string, componentName: string, location: string, propFullName: string, ): Error | null; [nominalTypeHack]?: { type: T; } | undefined; } export interface Requireable extends Validator { isRequired: Validator>; } export type ValidationMap = { [K in keyof T]?: Validator }; /** * Like {@link ValidationMap} but treats `undefined`, `null` and optional properties the same. * This type is only added as a migration path in React 19 where this type was removed from React. * Runtime and compile time types would mismatch since you could see `undefined` at runtime when your types don't expect this type. */ export type WeakValidationMap = { [K in keyof T]?: null extends T[K] ? Validator : undefined extends T[K] ? Validator : Validator; }; export type InferType = V extends Validator ? T : any; export type InferProps = & InferPropsInner>> & Partial>>>; export const any: Requireable; export const array: Requireable; export const bool: Requireable; export const func: Requireable<(...args: any[]) => any>; export const number: Requireable; export const object: Requireable; export const string: Requireable; export const node: Requireable; export const element: Requireable; export const symbol: Requireable; export const elementType: Requireable; export function instanceOf(expectedClass: new(...args: any[]) => T): Requireable; export function oneOf(types: readonly T[]): Requireable; export function oneOfType>(types: T[]): Requireable>>; export function arrayOf(type: Validator): Requireable; export function objectOf(type: Validator): Requireable<{ [K in keyof any]: T }>; export function shape

>(type: P): Requireable>; export function exact

>(type: P): Requireable>>; /** * Assert that the values match with the type specs. * Error messages are memorized and will only be shown once. * * @param typeSpecs Map of name to a ReactPropType * @param values Runtime values that need to be type-checked * @param location e.g. "prop", "context", "child context" * @param componentName Name of the component for error messages * @param getStack Returns the component stack */ export function checkPropTypes( typeSpecs: any, values: any, location: string, componentName: string, getStack?: () => any, ): void; /** * Only available if NODE_ENV=production */ export function resetWarningCache(): void;