Function assertStrictEquals

  • Make an assertion that actual and expected are strictly equal, using Object.is for equality comparison. If not, then throw.

    Type Parameters

    • T

      The type of the expected value.

    Parameters

    • actual: unknown

      The actual value to compare.

    • expected: T

      The expected value to compare.

    • Optionalmsg: string

      The optional message to display if the assertion fails.

    Returns asserts actual is T

    import { assertStrictEquals } from "@std/assert";

    const a = {};
    const b = a;
    assertStrictEquals(a, b); // Doesn't throw

    const c = {};
    const d = {};
    assertStrictEquals(c, d); // Throws