Testing utilities for types.
import { assertType, IsExact, IsNullable } from "@std/testing/types";const result = "some result" as string | number;// compile error if the type of `result` is not exactly `string | number`assertType<IsExact<typeof result, string | number>>(true);// causes a compile error that `true` is not assignable to `false`assertType<IsNullable<string>>(true); // error: string is not nullable Copy
import { assertType, IsExact, IsNullable } from "@std/testing/types";const result = "some result" as string | number;// compile error if the type of `result` is not exactly `string | number`assertType<IsExact<typeof result, string | number>>(true);// causes a compile error that `true` is not assignable to `false`assertType<IsNullable<string>>(true); // error: string is not nullable
Testing utilities for types.