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 know that this library already has basic typescript support, but it could be better.
In two ways:
Right now, both stringify and uneval are typed as (value: any) => string. So you won't get a compiler warning if you're giving it an input that would throw an error, like an object with functions. It's possible to define the exact type that value is allowed to be and that would be nice to have.
It would also be nice if you could do this:
interfaceUser{name: string}const{ user }=devalue.parse<{user: User}>(data)
In situations where you're absolutely sure what data is gonna parse to. I'm aware that right now you can achieve the same by writing it like this:
interfaceUser{name: string}const{ user }=devalue.parse(data)as{user: User}
So this second point is less important than the first, but still it would be nice.
Edit
If you approve, but don't feel like implementing it any time soon, I could submit a PR. :-)
The text was updated successfully, but these errors were encountered:
I know that this library already has basic typescript support, but it could be better.
In two ways:
stringify
anduneval
are typed as(value: any) => string
. So you won't get a compiler warning if you're giving it an input that would throw an error, like an object with functions. It's possible to define the exact type that value is allowed to be and that would be nice to have.In situations where you're absolutely sure what
data
is gonna parse to. I'm aware that right now you can achieve the same by writing it like this:So this second point is less important than the first, but still it would be nice.
Edit
If you approve, but don't feel like implementing it any time soon, I could submit a PR. :-)
The text was updated successfully, but these errors were encountered: