@shopify/react-compose
Advanced tools
Comparing version 0.1.12 to 1.0.0
@@ -11,4 +11,10 @@ # Changelog | ||
## 1.0.0 - 2019-04-23 | ||
### Fixed | ||
- The type signature of the component returned by `compose` now correctly strips the composed props in TypeScript 3.2+ ([#602](https://github.com/Shopify/quilt/pull/602)) | ||
## 0.1.10 - 2019-01-09 | ||
- Start of Changelog |
@@ -5,2 +5,2 @@ import * as React from 'react'; | ||
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> & C) | (React.FunctionComponent<Props> & C); | ||
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">>); |
{ | ||
"name": "@shopify/react-compose", | ||
"version": "0.1.12", | ||
"version": "1.0.0", | ||
"license": "MIT", | ||
@@ -26,2 +26,3 @@ "description": "Cleanly compose multiple component enhancers together with minimal fuss", | ||
"dependencies": { | ||
"@shopify/useful-types": "^1.2.4", | ||
"hoist-non-react-statics": "^3.0.1", | ||
@@ -35,5 +36,5 @@ "tslib": "^1.9.3" | ||
"@types/enzyme": "^3.1.10", | ||
"typescript": "~3.1.6" | ||
"typescript": "~3.2.1" | ||
}, | ||
"sideEffects": false | ||
} |
import * as React from 'react'; | ||
import hoistStatics from 'hoist-non-react-statics'; | ||
import {NonReactStatics} from '@shopify/useful-types'; | ||
@@ -16,3 +17,3 @@ export type ReactComponent<P> = React.ComponentType<P>; | ||
OriginalComponent: ReactComponent<ComposedProps> & C, | ||
): ReactComponent<Props> & C { | ||
): ReactComponent<Props> & NonReactStatics<typeof OriginalComponent> { | ||
const result: ReactComponent<ComposedProps> = wrappingFunctions.reduceRight( | ||
@@ -27,4 +28,4 @@ (component: ReactComponent<any>, wrappingFunction: WrappingFunction) => | ||
OriginalComponent as ComponentClass, | ||
) as ReactComponent<Props> & C; | ||
) as ReactComponent<Props> & NonReactStatics<typeof OriginalComponent>; | ||
}; | ||
} |
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
17247
198
1
4
+ Added@shopify/useful-types@^1.2.4
+ Added@shopify/useful-types@1.3.0(transitive)
+ Added@types/react@19.0.8(transitive)
+ Addedcsstype@3.1.3(transitive)