Skip to content

Conversation

@kateinoigakukun
Copy link
Member

Motivation: enable ergonomic interop with JSON-style plain objects (e.g. JSON.parse results) without hand-written field mapping, while keeping exported structs as value types.

Changes:

  • Generate init(unsafelyCopying:) and toJSObject() for @js struct via per-struct JS helper shims.
  • Add JS glue support for struct lower/raise, plus a cleanup hook for temporary allocations created during lowering.
  • Add runtime unit tests for nested structs and optionals; update generated artifacts and snapshots.

Add struct-level helpers for copying values out of a backing JS object and raising a new JS object from a Swift struct.

This makes it possible to round-trip JSON-style plain objects without manual field mapping, while keeping the default value semantics of exported structs.
Copy link
Member

@krodak krodak left a comment

Choose a reason for hiding this comment

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

👌👌

@krodak krodak merged commit d79a9be into main Jan 27, 2026
9 checks passed
@krodak krodak deleted the katei/7d0c-add-init-unsafel branch January 27, 2026 03:17
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.

3 participants