toBeTypeOf

Bun

Symbol

MatchersBuiltin.toBeTypeOf

toBeTypeOf(type: 'string' | 'number' | 'bigint' | 'boolean' | 'symbol' | 'undefined' | 'object' | 'function'): void

Asserts that a value matches a specific type.

expect(1).toBeTypeOf("number");
expect("hello").toBeTypeOf("string");
expect([]).not.toBeTypeOf("boolean");