UNPKG

shapeit

Version:

Object validation tools for Javascript and, specially, Typescript

17 lines (16 loc) 472 B
import { PrimitiveOrGuard, GuardType } from '../types/guards'; /** * Creates an array shape where all elements must have the same type * * @example * const emailsShape = sp.arrayOf('string'); * * @example * const peopleShape = sp.arrayOf( * sp.shape({ * name: 'string', * age: 'number' * }) * ); */ export default function arrayOf<T extends PrimitiveOrGuard<unknown>>(type: T, maxLength?: number): import("../types/guards").Guard<GuardType<T>[]>;