// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. /** * Checks if the actual type `A` is assignable to the expected type `E`, and * vice versa. * * This is often less strict than `IsExact` because the two type parameters are * allowed to have a different structure as long as they are assignable to each * other. This is often more strict than `Has` because none of the two type * parameters may be a union that contains the other, as this would fail the * check for mutual assignability. * * @example Usage * ```ts * import { assertType } from "@std/testing/types"; * import type { IsMutuallyAssignable } from "@std/testing/unstable-types"; * * // false because E is not assignable to A * assertType>(false); * // false because A is not assignable to E * assertType>(false); * // true because both types are assignable to each other * assertType>(true); * ``` */ export type IsMutuallyAssignable = [E] extends [A] ? [A] extends [E] ? true : false : false;