// @strict: true
declare class Component
{
constructor(props: Readonly
);
constructor(props: P, context?: any);
readonly props: Readonly
& Readonly<{ children?: {} }>;
}
interface ComponentClass
{
new (props: P, context?: any): Component
;
propTypes?: WeakValidationMap
;
defaultProps?: Partial
;
displayName?: string;
}
interface FunctionComponent
{
(props: P & { children?: {} }, context?: any): {} | null;
propTypes?: WeakValidationMap
;
defaultProps?: Partial
;
displayName?: string;
}
export declare const nominalTypeHack: unique symbol;
export interface Validator {
(props: object, propName: string, componentName: string, location: string, propFullName: string): Error | null;
[nominalTypeHack]?: T;
}
type WeakValidationMap = {
[K in keyof T]?: null extends T[K]
? Validator
: undefined extends T[K]
? Validator
: Validator
};
type ComponentType = ComponentClass
| FunctionComponent
;
export type Shared<
InjectedProps,
DecorationTargetProps extends Shared
> = {
[P in Extract]?: InjectedProps[P] extends DecorationTargetProps[P] ? DecorationTargetProps[P] : never;
};
// Infers prop type from component C
export type GetProps = C extends ComponentType ? P : never;
export type ConnectedComponentClass<
C extends ComponentType,
P
> = ComponentClass & {
WrappedComponent: C;
};
export type Matching = {
[P in keyof DecorationTargetProps]: P extends keyof InjectedProps
? InjectedProps[P] extends DecorationTargetProps[P]
? DecorationTargetProps[P]
: InjectedProps[P]
: DecorationTargetProps[P];
};
export type Omit = Pick>;
export type InferableComponentEnhancerWithProps =
>>>(
component: C
) => ConnectedComponentClass, keyof Shared>> & TNeedsProps>;