Skip to content

Conversation

@BarryThePenguin
Copy link
Contributor

Changes JSONParsed so it will infer unknown values as JSONValue.

I also included handling for bigint so JSONParsed will be never, indicating that an error will be thrown.

fixes #4368

@codecov
Copy link

codecov bot commented Sep 11, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.25%. Comparing base (6792789) to head (4f8954d).
⚠️ Report is 3 commits behind head on main.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

U,
'json'
>
> = Response & TypedResponse<JSONParsed<T>, U, 'json'>
Copy link
Contributor Author

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>

Copy link
Member

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.

Copy link
Member

@yusukebe yusukebe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@yusukebe
Copy link
Member

@BarryThePenguin

Thank you! Looks good.

@yusukebe yusukebe merged commit f8c9b6e into honojs:main Sep 12, 2025
20 checks passed
@BarryThePenguin BarryThePenguin deleted the fix/json-parsed-unknown branch September 13, 2025 02:26
@ex0ns ex0ns mentioned this pull request Sep 19, 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

Successfully merging this pull request may close these issues.

RPC client infers object with an unknown property as never

2 participants