unknownutil
unknownutil copied to clipboard
feat: add `SideEffect` to the `Predicate` so that `assert` or `ensure` can produce more user-friendly error messages
Assumed to use SideEffect for recording which part of the array/object attribute cause failer. Like
export type SideEffect = (value: unknown) => void;
export type Predicate<T> = (x: unknown, sideEffect?: SideEffect) => x is T;