Closed Bram-dc closed 1 month ago
This is my final addition to the type provider. I use this to serialize dates like this:
import { createSerializerCompiler } from 'fastify-type-provider-zod' // eslint-disable-next-line @typescript-eslint/no-explicit-any export function replacer(this: any, key: string, value: any) { if (this[key] instanceof Date) { return { _type: 'date', value, } } return value } export const serializerCompiler = createSerializerCompiler({ replacer })
Thank you so much! I'll release 3.0.0 later today
This is my final addition to the type provider. I use this to serialize dates like this: