redux-zero
Advanced tools
Comparing version 5.1.2 to 5.1.3
# Changelog | ||
### 5.1.3 | ||
- Added ComponentProps concept and updated connect method type signature to accept generic type for ComponentProps so that type safety works when a connected component is used. | ||
### 5.1.2 | ||
@@ -4,0 +8,0 @@ |
{ | ||
"name": "redux-zero", | ||
"version": "5.1.2", | ||
"version": "5.1.3", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "dist/redux-zero.js", |
@@ -21,11 +21,11 @@ import * as React from "react"; | ||
} | ||
export default function connect<S = any>(mapToProps?: mapToProps<S>, actions?: {}): (Child: any) => { | ||
new (props: Readonly<any>): { | ||
export default function connect<S = any, P = any>(mapToProps?: mapToProps<S>, actions?: {}): (Child: any) => { | ||
new (props: Readonly<P>): { | ||
render(): JSX.Element; | ||
context: any; | ||
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<any>) => {} | Pick<{}, K>) | Pick<{}, K>, callback?: () => void): void; | ||
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<P>) => {} | Pick<{}, K>) | Pick<{}, K>, callback?: () => void): void; | ||
forceUpdate(callBack?: () => void): void; | ||
readonly props: Readonly<{ | ||
children?: React.ReactNode; | ||
}> & Readonly<any>; | ||
}> & Readonly<P>; | ||
state: Readonly<{}>; | ||
@@ -36,22 +36,22 @@ refs: { | ||
componentDidMount?(): void; | ||
shouldComponentUpdate?(nextProps: Readonly<any>, nextState: Readonly<{}>, nextContext: any): boolean; | ||
shouldComponentUpdate?(nextProps: Readonly<P>, nextState: Readonly<{}>, nextContext: any): boolean; | ||
componentWillUnmount?(): void; | ||
componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void; | ||
getSnapshotBeforeUpdate?(prevProps: Readonly<any>, prevState: Readonly<{}>): any; | ||
componentDidUpdate?(prevProps: Readonly<any>, prevState: Readonly<{}>, snapshot?: any): void; | ||
getSnapshotBeforeUpdate?(prevProps: Readonly<P>, prevState: Readonly<{}>): any; | ||
componentDidUpdate?(prevProps: Readonly<P>, prevState: Readonly<{}>, snapshot?: any): void; | ||
componentWillMount?(): void; | ||
UNSAFE_componentWillMount?(): void; | ||
componentWillReceiveProps?(nextProps: Readonly<any>, nextContext: any): void; | ||
UNSAFE_componentWillReceiveProps?(nextProps: Readonly<any>, nextContext: any): void; | ||
componentWillUpdate?(nextProps: Readonly<any>, nextState: Readonly<{}>, nextContext: any): void; | ||
UNSAFE_componentWillUpdate?(nextProps: Readonly<any>, nextState: Readonly<{}>, nextContext: any): void; | ||
componentWillReceiveProps?(nextProps: Readonly<P>, nextContext: any): void; | ||
UNSAFE_componentWillReceiveProps?(nextProps: Readonly<P>, nextContext: any): void; | ||
componentWillUpdate?(nextProps: Readonly<P>, nextState: Readonly<{}>, nextContext: any): void; | ||
UNSAFE_componentWillUpdate?(nextProps: Readonly<P>, nextState: Readonly<{}>, nextContext: any): void; | ||
}; | ||
new (props: any, context?: any): { | ||
new (props: P, context?: any): { | ||
render(): JSX.Element; | ||
context: any; | ||
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<any>) => {} | Pick<{}, K>) | Pick<{}, K>, callback?: () => void): void; | ||
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<P>) => {} | Pick<{}, K>) | Pick<{}, K>, callback?: () => void): void; | ||
forceUpdate(callBack?: () => void): void; | ||
readonly props: Readonly<{ | ||
children?: React.ReactNode; | ||
}> & Readonly<any>; | ||
}> & Readonly<P>; | ||
state: Readonly<{}>; | ||
@@ -62,13 +62,13 @@ refs: { | ||
componentDidMount?(): void; | ||
shouldComponentUpdate?(nextProps: Readonly<any>, nextState: Readonly<{}>, nextContext: any): boolean; | ||
shouldComponentUpdate?(nextProps: Readonly<P>, nextState: Readonly<{}>, nextContext: any): boolean; | ||
componentWillUnmount?(): void; | ||
componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void; | ||
getSnapshotBeforeUpdate?(prevProps: Readonly<any>, prevState: Readonly<{}>): any; | ||
componentDidUpdate?(prevProps: Readonly<any>, prevState: Readonly<{}>, snapshot?: any): void; | ||
getSnapshotBeforeUpdate?(prevProps: Readonly<P>, prevState: Readonly<{}>): any; | ||
componentDidUpdate?(prevProps: Readonly<P>, prevState: Readonly<{}>, snapshot?: any): void; | ||
componentWillMount?(): void; | ||
UNSAFE_componentWillMount?(): void; | ||
componentWillReceiveProps?(nextProps: Readonly<any>, nextContext: any): void; | ||
UNSAFE_componentWillReceiveProps?(nextProps: Readonly<any>, nextContext: any): void; | ||
componentWillUpdate?(nextProps: Readonly<any>, nextState: Readonly<{}>, nextContext: any): void; | ||
UNSAFE_componentWillUpdate?(nextProps: Readonly<any>, nextState: Readonly<{}>, nextContext: any): void; | ||
componentWillReceiveProps?(nextProps: Readonly<P>, nextContext: any): void; | ||
UNSAFE_componentWillReceiveProps?(nextProps: Readonly<P>, nextContext: any): void; | ||
componentWillUpdate?(nextProps: Readonly<P>, nextState: Readonly<{}>, nextContext: any): void; | ||
UNSAFE_componentWillUpdate?(nextProps: Readonly<P>, nextState: Readonly<{}>, nextContext: any): void; | ||
}; | ||
@@ -75,0 +75,0 @@ contextType?: React.Context<any>; |
@@ -393,2 +393,6 @@ <h1 align="center"> | ||
interface ComponentProps { | ||
value: string; | ||
} | ||
interface StoreProps { | ||
@@ -398,6 +402,6 @@ loading: boolean; | ||
type Props = StoreProps & BoundActions<State, typeof actions> | ||
type Props = ComponentProps & StoreProps & BoundActions<State, typeof actions> | ||
class Component = (props: Props) => ( | ||
<h1 onClick={() => props.setLoading(!props.loading)}>Stuff</h1> | ||
<h1 onClick={() => props.setLoading(!props.loading)}>{props.value}</h1> | ||
); | ||
@@ -407,3 +411,3 @@ | ||
const ConnectedComponent = connect( | ||
const ConnectedComponent = connect<State, ComponentProps>( | ||
mapToProps, | ||
@@ -410,0 +414,0 @@ actions |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
80040
441