Skip to content

Add typescript support for structs#441

Open
dexsper wants to merge 1 commit intoCysharp:mainfrom
dexsper:main
Open

Add typescript support for structs#441
dexsper wants to merge 1 commit intoCysharp:mainfrom
dexsper:main

Conversation

@dexsper
Copy link
Copy Markdown

@dexsper dexsper commented Apr 9, 2026

  • Allow [GenerateTypeScript] on struct declarations (managed and unmanaged)
  • Managed structs use object-header wire format with non-nullable TS signatures; deserializeCore throws on null header instead of returning null
  • Unmanaged structs use raw memory blit: field offsets and padding are computed at generation time and emitted as writeZeros/skipBytes calls
  • Struct members in other types generate non-nullable TypeScript types
  • Add MEMPACK043 diagnostic for Nullable members (use struct directly)
  • Add writeZeros/skipBytes helpers to MemoryPackWriter/MemoryPackReader TS runtime
  • Add BoundingBox (struct-in-struct) and GameObject (class + mixed structs) to sandbox
  • Add comprehensive testStructs covering all struct combinations end-to-end

- Allow [GenerateTypeScript] on struct declarations (managed and unmanaged)
- Managed structs use object-header wire format with non-nullable TS signatures;
  deserializeCore throws on null header instead of returning null
- Unmanaged structs use raw memory blit: field offsets and padding are computed
  at generation time and emitted as writeZeros/skipBytes calls
- Struct members in other types generate non-nullable TypeScript types
- Add MEMPACK043 diagnostic for Nullable<struct> members (use struct directly)
- Add writeZeros/skipBytes helpers to MemoryPackWriter/MemoryPackReader TS runtime
- Add BoundingBox (struct-in-struct) and GameObject (class + mixed structs) to sandbox
- Add comprehensive testStructs covering all struct combinations end-to-end
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.

1 participant