UNPKG

@shopify/react-compose

Version:

Cleanly compose multiple component enhancers together with minimal fuss

7 lines 6.05 kB
import React from 'react'; import { NonReactStatics } from '@shopify/useful-types'; export declare type ReactComponent<P> = React.ComponentType<P>; export declare type ComponentClass = React.ComponentClass<any>; export declare type WrappingFunction = (Component: ReactComponent<any>) => ReactComponent<any>; export default function compose<Props>(...wrappingFunctions: WrappingFunction[]): <ComposedProps, C>(OriginalComponent: (React.ComponentClass<ComposedProps, any> & C) | (React.FunctionComponent<ComposedProps> & C)) => (React.ComponentClass<Props, any> & Pick<(React.ComponentClass<ComposedProps, any> & C) | (React.FunctionComponent<ComposedProps> & C), "defaultProps" | Exclude<keyof C, "propTypes" | "contextType" | "contextTypes" | "childContextTypes" | "displayName" | "getDerivedStateFromProps" | "getDefaultProps" | "getDerivedStateFromErrors"> | Exclude<"propTypes" & keyof C, "propTypes" | "contextType" | "contextTypes" | "childContextTypes" | "displayName" | "getDerivedStateFromProps" | "getDefaultProps" | "getDerivedStateFromErrors"> | Exclude<"contextType" & keyof C, "propTypes" | "contextType" | "contextTypes" | "childContextTypes" | "displayName" | "getDerivedStateFromProps" | "getDefaultProps" | "getDerivedStateFromErrors"> | Exclude<"contextTypes" & keyof C, "propTypes" | "contextType" | "contextTypes" | "childContextTypes" | "displayName" | "getDerivedStateFromProps" | "getDefaultProps" | "getDerivedStateFromErrors"> | Exclude<"childContextTypes" & keyof C, "propTypes" | "contextType" | "contextTypes" | "childContextTypes" | "displayName" | "getDerivedStateFromProps" | "getDefaultProps" | "getDerivedStateFromErrors"> | Exclude<"defaultProps" & keyof C, "propTypes" | "contextType" | "contextTypes" | "childContextTypes" | "displayName" | "getDerivedStateFromProps" | "getDefaultProps" | "getDerivedStateFromErrors"> | Exclude<"displayName" & keyof C, "propTypes" | "contextType" | "contextTypes" | "childContextTypes" | "displayName" | "getDerivedStateFromProps" | "getDefaultProps" | "getDerivedStateFromErrors"> | Exclude<"getDerivedStateFromProps" & keyof C, "propTypes" | "contextType" | "contextTypes" | "childContextTypes" | "displayName" | "getDerivedStateFromProps" | "getDefaultProps" | "getDerivedStateFromErrors"> | Exclude<"getDerivedStateFromError" & keyof C, "propTypes" | "contextType" | "contextTypes" | "childContextTypes" | "displayName" | "getDerivedStateFromProps" | "getDefaultProps" | "getDerivedStateFromErrors"> | Exclude<keyof C & "propTypes", "propTypes" | "contextType" | "contextTypes" | "childContextTypes" | "displayName" | "getDerivedStateFromProps" | "getDefaultProps" | "getDerivedStateFromErrors"> | Exclude<keyof C & "contextTypes", "propTypes" | "contextType" | "contextTypes" | "childContextTypes" | "displayName" | "getDerivedStateFromProps" | "getDefaultProps" | "getDerivedStateFromErrors"> | Exclude<keyof C & "defaultProps", "propTypes" | "contextType" | "contextTypes" | "childContextTypes" | "displayName" | "getDerivedStateFromProps" | "getDefaultProps" | "getDerivedStateFromErrors"> | Exclude<keyof C & "displayName", "propTypes" | "contextType" | "contextTypes" | "childContextTypes" | "displayName" | "getDerivedStateFromProps" | "getDefaultProps" | "getDerivedStateFromErrors">>) | (React.FunctionComponent<Props> & Pick<(React.ComponentClass<ComposedProps, any> & C) | (React.FunctionComponent<ComposedProps> & C), "defaultProps" | Exclude<keyof C, "propTypes" | "contextType" | "contextTypes" | "childContextTypes" | "displayName" | "getDerivedStateFromProps" | "getDefaultProps" | "getDerivedStateFromErrors"> | Exclude<"propTypes" & keyof C, "propTypes" | "contextType" | "contextTypes" | "childContextTypes" | "displayName" | "getDerivedStateFromProps" | "getDefaultProps" | "getDerivedStateFromErrors"> | Exclude<"contextType" & keyof C, "propTypes" | "contextType" | "contextTypes" | "childContextTypes" | "displayName" | "getDerivedStateFromProps" | "getDefaultProps" | "getDerivedStateFromErrors"> | Exclude<"contextTypes" & keyof C, "propTypes" | "contextType" | "contextTypes" | "childContextTypes" | "displayName" | "getDerivedStateFromProps" | "getDefaultProps" | "getDerivedStateFromErrors"> | Exclude<"childContextTypes" & keyof C, "propTypes" | "contextType" | "contextTypes" | "childContextTypes" | "displayName" | "getDerivedStateFromProps" | "getDefaultProps" | "getDerivedStateFromErrors"> | Exclude<"defaultProps" & keyof C, "propTypes" | "contextType" | "contextTypes" | "childContextTypes" | "displayName" | "getDerivedStateFromProps" | "getDefaultProps" | "getDerivedStateFromErrors"> | Exclude<"displayName" & keyof C, "propTypes" | "contextType" | "contextTypes" | "childContextTypes" | "displayName" | "getDerivedStateFromProps" | "getDefaultProps" | "getDerivedStateFromErrors"> | Exclude<"getDerivedStateFromProps" & keyof C, "propTypes" | "contextType" | "contextTypes" | "childContextTypes" | "displayName" | "getDerivedStateFromProps" | "getDefaultProps" | "getDerivedStateFromErrors"> | Exclude<"getDerivedStateFromError" & keyof C, "propTypes" | "contextType" | "contextTypes" | "childContextTypes" | "displayName" | "getDerivedStateFromProps" | "getDefaultProps" | "getDerivedStateFromErrors"> | Exclude<keyof C & "propTypes", "propTypes" | "contextType" | "contextTypes" | "childContextTypes" | "displayName" | "getDerivedStateFromProps" | "getDefaultProps" | "getDerivedStateFromErrors"> | Exclude<keyof C & "contextTypes", "propTypes" | "contextType" | "contextTypes" | "childContextTypes" | "displayName" | "getDerivedStateFromProps" | "getDefaultProps" | "getDerivedStateFromErrors"> | Exclude<keyof C & "defaultProps", "propTypes" | "contextType" | "contextTypes" | "childContextTypes" | "displayName" | "getDerivedStateFromProps" | "getDefaultProps" | "getDerivedStateFromErrors"> | Exclude<keyof C & "displayName", "propTypes" | "contextType" | "contextTypes" | "childContextTypes" | "displayName" | "getDerivedStateFromProps" | "getDefaultProps" | "getDerivedStateFromErrors">>); //# sourceMappingURL=index.d.ts.map