final-form / final-form/react-final-form
Type problems/improvements in 6.3.3
- Dominant language
- JavaScript
- Stars
- 7.4k
- Forks
- 497
- PR merge metrics
- No merged PRs in 30d
Description
### Are you submitting a **bug report** or a **feature request**?
bug report (or improvement over the new types introduced with renderable props types).
### What is the current behavior?
Passing the value as the first generic argument of `Field` is not enough to get the input value's correct type.

You must pass at least the second argument partially to get it right:

### What is the expected behavior?
Passing the first argument could be enough.
### What's your environment?
`"react-final-form": "6.3.3"`
`"final-form": "4.18.5"`
### Other information
A possible fix in `index.d.ts`:
```ts
export interface FieldProps<
FieldValue,
T extends HTMLElement = HTMLElement,
RP extends FieldRenderProps = FieldRenderProps
> extends UseFieldConfig, RenderableProps {
name: string;
[otherProp: string]: any;
}
export const Field: <
FieldValue,
T extends HTMLElement = HTMLElement,
RP extends FieldRenderProps = FieldRenderProps<
FieldValue,
T
>,
>(
props: FieldProps
) => React.ReactElement;
```
And there you go, as it used to be:

An extra question. It doesn't seem to make sense to extend `AnyObject` here:
```ts
interface FieldInputProps extends AnyObject { //...
```
Contributor guide
Assessment
This issue has not been assessed yet.