mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 23:07:06 +00:00
This reverts commit 4f67985026.
This commit is contained in:
Vendored
+3
-4
@@ -16,13 +16,12 @@
|
||||
// Ethan Setnik <https://github.com/esetnik>
|
||||
// Walter Barbagallo <https://github.com/bwlt>
|
||||
// Kota Marusue <https://github.com/mrsekut>
|
||||
// Andrew Luca <https://github.com/iamandrewluca>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 3.0
|
||||
import {
|
||||
ComponentClass,
|
||||
StatelessComponent,
|
||||
ReactElement
|
||||
ComponentClass,
|
||||
StatelessComponent,
|
||||
ReactElement
|
||||
} from "react";
|
||||
|
||||
export type FieldType = "Field" | "FieldArray";
|
||||
|
||||
Vendored
+8
-8
@@ -68,15 +68,15 @@ export interface RegisteredField {
|
||||
type: "Field" | "FieldArray";
|
||||
}
|
||||
|
||||
export interface InjectedFormProps<FormData = any, P = {}, ErrorType = string> {
|
||||
export interface InjectedFormProps<FormData = {}, P = {}, ErrorType = string> {
|
||||
anyTouched: boolean;
|
||||
array: InjectedArrayProps;
|
||||
asyncValidate(): void;
|
||||
asyncValidating: keyof FormData | boolean;
|
||||
autofill<F extends keyof FormData>(field: F, value: FormData[F]): void;
|
||||
blur<F extends keyof FormData>(field: F, value: FormData[F]): void;
|
||||
change<F extends keyof FormData>(field: F, value: FormData[F]): void;
|
||||
clearAsyncError(field: keyof FormData): void;
|
||||
asyncValidating: string | boolean;
|
||||
autofill(field: string, value: any): void;
|
||||
blur(field: string, value: any): void;
|
||||
change(field: string, value: any): void;
|
||||
clearAsyncError(field: string): void;
|
||||
destroy(): void;
|
||||
dirty: boolean;
|
||||
error: ErrorType;
|
||||
@@ -91,8 +91,8 @@ export interface InjectedFormProps<FormData = any, P = {}, ErrorType = string> {
|
||||
submitFailed: boolean;
|
||||
submitSucceeded: boolean;
|
||||
submitting: boolean;
|
||||
touch(...field: Array<keyof FormData>): void;
|
||||
untouch(...field: Array<keyof FormData>): void;
|
||||
touch(...field: string[]): void;
|
||||
untouch(...field: string[]): void;
|
||||
valid: boolean;
|
||||
warning: any;
|
||||
registeredFields: { [name: string]: RegisteredField };
|
||||
|
||||
@@ -477,41 +477,3 @@ class TestFormComponent2 extends React.Component<TestFormComponentProps & Inject
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
function TestInjectedFormPropsWithType(props: InjectedFormProps<{ foo: string; }>) {
|
||||
props.asyncValidating === 'foo';
|
||||
props.asyncValidating === true;
|
||||
props.asyncValidating === false;
|
||||
props.autofill('foo', '');
|
||||
props.blur('foo', '');
|
||||
props.change('foo', '');
|
||||
props.clearAsyncError('foo');
|
||||
props.touch('foo');
|
||||
props.untouch('foo');
|
||||
props.asyncValidating === 'baz'; // $ExpectError
|
||||
props.autofill('foo', 1); // $ExpectError
|
||||
props.blur('foo', 1); // $ExpectError
|
||||
props.change('foo', 1); // $ExpectError
|
||||
props.autofill('baz', ''); // $ExpectError
|
||||
props.blur('baz', ''); // $ExpectError
|
||||
props.change('baz', ''); // $ExpectError
|
||||
props.clearAsyncError('baz'); // $ExpectError
|
||||
props.touch('baz'); // $ExpectError
|
||||
props.untouch('baz'); // $ExpectError
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
function TestInjectedFormPropsWithoutType(props: InjectedFormProps) {
|
||||
props.asyncValidating === 'foo';
|
||||
props.asyncValidating === true;
|
||||
props.asyncValidating === false;
|
||||
props.autofill('foo', '');
|
||||
props.blur('foo', '');
|
||||
props.change('foo', '');
|
||||
props.clearAsyncError('foo');
|
||||
props.touch('foo');
|
||||
props.untouch('foo');
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user