Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

std/testing/types.ts>Assert

Deno standard library
Go to Latest
The Standard Library has been moved to JSR. See the blog post for details.
type alias Assert
import { type Assert } from "https://deno.land/std@0.204.0/testing/types.ts";

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

Examples

Example 1

import { Assert, Has } from "https://deno.land/std@0.204.0/testing/types.ts";

const result = 1 as string | number | null;

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

Type Parameters

T extends true | false
Expected extends T
definition: never