---
url: /docs/guide/usage/linter/rules/vitest/prefer-strict-boolean-matchers.md
---

### What it does

This rule warns when `toBeTruthy()` or `toBeFalsy()` is used with `expect` or `expectTypeOf`.
With `--fix-suggestions`, it will be replaced with `toBe(true)` or `toBe(false)`.

### Why is this bad?

Truthy/falsy matchers coerce values to boolean and can hide type mistakes.
Strict boolean assertions make intent explicit and avoid accidental coercion.
The replacement is a suggestion because it changes which values pass the assertion.

### Examples

Examples of **incorrect** code for this rule:

```javascript
expect(foo).toBeTruthy();
expectTypeOf(foo).toBeTruthy();
expect(foo).toBeFalsy();
expectTypeOf(foo).toBeFalsy();
```

Examples of **correct** code for this rule:

```javascript
expect(foo).toBe(true);
expectTypeOf(foo).toBe(true);
expect(foo).toBe(false);
expectTypeOf(foo).toBe(false);
```

## How to use

## Version

This rule was added in v1.57.0.

## References
