@ende/testing/types

ende add jsr:@ende/testing

Version 2026.10.15 on JSR.

Testing utilities for types.

import { assertType, IsExact, IsNullable } from "@ende/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

Exports

  • AnyBrand — The utility type to represent any type.
  • AnyToBrand — The utility type to convert any to AnyBrand.
  • Assert — Asserts at compile time that the provided type argument's type resolves to the expected boolean literal type.
  • AssertFalse — Asserts at compile time that the provided type argument's type resolves to false.
  • AssertTrue — Asserts at compile time that the provided type argument's type resolves to true.
  • assertType — Asserts at compile time that the provided type argument's type resolves to the expected boolean literal type.
  • DeepPrepareIsExact
  • DeepPrepareIsExactProp
  • FlatType — The utility type to flatten record types.
  • Has — Checks if type `T` has the specified type `U`.
  • IsAny — Checks if type `T` is the `any` type.
  • IsExact — Checks if type `T` exactly matches type `U`.
  • IsNever — Checks if type `T` is the `never` type.
  • IsNullable — Checks if type `T` is possibly null or undefined.
  • IsUnknown — Checks if type `T` is the `unknown` type.
  • Matches — The internal utility type to match the given types.
  • NotHas — Checks if type `T` does not have the specified type `U`.
  • ParametersAndReturnTypeMatches — The internal utility type to match the given types as return types.
  • TupleMatches — The internal utility type to match the given types as tuples.