import { HasTag, PrettyType, SomeSpec, Spec, SpecKind, SpecSuccess, SpecTag, SpectypesError } from './types.js' import { error } from './error.js' // source: https://stackoverflow.com/questions/42999983/typescript-removing-readonly-modifier/43001581#43001581 type DeepWritable = PrettyType<{ -readonly [P in keyof T]: DeepWritable }> /** Creates an empty validator that removes `readonly` modifiers from the result of validation */ export const writable: ( spec: HasTag extends true ? SpectypesError<'filter', 'writable'> : ItemSpec ) => Spec, SpecKind, DeepWritable>> = error