foop
Version:
interfaces that describe their intentions.
33 lines (29 loc) • 537 B
TypeScript
export interface ValidationFunction {
(arg: any): any
}
// all `is` validators, or any custom added ones
export type ValidatableType =
| ValidationFunction
| '? | [] ! &'
| 'string'
| 'number'
| 'date'
| 'boolean'
| 'function'
| 'error'
| 'map'
| 'set'
| 'object'
| 'regexp'
| 'array'
| 'symbol'
| 'real'
| 'empty'
| 'iterator'
| 'objWithKeys'
| 'null'
| 'undefined'
export interface Schemable<T> {
(key: string | any): T
}
export type Schema = Schemable<ValidatableType> | ValidatableType