Function assertEachWith
- assertEachWith<T, Constrained>(
items: T[],
assertion: (item: T) => asserts item is Constrained,
message?: string,
): asserts items is Constrained[]Type Parameters
Parameters
- items: T[]
The array of items to inspect.
- assertion: (item: T) => asserts item is Constrained
The assertion function. If all items pass, the array itself will be constrained too.
Optional
message: stringOptional message to include if an assertion fails.
Returns asserts items is Constrained[]
- items: T[]
Asserts that all items pass the assertion. This function can be used to constrain a type from
T[]
toConstrained[]
.