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

The template lack deps @types/react #298

Closed
hua03 opened this issue Sep 23, 2022 · 4 comments
Closed

The template lack deps @types/react #298

hua03 opened this issue Sep 23, 2022 · 4 comments

Comments

@hua03
Copy link

hua03 commented Sep 23, 2022

Expected results

When use other package manager eg: npm, pnpm, no eslint errors are reported.

Observed results

when use pnpm install new package, there report import error:

TS7016: Could not find a declaration file for module 'react'. '/Users/huahao/WorkSpace/Project/Demo/ReactNativeTSApp/node_modules/.pnpm/react@18.1.0/node_modules/react/index.js' implicitly has an 'any' type.   If the 'react' package actually exposes this module, consider sending a pull request to amend 'https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react'

Logs

no logs, this is a eslint error.

Steps to reproduce

  1. init react native project with typescript template, pnpx react-native init ReactNativeTSApp --template react-native-template-typescript
  2. install new package with pnpm, pnpm install @react-navigation/native
@radko93
Copy link
Collaborator

radko93 commented Oct 2, 2022

I'm not so familiar with pnpm, do you have any potential solutions for this?

@tom-sherman
Copy link

Solution in userland is to install @types/react after initting the project.

The template ought to include them though instead of relying on them being pulled in by @types/react-native

@hua03
Copy link
Author

hua03 commented Oct 5, 2022

I agree with @tom-sherman that @types/react should be included in the template rather than being installed by users themselves.

EkaanshArora added a commit to EkaanshArora/react-native-template-typescript that referenced this issue Oct 13, 2022
As discussed in react-native-community#298, if we decide to add `@types/react` to the template this PR should work
emin93 pushed a commit that referenced this issue Oct 13, 2022
As discussed in #298, if we decide to add `@types/react` to the template this PR should work
@emin93
Copy link
Member

emin93 commented Oct 13, 2022

Fixed in 6.12.6, thanks for the contribution @EkaanshArora 👍

@emin93 emin93 closed this as completed Oct 13, 2022
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

4 participants