Docs (4.0.0)
class Assertion method

toBeTypeOf

Asserts that the value is of given type.

toBeTypeOf(typeStr: string): void

Example

// this succeeds:
expect("foo").toBeTypeOf("string");
expect(123).toBeTypeOf("number");
expect(null).toBeTypeOf("object");

// this fails:
expect(undefined).toBeTypeOf("object");

Related