is-kit

tupleOf

Guard for fixed-length tuples with per-index guards.

import { tupleOf, isString, isNumber } from 'is-kit';
// Use varargs with tupleOf for best inference
const isPair = tupleOf(isString, isNumber);
isPair(['x', 1]); // true
isPair(['x']); // false