Typescript: Add formik to the user test suite

Created on 28 Dec 2017  路  9Comments  路  Source: microsoft/TypeScript

It seems that #20891 affects users of Formik, a React forms library.

It'd be good to have
some extra coverage https://github.com/jaredpalmer/formik

Bug Fixed Infrastructure

Most helpful comment

@sandersn IMHO this is more of a DX thing. On the one hand, adding tests for Apollo, Formik, etc might seem redundant. On the other hand, seems like a good idea to guarantee that the most popular libraries on GitHub are always compatible with the latest version of TypeScript (and are using the latest and greatest TS features).

All 9 comments

@DanielRosenwasser Do you have an actual TS example project for that library? I don't think the reported issue surfaces when just checking the .d.ts file.

I think both of the two examples will error

// (1) - explicit parameter annotation
interface FormTypes { firstName: string }
let el1 = <Formik
    initialValues={{ firstName: "Daniel"}}
    onSubmit={(values: FormTypes) => console.log("First name", values.firstName)} />


// (2) - parameter should be inferred, ends up as {}
let el2 = <Formik
    initialValues={{ firstName: "Daniel"}}
    onSubmit={values => console.log("First name", values.firstName)} />

If the only value of adding formik is as an end-to-end equivalent to the test for a fix to #20891, then I don't think it's worth it. Are there other properties of formik as a dependency that make it useful?

@sandersn IMHO this is more of a DX thing. On the one hand, adding tests for Apollo, Formik, etc might seem redundant. On the other hand, seems like a good idea to guarantee that the most popular libraries on GitHub are always compatible with the latest version of TypeScript (and are using the latest and greatest TS features).

Good point. I do think that we鈥檒l need more code than our typical import x from "library" for this test.

@sandersn are the two issues (jaredpalmer/formik#283 and jaredpalmer/formik#314) fixed in master now? or we are still breaking formik?

@weswigham can we ensure formik runs clean on master after #20995 is merged.

This is in our user suite in master now. Provided nothing has changed since the PR, it's in a state where the .d.ts itself typechecks, but the example component does not.

formik typechecks nowadays, so I'm going to close this. 馃憤

Was this page helpful?
0 / 5 - 0 ratings

Related issues

weswigham picture weswigham  路  3Comments

bgrieder picture bgrieder  路  3Comments

CyrusNajmabadi picture CyrusNajmabadi  路  3Comments

blendsdk picture blendsdk  路  3Comments

Antony-Jones picture Antony-Jones  路  3Comments