Skip to content

Fully type the value paths of the seconds argument using a generic #2

Description

@fabian-hiller

I think that we can fully type the value paths of the seconds argument of the decode function using a generic. This way, we can make the API fully type safe. All we need to do is resolve the path of each data type in TypeScript. I have already implemented this in a similar way for Modular Forms.

Furthermore, my idea is that if a generic is specified, for example decode<MyType>(...), the return type of decode is still Record<string, unknown>, and this behavior can be controlled by a second generic, for example a boolean. So decode<MyType, true>(...) would have the return type MyType.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions