Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
fabian-hiller opened this issue Oct 11, 2023 · 0 comments
Open
Assignees
Labels
enhancement New feature or request

Comments

@fabian-hiller
Copy link
Owner

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.

@fabian-hiller fabian-hiller self-assigned this Oct 11, 2023
@fabian-hiller fabian-hiller added the enhancement New feature or request label Oct 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant