• Make an assertion that actual is not null or undefined. If not then throw.

    Type Parameters

    • T

    Parameters

    • actual: T
    • Optional msg: string

    Returns asserts actual is NonNullable<T>

    Since

    24.7.0

    Example

    import { assertExists } from "assert";

    assertExists("something"); // Doesn't throw
    assertExists(undefined); // Throws