I use some bitwise operators in my JS (especially left and right shift, such as bytes[i + 1] << 8). However, TypeScript generates warnings and I see the value in avoiding this to minimize the risk of serious typos.
Furthermore, regardless of linting errors, bitwise operators are unsafe on numbers over 2^32
What is a type-safe alternative to bitwise operators such as <<
, >>
, &
, and |
?