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
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.
The text was updated successfully, but these errors were encountered:
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 ofdecode
is stillRecord<string, unknown>
, and this behavior can be controlled by a second generic, for example a boolean. Sodecode<MyType, true>(...)
would have the return typeMyType
.The text was updated successfully, but these errors were encountered: