Skip to content

guards.Function.isPresent

github-actions[bot] edited this page Jun 8, 2026 · 2 revisions

@zenstone/ts-utils / guards / isPresent

Function: isPresent()

isPresent<T>(val): val is T

Defined in: src/guards/index.ts:328

检查值是否不为 null 且不为 undefined

Type Parameters

T

T

Parameters

val

T | null | undefined

任意值

Returns

val is T

Example

if (isPresent(value)) {
  console.log(value);
}

Clone this wiki locally