shapeit
Version:
Object validation tools for Javascript and, specially, Typescript
14 lines (13 loc) • 461 B
TypeScript
import { PrimitiveOrGuard, UnshapeTuple } from '../types/guards';
/**
* Creates a guard for a tuple type. The order of the arguments is the same
* as the type order of the tuple
*
* @example
* const entryShape = sp.tuple('string', 'number');
*
* if (entryShape(input)) {
* input; // Typed as [string, number]
* }
*/
export default function tuple<T extends PrimitiveOrGuard<unknown>[]>(...types: T): import("../types/guards").Guard<UnshapeTuple<T>>;