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

Type JSON.parse() Return type Correctly Instead of Always Returning Unknown. #216

Open
gerkim62 opened this issue Jan 26, 2025 · 0 comments

Comments

@gerkim62
Copy link

gerkim62 commented Jan 26, 2025

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.

@gerkim62 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 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant