-
-
Notifications
You must be signed in to change notification settings - Fork 840
fix(types): JSONParsed infer unknown values #4405
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
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4405 +/- ##
=======================================
Coverage 91.25% 91.25%
=======================================
Files 171 171
Lines 10909 10909
Branches 3143 3143
=======================================
Hits 9955 9955
Misses 953 953
Partials 1 1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| U, | ||
| 'json' | ||
| > | ||
| > = Response & TypedResponse<JSONParsed<T>, U, 'json'> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this change could be a seperate PR.
From what I understand JSONParsed already contains types that do the same thing as SimplifyDeepArray, specifically
...
: T extends ReadonlyArray<unknown>
? { [K in keyof T]: JSONParsed<InvalidToNull<T[K]>> }
: ...compared with SimplifyDeepArray
type SimplifyDeepArray<T> = T extends any[]
? { [E in keyof T]: SimplifyDeepArray<T[E]> }
: Simplify<T>There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed. We can remove SimplifyDeepArray. For now, I'll merge this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
|
Thank you! Looks good. |
Changes
JSONParsedso it will inferunknownvalues asJSONValue.I also included handling for
bigintsoJSONParsedwill benever, indicating that an error will be thrown.fixes #4368