mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-06 15:57:13 +00:00
[redux-form] Allow the "reduxForm()" function to wrap stateless functional
components and not just class components.
This commit is contained in:
Vendored
+3
-1
@@ -1,5 +1,6 @@
|
||||
import {
|
||||
Component,
|
||||
StatelessComponent,
|
||||
ReactElement,
|
||||
SyntheticEvent,
|
||||
ReactEventHandler,
|
||||
@@ -20,7 +21,8 @@ export function reduxForm(
|
||||
): FormDecorator<any, any, any>;
|
||||
|
||||
export interface FormDecorator<FormData extends DataShape, P, S> {
|
||||
<T extends (typeof Component)>(component: T): T & Form<FormData, P, S>;
|
||||
<T extends (typeof Component | StatelessComponent<any>)>(component: T):
|
||||
T & Form<FormData, P, S>;
|
||||
}
|
||||
|
||||
export interface Config<FormData extends DataShape, P, S> {
|
||||
|
||||
@@ -50,3 +50,9 @@ class MyForm extends Component<{}, {}> {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const MyStatelessFunctionalComponent: React.SFC<void> = () => <div/>;
|
||||
|
||||
reduxForm({
|
||||
form: 'mySFCForm'
|
||||
})(MyStatelessFunctionalComponent);
|
||||
|
||||
Reference in New Issue
Block a user