Skip to main content

isDefined() function

This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

Checks if a variable is defined and not null. After this check, typescript sees the variable as defined.

Signature:

export declare function isDefined<T>(arg: T): arg is Exclude<T, null | undefined>

Parameters

ParameterTypeDescription
argTThe input to be verified

Returns:

arg is Exclude<T, null | undefined>

true if the input variable is defined.

This API may change without a BREAKING CHANGE notice.