import { HasTag, ObjectValue, SomeSpec, Spec, SpecKind, SpectypesError } from './types.js' import { error } from './error.js' type InferKindObject> = 'transformer' extends { readonly [Key in keyof Specs]: Specs[Key] extends Spec ? SpecKind : never }[keyof Specs] ? 'transformer' : 'validator' /** * Creates an object validator spec. * Validation will fail if validated object has a property set different from the one specified * by `specs` param. * * @param specs Specs to validate object properties */ export const object: = Record>( specs: Specs & { readonly [Key in keyof Specs]: Specs[Key] extends Spec ? HasTag extends true ? SpectypesError<'filter', 'object'> : HasTag extends true ? SpectypesError<'lazy', 'object'> : Specs[Key] : never } ) => Spec<['object'], InferKindObject, ObjectValue> = error