Skip to content

docs: document binary data support - #359

Open
xianjianlf2 wants to merge 1 commit into
flightcontrolhq:mainfrom
xianjianlf2:docs/binary-data-support
Open

docs: document binary data support#359
xianjianlf2 wants to merge 1 commit into
flightcontrolhq:mainfrom
xianjianlf2:docs/binary-data-support

Conversation

@xianjianlf2

@xianjianlf2 xianjianlf2 commented Aug 1, 2026

Copy link
Copy Markdown

Fixes #255

Summary

  • add typed arrays to the supported types table
  • document how typed arrays represent binary data in Superjson
  • show the JSON and metadata shape used to restore typed array instances

Validation

  • git diff --check
  • Not run: test suite (docs only).

Greptile Summary

Adds documentation for SuperJSON's typed-array support and explains how binary data is represented during serialization.

  • Adds typed arrays to the supported-types table.
  • Provides a Uint8Array round-trip example with its JSON and metadata representation.

Confidence Score: 4/5

The PR appears safe to merge, with one non-blocking correction needed to make the documented metadata shape exact.

Typed arrays and the shown API usage match the implementation, but serialization always adds v: 1 to metadata while the new equality example omits it.

Files Needing Attention: README.md

Important Files Changed

Filename Overview
README.md Documents typed-array serialization accurately overall, but the displayed metadata shape omits the emitted v: 1 field.
Prompt To Fix All With AI
### Issue 1
README.md:283
**Include the metadata version field**

The equality example presents the complete `meta` result, but `serialize` always adds `v: 1` when metadata exists. Exact comparisons based on this documented shape therefore fail.

```suggestion
// meta === { values: { bytes: [['typed-array', 'Uint8Array']] }, v: 1 }
```

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Reviews (1): Last reviewed commit: "docs: document binary data support" | Re-trigger Greptile

Greptile also left 1 inline comment on this PR.

@xianjianlf2
xianjianlf2 requested a review from Skn0tt as a code owner August 1, 2026 09:03
Comment thread README.md
const { json, meta } = superjson.serialize({ bytes });

// json === { bytes: [1, 2, 3] }
// meta === { values: { bytes: [['typed-array', 'Uint8Array']] } }

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Include the metadata version field

The equality example presents the complete meta result, but serialize always adds v: 1 when metadata exists. Exact comparisons based on this documented shape therefore fail.

Suggested change
// meta === { values: { bytes: [['typed-array', 'Uint8Array']] } }
// meta === { values: { bytes: [['typed-array', 'Uint8Array']] }, v: 1 }
Prompt To Fix With AI
This is a comment left during a code review.
Path: README.md
Line: 283

Comment:
**Include the metadata version field**

The equality example presents the complete `meta` result, but `serialize` always adds `v: 1` when metadata exists. Exact comparisons based on this documented shape therefore fail.

```suggestion
// meta === { values: { bytes: [['typed-array', 'Uint8Array']] }, v: 1 }
```

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

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.

Document binary data support

1 participant