-
Notifications
You must be signed in to change notification settings - Fork 0
guards.Function.not
github-actions[bot] edited this page Jun 8, 2026
·
2 revisions
@zenstone/ts-utils / guards / not
not(
guard): (val) =>boolean
Defined in: src/guards/index.ts:516
守卫取反(NOT)
返回运行时取反函数。由于 TS 类型系统不支持否定类型,
返回值为 (val: unknown) => boolean,不作为类型守卫使用。
要取反的守卫函数
取反后的判断函数
(val) => boolean
const isNotNull = not(isNull);
if (isNotNull(value)) {
// 运行时正确,但不会收窄类型
}