Skip to content

App.tsx - Section needs type for "children" #268

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

Closed
ameetmadan opened this issue May 4, 2022 · 5 comments
Closed

App.tsx - Section needs type for "children" #268

ameetmadan opened this issue May 4, 2022 · 5 comments

Comments

@ameetmadan
Copy link

ameetmadan commented May 4, 2022

Expected results

What did you expect to happen?

App.tsx has no TypeScript errors

const Section: React.FC<{
  title: string;
  children: React.ReactNode; /* This line needs to be added to correct the errors */
}> = ({children, title}) => { ... }

Observed results

What happened?

App.tsx has TypeScript errors

const Section: React.FC<{
  title: string;
}> = ({children, title}) => { ... }
@leotm
Copy link
Contributor

leotm commented May 4, 2022

You've likely bumped @types/react to v18 (similar recent type error)

Sticking to

"resolutions": {
"@types/react": "^17"
},

should fix it, which keeps our PropsWithChildren type, meant for RN 0.68 and below

@leotm
Copy link
Contributor

leotm commented May 4, 2022

But yes RN 0.69.0-rc.0 bumps React to v18, when we'll want to bump @types/react to v18 with your change above

if you fancy giving it a shot (like here) - looking into it too, working well generally

@kersson
Copy link

kersson commented Jun 12, 2022

Be sure you have yarn installed so that npx react-native init doesn't use npm to install the dependencies since "resolutions" is a yarn-specific field.

@leotm
Copy link
Contributor

leotm commented Jun 23, 2022

btw this should be resolved since #277

thanks again for raising and the suggestion ^

@radko93
Copy link
Collaborator

radko93 commented Jun 23, 2022

Yes, this is resolved now.

@radko93 radko93 closed this as completed Jun 23, 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