Type problem: form.item is not type safe due to not forwarding their type parameters to the rcForm components #29315
Labels
help wanted
The suggestion or request has been accepted, we need you to help us by sending a pull request.
Reproduction link
Steps to reproduce
When you visit the reproduction link you'll see:
src/index.tsx
that we're getting the error "Expected 0 type arguments, but got 1.ts(2558" sinceForm.Item
is not a generic. It can easily be generic since the rcForm component it wraps is generic. While I do not see this error in my local branch, I do see from looking into the types thatValues
inFormItemProps<Values = any>
is not being passed to the rcFieldForm'sFieldProps
from which it extends.any
type. For instance on lines 103-105, Typescript should be erroring but it doesn't have enough information to tell the user that the code won't actually error. EssentiallyshouldUpdate
is very unsafe.What is expected?
shouldUpdate
should not pass or return variables of typeany
if a type parameter is passed toForm.Item
. I.e. if I instantiate the component asForm.Item<{aKey: string}>
then the type ofshouldUpdate
should be:What is actually happening?
shouldUpdate
is of type:I caught this via the eslint rule
"@typescript-eslint/no-explicit-any"
The text was updated successfully, but these errors were encountered: