import { CoreValidator } from 'suretype' import { Type } from 'typebox' export type IsTypeboxSchema = TSchema extends { static: unknown params: unknown } ? true : false export function isTypeboxSchema(schema: any): schema is Type.TSchema { return ( // typebox v1 (typeof schema === 'object' && '~kind' in schema) || // @sinclair/typebox v0.3x (typeof schema === 'object' && Symbol.for('TypeBox.Kind') in schema) ) } export type IsSuretypeSchema = TSchema extends { required: () => object nullable?: never } ? true : false export function isSuretypeSchema(schema: any): schema is CoreValidator { return typeof schema === 'object' && 'getJsonSchemaObject' in schema }