procxy / Procxify
Type Alias: Procxify<T, Mode>
ts
type Procxify<T, Mode> = { [K in keyof T as T[K] extends (args: any[]) => any ? never : IsProcxiable<T[K], Mode> extends true ? K : never]: T[K] };Defined in: src/types/procxy.ts:217
Extract only the serializable, non-method properties from a type — the "data shape" of a class.
Type Parameters
| Type Parameter | Default type | Description |
|---|---|---|
T | - | Source type to extract properties from |
Mode extends SerializationMode | "json" | Serialization mode used to filter eligible properties |
Remarks
Procxify<T> picks every property of T that:
- Is not a function (methods are excluded)
- Is serializable under
Mode(passes IsProcxiable)
This is useful for typing data-transfer objects when you want to accept either a class instance or a plain representation of its data without committing to the full class type. It mirrors the role of type-fest's Jsonify<T> but respects the active serialization mode.
Properties are not recursively transformed — they retain their original types. This is a shallow pick, not a deep transform.
Example
typescript
import type { Procxify } from 'procxy';
class User {
id: number = 0;
name: string = '';
greet() { return `Hello ${this.name}`; }
}
type UserData = Procxify<User>;
// { id: number; name: string } — greet() excluded because it's a function