Skip to main content

Marshaling model

Marshaling depends on CLR slot type, direction, byref role, and explicit policy, rather than a universal JS-to-object conversion.

CLR/scenarioRepresentation
boolStrict boolean, no truthiness
IntegersFinite, integral, in-range number
Int64/UInt64Default number; explicit BigInt slots use bigint
null / voidnull / undefined
ReferencesByObj with declared view
StructsByVal; legal Table/UnpackedValues policies
ArraysCLR wrapper; ordinary SZArray inputs also accept dense JS Arrays
byte[] + BytesCopied Uint8Array
C#→JS byrefCall-scoped Opaque; in read-only

undefined means missing. Optional slots may use defaults; required references do not treat undefined as null. Nullable has separate no-value rules.

JS→CLR out consumes no input and returns tuple entries. ref/in consume input; temporary reassignment does not rebind JS variables or append out-tuple results.

Managed-reference structs and heap writes need roots/barriers. Borrows cannot cross return or await. Bytes/to_array copies are not zero-copy promises. See marshaling and policies.