unknownutil
unknownutil copied to clipboard
Deprecate `name` and `message` options of `assert` and `ensure`
If @core/errorutil offers error alteration functions as proposed in https://github.com/jsr-core/errorutil/issues/3, I believe we can deprecate the name and message options in assert and ensure.
I'd like to deprecate these options due to issue #121. Additionally, I'd like to deprecate setAssertMessageFactory (and its related functions) to simplify the overall implementation.
Before proceeding, I'd like to gauge how many users currently rely on these functionalities and whether they are open to migrating their code to the solution mentioned in the issue.
import { assert, is } from "@core/unknownutil";
import { alter } from "@core/errorutil";
const v: unknown = "";
alter(() => assert(v, is.Number), new TypeError("v must be number"));
// TypeError instead of AssertError