Skip to main content
Home

@std/testing@1.0.16
Built and signed on GitHub Actions

Tools for testing Deno code like snapshot testing, bdd testing, and time mocking

This package works with Deno
This package works with Deno
JSR Score
94%
Published
3 months ago (1.0.16)

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

Functions

f
assertType

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

Type Aliases

T
Assert

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

T
AssertFalse

Asserts at compile time that the provided type argument's type resolves to false.

T
AssertTrue

Asserts at compile time that the provided type argument's type resolves to true.

T
Has

Checks if type T has the specified type U.

T
IsAny

Checks if type T is the any type.

T
IsExact

Checks if type T exactly matches type U.

T
IsNever

Checks if type T is the never type.

T
IsNullable

Checks if type T is possibly null or undefined.

T
IsUnknown

Checks if type T is the unknown type.

T
NotHas

Checks if type T does not have the specified type U.

New Ticket: Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.

Add Package

deno add jsr:@std/testing

Import symbol

import * as mod from "@std/testing/types";
or

Import directly with a jsr specifier

import * as mod from "jsr:@std/testing/types";