fix(types): remove void from SharedRenderProps component type#4064
fix(types): remove void from SharedRenderProps component type#4064cyphercodes wants to merge 1 commit intojaredpalmer:mainfrom
Conversation
The component prop in SharedRenderProps interface had an incorrect TypeScript type that included void in the union (React.ComponentType<T | void>). This caused TypeScript errors when using properly typed components with FieldArray or other components using SharedRenderProps. The component always receives the props of type T at runtime - there's no code path where it receives void. The type has been corrected to React.ComponentType<T>. Fixes jaredpalmer#4061
|
@cyphercodes is attempting to deploy a commit to the Formik Team on Vercel. A member of the Team first needs to authorize it. |
|
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. |
Summary
Fixes #4061
The component prop in SharedRenderProps interface had an incorrect TypeScript type that included
voidin the union (React.ComponentType<T | void>). This caused TypeScript errors when using properly typed components with FieldArray or other components using SharedRenderProps.Problem
When using the component prop with a properly typed component, TypeScript produced false errors because it expected the component to accept void as props:
Solution
The component always receives the props of type T at runtime - there's no code path where it receives void. The type has been corrected to
React.ComponentType<T>.Changes
React.ComponentType<T | void>toReact.ComponentType<T>in SharedRenderProps interfaceVerification