question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Issue on TypeScript `FieldRenderProps` typings

See original GitHub issue

https://github.com/final-form/react-final-form/blob/a3ca5f169da5cb5abcf53d60285d8d43b08c427f/typescript/index.d.ts#L25

This typing does not work well with other react libraries.

For example with rc-select: http://react-component.github.io/select/#select-props in the onChange prop you don’t have access to the event, but only the value selected.

This is valid also for onFocus and onBlur props

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:8
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

5reactions
bcnichols3commented, May 13, 2019

This might be a tangential issue, but I’m seeing Form’s component prop demands a component whose props are defined as FieldRenderProps, which does not allow additional keys. This means that I’m only allowed props on my custom field components that are defined by React Final Form, which means they can’t be very custom at all. I can get around this with using children instead but does that feel a little hacky?

2reactions
francoislgcommented, Mar 23, 2019

Since onChange should work with a simple value, I workaround-ed it with onChange={(value: string) => (input as any).onChange(value)

Read more comments on GitHub >

github_iconTop Results From Across the Web

conflict when extends interface with react-final-form ...
I had the same problem today; I downgraded the versions of react-final-form and final-form and now it's working. Probably it's just a bug...
Read more >
Troubleshooting Handbook: Types
Have you read the TypeScript FAQ Your answer might be there! ... Union types are handy for solving some of these typing problems:...
Read more >
react-final-form - Bountysource
This commit https://github.com/final-form/react-final-form/issues/864 introduced a breaking change for TypeScript users because now mapped types over FormProps ...
Read more >
Documentation - JSX - TypeScript
You can specify the type of children like any other attribute. This will override the default type from, e.g. the React typings if...
Read more >
Usage with TypeScript - React Redux
Define Root State and Dispatch Types​. Using configureStore should not need any additional typings. You will, however, want to extract the ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found