Skip to content
masterclass Buddy

Vitest · Function

assertType

assertType<T>(value) checks that a value has the expected TypeScript type. It only matters during Vitest type checking, not during normal runtime tests.

Last updated

Syntax

<T>(value: T): void

In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.

Subscribe
  • expectTypeOf
  • typecheck.include
  • *.test-d.ts
  • --typecheck

Source: assertType | Vitest. Checked 2026-11-03.