@jiminp/tooltool
    Preparing search index...

    Function assertEqualType

    • Asserts at compile time that two types are mutually assignable.

      Checks assignability in both directions, not exact type identity. Structurally compatible types can pass even if they differ in readonly or optional members. Performs no runtime validation.

      Type Parameters

      • T

        The first type to compare.

      • U

        The second type to compare.

      Parameters

      • ..._: [T] extends [U] ? [] : [never]

      Returns void

      type A = { name: string };
      type B = { name: string };
      type C = { name: string; age: number };

      assertEqualType<A, B>(); // OK: mutually assignable
      assertEqualType<A, C>(); // Error: A is not assignable to C