Formik: Unable to import Form in [email protected]

Created on 23 Jun 2019  路  6Comments  路  Source: formium/formik

馃悰 Bug report

Current Behavior

Got an error when trying to import Form component from fomik package. Like this:

import { Formik, Form } from 'formik';
semantic error TS2305 Module '"../node_modules/formik/dist"' has no exported member 'Form'.

Expected behavior

In previous version We have an ability to import Form from formik package

Additional context

For some reason in generated types we have export default Form;
Screen Shot 2019-06-23 at 1 11 54 PM

Your environment

| Software | Version(s) |
| ---------------- | ---------- |
| Formik | 2.0.1-rc.7 |
| React | 16.8.6 |
| TypeScript | 3.5.1 |
| Operating System | macOS 10.14.5 |

Most helpful comment

Typescript 3.5.3 is released and fixes this issue 馃帀

See microsoft/TypeScript#31676

All 6 comments

I am seeing the exact same behavior [email protected]

+1
tmp fix by commenting export default Form directly in node_modules/formik/Form.d.ts...

This is because of https://github.com/microsoft/TypeScript/issues/31676

The solution for now is to downgrade typescript to 3.4.x.

I was able to augment the declaration for now:
formik.d.ts:

import { FormikFormProps } from "formik";

declare module "formik" {
  export function Form(props: FormikFormProps): JSX.Element;
}

Typescript 3.5.3 is released and fixes this issue 馃帀

See microsoft/TypeScript#31676

Going to deprecate that release and rebuild with 3.5.3

Was this page helpful?
0 / 5 - 0 ratings

Related issues

emartini picture emartini  路  3Comments

PeerHartmann picture PeerHartmann  路  3Comments

dfee picture dfee  路  3Comments

ancashoria picture ancashoria  路  3Comments

green-pickle picture green-pickle  路  3Comments