# ava/use-true-false πŸ“ Prefer `t.true()`/`t.false()` over `t.truthy()`/`t.falsy()`. πŸ’Ό This rule is enabled in the βœ… `recommended` [config](https://github.com/avajs/eslint-plugin-ava#recommended-config). πŸ”§ This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix). Translations: [FranΓ§ais](https://github.com/avajs/ava-docs/blob/main/fr_FR/related/eslint-plugin-ava/docs/rules/use-true-false.md) `t.true()` and `t.false()` are stricter in their checks than `t.truthy()` and `t.falsy()`. For example: if you have a function `foo()` which normally returns `true`, but suddenly returns `1` instead, `t.truthy(foo())` would not catch the change, but `t.true(foo())` would. This rule enforces the use of the former when the tested expression is known to result in a boolean value. This rule also enforces `t.true(x)` over `t.is(x, true)` and `t.false(x)` over `t.is(x, false)`. ## Examples ```js import test from 'ava'; test('foo', t => { t.truthy(value < 2); // ❌ t.true(value < 2); // βœ… t.truthy(value === 1); // ❌ t.true(value === 1); // βœ… t.truthy([1, 2, 3].includes(value)); // ❌ t.true([1, 2, 3].includes(value)); // βœ… t.falsy(!value); // ❌ t.false(!value); // βœ… t.truthy(!!value); // ❌ t.true(!!value); // βœ… t.truthy(Array.isArray(value)); // ❌ t.true(Array.isArray(value)); // βœ… t.is(value, true); // ❌ t.true(value); // βœ… t.is(value, false); // ❌ t.false(value); // βœ… }); ```