Skip to content

fix: @types/react 17 PropsWithChildren Generic type #356

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

eliot-liner
Copy link

@eliot-liner eliot-liner commented May 11, 2025

An TypeScript error occurred in React 17.

Type '{ children: ReactNode; }' has no properties in common with type 'IntrinsicAttributes & ThemeProviderProps'.

When I checked

"@types/react": "18.0.12"

  • type PropsWithChildren<P = unknown> = P & { children?: ReactNode | undefined };

"@types/react": "17.0.34"

  • type PropsWithChildren<P> = P & { children?: ReactNode | undefined };

So, to support React 17 version, we need to add Generic. Currently, we have no choice but to use ts-ignore because it always causes a type error.

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

Successfully merging this pull request may close these issues.

1 participant