procxy / V8Serializable
Type Alias: V8Serializable
ts
type V8Serializable =
| Jsonifiable
| Buffer
| ArrayBuffer
| DataView
| Int8Array
| Uint8Array
| Uint8ClampedArray
| Int16Array
| Uint16Array
| Int32Array
| Uint32Array
| Float32Array
| Float64Array
| BigInt64Array
| BigUint64Array
| Map<any, any>
| Set<any>
| Error
| RegExp
| bigint
| Date
| {
[key: string]: V8Serializable | undefined;
}
| ReadonlyArray<V8Serializable>;Defined in: src/shared/serialization.ts:34
Union of all types that survive Node.js V8 structured-clone serialization across an IPC boundary.
Remarks
This is the allowed-type set for method arguments and return values when serialization: 'advanced' is active in ProcxyOptions. It is a superset of type-fest's Jsonifiable:
- All JSON types: primitives, plain objects, arrays,
null - Binary:
Buffer,ArrayBuffer,DataView, allTypedArrayvariants - Collections:
Map,Set(keys and values are recursivelyV8Serializable) - Special primitives:
bigint - Built-in objects:
Date,RegExp,Error(preserved with their prototype)
Not included (will throw SerializationError at runtime):
- Functions / closures
- Symbols
- Class instances with custom prototypes (other than the built-ins above)
- Objects with getter/setter properties
- Circular references (these throw during serialization)
Use sanitizeForV8 to strip non-serializable properties before sending if your objects come from external sources that may include methods or getters.