Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

react-native is a required dependency? #421

Closed
Guymestef opened this issue Feb 9, 2018 · 3 comments
Closed

react-native is a required dependency? #421

Guymestef opened this issue Feb 9, 2018 · 3 comments

Comments

@Guymestef
Copy link

My project is using typescript, I upgraded formik from 0.11.0-rc.2 to 0.11.9, and now my webpack build is outputtingthe error:
ERROR in [at-loader] ./node_modules/formik/dist/formik.d.ts:4:39
TS2307: Cannot find module 'react-native'.

Current Behavior

react-native is a required dependency

Desired Behavior

react-native is not a required dependency

Info

  • Formik Version: 0.11.9
  • OS: windows 10
  • Node Version: 9.5.0
  • Package Manager and version: npm 5.6.0
  • Typescript: 2.7.1
@corydeppen
Copy link
Contributor

One workaround, similar to what's needed for the missing prop-types declaration, is to install @types/react-native. Unfortunately, this causes the build to throw an error Duplicate identifier 'require' as mentioned in DefinitelyTyped/DefinitelyTyped#16825.

@jaredpalmer Since this is slightly different than the prop-types issue, do you think @types/react-native should be added to dependencies so TS devs don't have to worry about the extra install step? Or should this extra dependency be included with @types/prop-types in the install instructions?

@corydeppen
Copy link
Contributor

It looks like the Duplicate identifier 'require' error may have been hit and caused the @types/node dependency to be removed and a small workaround to be added to Formik. I'm hoping this isn't the recommended solution for devs relying on the Node types.

@jaredpalmer
Copy link
Owner

Yeah we are going to need to drop react-native TypeScript support. I tried and thought I had it working and tested on like 5 projects of mine. However, clearly I broke the universe. I’m out at dinner, but the revert is as follows: remove types array from ts config, uninstall/remove react-native types, remove that declaration, reinstall @types/node.

If someone can submit a PR I can merge ASAP and release off my phone’s

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants