Main serialization type that handles objects with toJSON methods. If a type has a toJSON method, extracts and serializes the return type. Otherwise, serializes the type directly.
The type to serialize
class User { constructor(public id: number, public name: string) {} toJSON() { return { id: this.id, name: this.name } }}type SerializedUser = SerializeJSONTypes<User>// Result: { id: number; name: string } Copy
class User { constructor(public id: number, public name: string) {} toJSON() { return { id: this.id, name: this.name } }}type SerializedUser = SerializeJSONTypes<User>// Result: { id: number; name: string }
Main serialization type that handles objects with toJSON methods. If a type has a toJSON method, extracts and serializes the return type. Otherwise, serializes the type directly.