Fix redux-form typings (#13867)

* Patch FormErrors and FormWarnings

* Allow passing ReactElement values to FormErrors and FormWarnings

* Add typescript version to the end of the header
This commit is contained in:
Alexandre
2017-01-10 11:31:57 -08:00
committed by Andy
parent 4b83c33651
commit 28d96a9ec9
+7 -2
View File
@@ -2,6 +2,7 @@
// Project: https://github.com/erikras/redux-form
// Definitions by: Carson Full <https://github.com/carsonf>, Daniel Lytkin <https://github.com/aikoven>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.1
///<reference types="react" />
@@ -16,9 +17,13 @@ export type FieldType = 'Field' | 'FieldArray';
export type DataShape = {[fieldName:string]: FieldValue};
export type FormErrors<FormData extends DataShape> = FormData & { _error?: string };
export type FormErrors<FormData extends DataShape> = {
[P in keyof FormData]?: React.ReactElement<any> | string;
} & { _error?: string };
export type FormWarnings<FormData extends DataShape> = FormData & { _warning?: string };
export type FormWarnings<FormData extends DataShape> = {
[P in keyof FormData]?: React.ReactElement<any> | string;
} & { _warning?: string };
/**
* A component class or stateless function component.