You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Are you submitting a bug report or a feature request?
This is a bug report
What is the current behavior?
The TypeScript types for field names make extensive use of keyof operator. For an example look here. The keyof operator allows to limit the possible values of a string to the keys of an object. However, according to the documentation, nested paths are also supported. However, these are not supported by keyof operator. So in Typescript correct field names cannot be nested. For example a key like person.firstName cannot be specified, TypeScript will throw an error here.
What is the expected behavior?
Field names that are valid as per the documentation should also be possible TypeScript field names.
Are you submitting a bug report or a feature request?
This is a bug report
What is the current behavior?
The TypeScript types for field names make extensive use of
keyof
operator. For an example look here. Thekeyof
operator allows to limit the possible values of a string to the keys of an object. However, according to the documentation, nested paths are also supported. However, these are not supported bykeyof
operator. So in Typescript correct field names cannot be nested. For example a key likeperson.firstName
cannot be specified, TypeScript will throw an error here.What is the expected behavior?
Field names that are valid as per the documentation should also be possible TypeScript field names.
Other information
It seems React-Hook-Form has cracked the code of how to make this work: https://github.com/react-hook-form/react-hook-form/blob/5fef1f27d503e6bd49672ded5b1233fa0eb0ec92/src/types/form.ts#L526 Their types look very complex as well though.
The text was updated successfully, but these errors were encountered: