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
When using json.isParse when data on the client, there is no guarantee that the data is valid JSON, since the user may have tampered with it. In such cases, json.isParse throws SyntaxError. This makes typia cumbersome to use, since I have to handle exceptions when all I want to know is whether the data parses to the correct type. When the data is not parsable it does not parse to the correct type, so I would expect the function to just return null in such cases.
This would be a breaking change, so I suggest either adding a parameter to isParse or creating a separate safeParse that returns null when an error is thrown.
I tried just making this helper function, but then I get a warning: [vite] warning: @rollup/plugin-typescript TS(typia.json.assertParse): non-specified generic argument. Seems like I can't use typia with generics?
The text was updated successfully, but these errors were encountered:
When using
json.isParse
when data on the client, there is no guarantee that the data is valid JSON, since the user may have tampered with it. In such cases,json.isParse
throwsSyntaxError
. This makes typia cumbersome to use, since I have to handle exceptions when all I want to know is whether the data parses to the correct type. When the data is not parsable it does not parse to the correct type, so I would expect the function to just returnnull
in such cases.This would be a breaking change, so I suggest either adding a parameter to
isParse
or creating a separatesafeParse
that returnsnull
when an error is thrown.For example:
I tried just making this helper function, but then I get a warning:
[vite] warning: @rollup/plugin-typescript TS(typia.json.assertParse): non-specified generic argument.
Seems like I can't use typia with generics?The text was updated successfully, but these errors were encountered: