Type Alias Assert<T, Expected>

Assert<T, Expected>: never

Asserts at compile time that the provided type argument's type resolves to the expected boolean literal type.

Type Parameters

  • T extends boolean

    The type to assert is the expected boolean literal type.

  • Expected extends T

    The expected boolean literal type.

import { Assert, Has } from "@std/testing/types";

const result = 1 as string | number | null;

type doTest = Assert<Has<typeof result, number>, true>;