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
Currently, JSON.parse in TypeScript (even with ts-reset) always returns unknown.
However, this behavior can be modified so that JSON.parse sometimes returns an object, only returning unknown when the output is actually unknown.
This concept has been demonstrated by Typed Rocks in his video. The source code for the demonstration is available here.
would love to see this in ts-reset.
The text was updated successfully, but these errors were encountered:
gerkim62
changed the title
It is possible to type the return type of JSON.parse() correctly instead of always unknown.
Type JSON.parse() Return Correctly Instead of Always Returning Unknown.
Jan 26, 2025
gerkim62
changed the title
Type JSON.parse() Return Correctly Instead of Always Returning Unknown.
Type JSON.parse() Return type Correctly Instead of Always Returning Unknown.
Jan 26, 2025
Currently,
JSON.parse
in TypeScript (even withts-reset
) always returnsunknown
.However, this behavior can be modified so that
JSON.parse
sometimes returns an object, only returningunknown
when the output is actually unknown.This concept has been demonstrated by Typed Rocks in his video. The source code for the demonstration is available here.
would love to see this in
ts-reset
.The text was updated successfully, but these errors were encountered: