assertElements<
T>(values,isElement,makeError):asserts values is readonly T[]
Defined in: packages/errors/src/index.ts:144
Assert that every element of values satisfies isElement, narrowing its
type. Throws the error makeError builds for the first element that
fails, naming its index.
Factored out because more than one package builds this same find-the-first-invalid-element check around its own ParseError subclass when decoding a serialized payload’s element array.
Type Parameters
Section titled “Type Parameters”T
Parameters
Section titled “Parameters”values
Section titled “values”readonly unknown[]
isElement
Section titled “isElement”(value) => value is T
makeError
Section titled “makeError”(invalidIndex) => KnotkitError
Returns
Section titled “Returns”asserts values is readonly T[]