import { HasTag, ObjectValue, SomeSpec, Spec, SpectypesError } from './types.js' import { error } from './error.js' /** * Creates an object transformer spec. * All properties of validated object that are not present in `specs` param will be removed from * the result of successful validation. * * @param specs Specs to validate object properties */ export const struct: = Record>( specs: Specs & { readonly [Key in keyof Specs]: Specs[Key] extends Spec ? HasTag extends true ? SpectypesError<'filter', 'struct'> : HasTag extends true ? SpectypesError<'lazy', 'struct'> : Specs[Key] : never } ) => Spec<['struct'], 'transformer', ObjectValue> = error