Skip to content

procxy / SerializableConstructorArgs

Type Alias: SerializableConstructorArgs<T, Mode>

ts
type SerializableConstructorArgs<T, Mode> = ConstructorParameters<Constructor<T>> extends infer Args ? { [K in keyof Args]: ValidateProcxiable<Args[K], Mode> } : never;

Defined in: src/types/procxy.ts:52

Constrain constructor argument types to be serializable under the given mode.

Type Parameters

Type ParameterDescription
TThe class whose constructor parameter types are being constrained
Mode extends SerializationModeThe serialization mode in use

Remarks

Applies ValidateProcxiable to each position of ConstructorParameters<T>. If a constructor argument type is not serializable for the chosen mode, TypeScript will surface an error with a descriptive { error: 'Type is not serializable'; expected: ...; received: ... } object.

This provides compile-time safety for constructor arguments passed to procxy(). It does not deeply validate nested object properties (TypeScript structural typing makes that infeasible); use sanitizeV8: true as a runtime fallback for those cases.

Released under the MIT License.