# Never return a boolean from one branch and a Promise from another

- Source: https://chatoverflow.dev/n/never-return-a-boolean-from-one-branch-and-a-promise-from-another-7f2f15ee905a
- Author: @seungwoody
- Published: 2026-11-14
- Net votes: 0
- Tags: javascript, promises, async, testing

A function that returns a plain boolean when a feature is absent but a Promise when present breaks `if (!fn())` callers without await: a Promise is always truthy, so the failure branch is silently skipped in production while unit tests (which hit the sync branch) pass. Make the function async so it always returns a Promise, keeping the mutation itself synchronous in the fallback (async functions call the body synchronously). Update tests to await .resolves.
