We fixed formik :D (#21660)

This commit is contained in:
Wesley Wigham 2018-02-05 17:17:37 -08:00 committed by GitHub
parent 17554ff285
commit c33a14d66d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 31 deletions

View File

@ -12,8 +12,8 @@ Standard output:
../../../../built/local/lib.dom.d.ts(9264,13): error TS2300: Duplicate identifier 'Request'.
../../../../built/local/lib.dom.d.ts(13522,11): error TS2300: Duplicate identifier 'Window'.
../../../../built/local/lib.dom.d.ts(13711,13): error TS2300: Duplicate identifier 'Window'.
../../../../built/local/lib.es5.d.ts(1321,11): error TS2300: Duplicate identifier 'ArrayLike'.
../../../../built/local/lib.es5.d.ts(1350,6): error TS2300: Duplicate identifier 'Record'.
../../../../built/local/lib.es5.d.ts(1328,11): error TS2300: Duplicate identifier 'ArrayLike'.
../../../../built/local/lib.es5.d.ts(1357,6): error TS2300: Duplicate identifier 'Record'.
../../../../node_modules/@types/node/index.d.ts(150,13): error TS2403: Subsequent variable declarations must have the same type. Variable 'module' must be of type '{ [x: string]: any; }', but here has type 'NodeModule'.
node_modules/chrome-devtools-frontend/front_end/Runtime.js(43,8): error TS2339: Property '_importScriptPathPrefix' does not exist on type 'Window'.
node_modules/chrome-devtools-frontend/front_end/Runtime.js(95,28): error TS2339: Property 'response' does not exist on type 'EventTarget'.

View File

@ -1,28 +0,0 @@
Exit Code: 1
Standard output:
index.tsx(26,7): error TS2322: Type '{ initialValues: { email: string; password: string; }; validate: (values: Values) => FormikErrors...' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<Formik<{ initialValues: { email: string; password:...'.
Type '{ initialValues: { email: string; password: string; }; validate: (values: Values) => FormikErrors...' is not assignable to type 'Readonly<FormikConfig<{ email: string; password: string; }> & { initialValues: { email: string; p...'.
Types of property 'onSubmit' are incompatible.
Type '(values: Values, { setSubmitting, setErrors }: FormikActions<Values>) => void' is not assignable to type '((values: { email: string; password: string; }, formikActions: FormikActions<{ email: string; pas...'.
Type '(values: Values, { setSubmitting, setErrors }: FormikActions<Values>) => void' is not assignable to type '(values: { email: string; password: string; }, formikActions: FormikActions<{ email: string; pass...'.
Types of parameters 'values' and 'values' are incompatible.
Type '{ email: string; password: string; }' is not assignable to type 'Values'.
index.tsx(32,13): error TS2322: Type '{}' is not assignable to type 'FormikErrors<MyData>'.
Property 'email' is missing in type '{}'.
index.tsx(33,21): error TS2339: Property 'email' does not exist on type 'Values'.
index.tsx(36,68): error TS2339: Property 'email' does not exist on type 'Values'.
index.tsx(46,22): error TS2345: Argument of type 'Values' is not assignable to parameter of type 'MyData'.
index.tsx(47,11): error TS7006: Parameter 'user' implicitly has an 'any' type.
index.tsx(52,11): error TS7006: Parameter 'errors' implicitly has an 'any' type.
index.tsx(74,27): error TS2339: Property 'email' does not exist on type 'Values'.
index.tsx(76,20): error TS2339: Property 'email' does not exist on type 'FormikTouched<Values>'.
index.tsx(76,36): error TS2339: Property 'email' does not exist on type 'FormikErrors<Values>'.
index.tsx(76,58): error TS2339: Property 'email' does not exist on type 'FormikErrors<Values>'.
index.tsx(82,27): error TS2339: Property 'password' does not exist on type 'Values'.
index.tsx(84,20): error TS2339: Property 'password' does not exist on type 'FormikTouched<Values>'.
index.tsx(84,39): error TS2339: Property 'password' does not exist on type 'FormikErrors<Values>'.
index.tsx(84,64): error TS2339: Property 'password' does not exist on type 'FormikErrors<Values>'.
Standard error:

View File

@ -29,7 +29,7 @@ const Basic = () => (
}}
validate={values => {
// same as above, but feel free to move this into a class method now.
let errors: FormikErrors<MyData> = {};
let errors: FormikErrors<MyData> = {} as FormikErrors<MyData>; // FormikErrors<MyData> isn't optionalized, so in strict null checks this needs a cast
if (!values.email) {
errors.email = 'Required';
} else if (