import type { Static, TSchema, TSchemaOptions, TUnsafe } from 'typebox' import { Unsafe } from 'typebox' export function TypeboxRef(t: T, options: TSchemaOptions = {}): TUnsafe> { const id = (t as unknown as Record).$id if (!id) { throw new Error('missing ID on schema') } return Unsafe>({ ...t, $ref: id, $id: undefined, ...options }) }