You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
it would be useful to support assertion function with assertion signatures, assertLength, assertMinLength, and assertNonEmpty. The implementation would be:
exportfunctionassertLength<T,Nextendsnumber>(arr: readonlyT[],length: N,): asserts arr is ReadonlyArrayExactLength<T,N>{if(!hasLength(arr,length)){thrownewError(`Length is expected to be equal to ${length}, got ${arr.length}`)}}