Skip to content

DateToString

DateToString<T> = T extends Date ? string : T extends infer U[] ? DateToString<U>[] : T extends Record<string, unknown> ? { [K in keyof T]: DateToString<T[K]> } : T

Defined in: packages/db/src/json.ts:68

Type-level utility that converts Date fields to string in a type.

Maps { createdAt: Date; title: string } to { createdAt: string; title: string } so the return type of toJSON(row) accurately reflects the runtime shape.

T