Skip to content
masterclass Buddy

Vitest · Matcher

toBeTypeOf

toBeTypeOf checks whether a value has a specified JavaScript type. Use it with expect(value) when a test needs a runtime type assertion.

Last updated

Syntax

expect(value).toBeTypeOf(type)

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

Subscribe
  • expect
  • toBe
  • toEqual
  • Matchers
  • Expect API Reference

Source: Using Matchers | Guide | Vitest. Checked 2026-11-03.