import { HasTag, SomeSpec, Spec, SpecKind, SpecSuccess, SpectypesError } from './types.js' import { error } from './error.js' /** * Creates a spec to validate a value with recursive type. * Doesn't support data that recursively references itself. * * @param spec Function that returns a spec */ export const lazy: ( spec: HasTag extends true ? SpectypesError<'filter', 'lazy'> : HasTag extends true ? SpectypesError<'lazy', 'lazy'> : () => ItemSpec ) => Spec<['lazy'], SpecKind, SpecSuccess> = error type LazySpec = Spec<['lazy'], Kind, Item> export type LazyValidatorSpec = LazySpec export type LazyTransformerSpec = LazySpec