[redux-form] add v8 typings

This commit is contained in:
VincentBel
2019-02-25 16:59:34 +08:00
parent 0caff1966b
commit e7f0f8216e
6 changed files with 18 additions and 7 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
// Type definitions for redux-form 7.5
// Type definitions for redux-form 8.1
// Project: https://github.com/erikras/redux-form, https://redux-form.com
// Definitions by: Carson Full <https://github.com/carsonf>
// Daniel Lytkin <https://github.com/aikoven>
+1 -1
View File
@@ -44,7 +44,7 @@ export interface BaseFieldProps<P = {}> extends Partial<CommonFieldProps> {
parse?: Parser;
validate?: Validator | Validator[];
warn?: Validator | Validator[];
withRef?: boolean;
forwardRef?: boolean;
immutableProps?: string[];
}
+1 -1
View File
@@ -6,7 +6,7 @@ export interface BaseFieldArrayProps<P = {}> {
component: ComponentType<P>;
validate?: Validator | Validator[];
warn?: Validator | Validator[];
withRef?: boolean;
forwardRef?: boolean;
props?: P;
rerenderOnEveryChange?: boolean;
}
+9 -2
View File
@@ -1,5 +1,10 @@
import { Component, ComponentType } from "react";
import { Formatter, Parser, WrappedFieldProps } from "../index";
import { Formatter, Parser, WrappedFieldProps, Validator } from "../index";
export type FieldsWarnerOrValidator =
| Validator
| Validator[]
| { [name: string]: Validator | Validator[] };
interface BaseFieldsProps<P = {}> {
names: string[];
@@ -7,7 +12,9 @@ interface BaseFieldsProps<P = {}> {
format?: Formatter | null;
props?: P;
parse?: Parser;
withRef?: boolean;
forwardRef?: boolean;
validate?: FieldsWarnerOrValidator;
warn?: FieldsWarnerOrValidator;
}
export interface GenericFields<P> extends Component<BaseFieldsProps<P> & P> {
+1 -1
View File
@@ -1,7 +1,7 @@
import { ReactNode, StatelessComponent } from "react";
export interface FormNameProps {
children: (props: { form: string }) => ReactNode;
children: (props: { form: string, sectionPrefix?: string }) => ReactNode;
}
export const FormName: StatelessComponent<FormNameProps>;
+5 -1
View File
@@ -422,7 +422,11 @@ class FormNameTest extends React.Component {
render() {
return (
<FormName>
{({ form }) => <span>Form Name is: {form}</span>}
{({ form, sectionPrefix }) => (
<span>
Form name is {form} and section prefix is {sectionPrefix}
</span>
)}
</FormName>
);
}