-
Notifications
You must be signed in to change notification settings - Fork 0
guards.Function.and
github-actions[bot] edited this page Jun 8, 2026
·
2 revisions
@zenstone/ts-utils / guards / and
and<
T>(...guards):TypeGuard<T>
Defined in: src/guards/index.ts:455
组合守卫(AND)
第一个守卫收窄类型到 T,后续守卫在 T 上做进一步筛选
T
...[(val) => val is T, ...((val: T) => boolean)[]]
第一个为类型守卫,后续为断言函数
TypeGuard<T>
组合后的守卫函数
const isStrAry = aryGuard(isStr);
const isNonEmptyStrAry = and(isStrAry, (arr) => arr.length > 0);