---
source: crates/oxc_linter/src/tester.rs
expression: bad_bitwise_operator
---
  ⚠ oxc(bad-bitwise-operator): Bad bitwise operator
   ╭─[bad_bitwise_operator.tsx:1:9]
 1 │ var a = obj & obj.a
   ·         ───────────
   ╰────
  help: Bitwise operator '&' seems unintended. Did you mean logical operator '&&'?

  ⚠ oxc(bad-bitwise-operator): Bad bitwise operator
   ╭─[bad_bitwise_operator.tsx:1:9]
 1 │ var a = options | {}
   ·         ────────────
   ╰────
  help: Bitwise operator '|' seems unintended. Did you mean logical operator '||'?

  ⚠ oxc(bad-bitwise-operator): Bad bitwise operator
   ╭─[bad_bitwise_operator.tsx:1:9]
 1 │ var a = options | !{}
   ·         ─────────────
   ╰────
  help: Bitwise operator '|' seems unintended. Did you mean logical operator '||'?

  ⚠ oxc(bad-bitwise-operator): Bad bitwise operator
   ╭─[bad_bitwise_operator.tsx:1:9]
 1 │ var a = options | typeof {}
   ·         ───────────────────
   ╰────
  help: Bitwise operator '|' seems unintended. Did you mean logical operator '||'?

  ⚠ oxc(bad-bitwise-operator): Bad bitwise operator
   ╭─[bad_bitwise_operator.tsx:1:9]
 1 │ var a = options | ''
   ·         ────────────
   ╰────
  help: Bitwise operator '|' seems unintended. Did you mean logical operator '||'?

  ⚠ oxc(bad-bitwise-operator): Bad bitwise operator
   ╭─[bad_bitwise_operator.tsx:1:9]
 1 │ var a = options | true
   ·         ──────────────
   ╰────
  help: Bitwise operator '|' seems unintended. Did you mean logical operator '||'?

  ⚠ oxc(bad-bitwise-operator): Bad bitwise operator
   ╭─[bad_bitwise_operator.tsx:1:9]
 1 │ var a = options | false
   ·         ───────────────
   ╰────
  help: Bitwise operator '|' seems unintended. Did you mean logical operator '||'?

  ⚠ oxc(bad-bitwise-operator): Bad bitwise operator
   ╭─[bad_bitwise_operator.tsx:1:9]
 1 │ var a = options | (1 + 2 + typeof {})
   ·         ─────────────────────────────
   ╰────
  help: Bitwise operator '|' seems unintended. Did you mean logical operator '||'?

  ⚠ oxc(bad-bitwise-operator): Bad bitwise operator
   ╭─[bad_bitwise_operator.tsx:1:9]
 1 │ var a = options | (1 + 2 + (3 + ''))
   ·         ────────────────────────────
   ╰────
  help: Bitwise operator '|' seems unintended. Did you mean logical operator '||'?

  ⚠ oxc(bad-bitwise-operator): Bad bitwise operator
   ╭─[bad_bitwise_operator.tsx:1:9]
 1 │ var a = options | (1 + 2 + (3 + '4'))
   ·         ─────────────────────────────
   ╰────
  help: Bitwise operator '|' seems unintended. Did you mean logical operator '||'?

  ⚠ Bad bitwise operator
   ╭─[bad_bitwise_operator.tsx:1:1]
 1 │ input |= ''
   · ───────────
   ╰────
  help: Bitwise operator '|=' seems unintended. Consider using non-compound assignment and logical operator '||' instead.

  ⚠ Bad bitwise operator
   ╭─[bad_bitwise_operator.tsx:1:1]
 1 │ input |= (1 + '')
   · ─────────────────
   ╰────
  help: Bitwise operator '|=' seems unintended. Consider using non-compound assignment and logical operator '||' instead.

  ⚠ Bad bitwise operator
   ╭─[bad_bitwise_operator.tsx:1:1]
 1 │ input |= (1 + (3 + '1'))
   · ────────────────────────
   ╰────
  help: Bitwise operator '|=' seems unintended. Consider using non-compound assignment and logical operator '||' instead.

  ⚠ Bad bitwise operator
   ╭─[bad_bitwise_operator.tsx:1:1]
 1 │ input |= !{}
   · ────────────
   ╰────
  help: Bitwise operator '|=' seems unintended. Consider using non-compound assignment and logical operator '||' instead.

  ⚠ Bad bitwise operator
   ╭─[bad_bitwise_operator.tsx:1:1]
 1 │ input |= typeof {}
   · ──────────────────
   ╰────
  help: Bitwise operator '|=' seems unintended. Consider using non-compound assignment and logical operator '||' instead.
