final-form / react-final-form

🏁 High performance subscription-based form state management for React
https://final-form.org/react
MIT License
7.39k stars 481 forks source link

TypeScript types for Mutators #978

Open pgross41 opened 2 years ago

pgross41 commented 2 years ago

Are you submitting a bug report or a feature request?

Feature Request

What is the current behavior?

The keys are unknown on form.mutators. Unable to use IDE auto-complete to use mutators. Unable to benefit from TypeScript typing.

image

What is the expected behavior?

Expect the IDE to know what mutators are registered, in the sandbox example below they are printed out: insert, concat, move, etc.

Sandbox Link

Here is a very minimal example that doesn't do anything (had trouble converting the JS example to TS) but on line 9 you can type form.mutators. then Ctrl+Space and see the lack of suggestions.

https://codesandbox.io/s/awesome-dawn-tjqv0x?file=/src/index.tsx

What's your environment?

react-final-form v6.5.8

douglasjunior commented 11 months ago

Please, this is the most requested feature for me.

I think we can use something like unistyles does with the internal theme type.

They simply have a style that we can override easily.

image

Docs: https://reactnativeunistyles.vercel.app/reference/theming/