TheDocumentation Index
Fetch the complete documentation index at: https://docs.syntblaze.com/llms.txt
Use this file to discover all available pages before exploring further.
>>= (sign-propagating right shift assignment) operator evaluates the binary representation of its left operand, shifts it to the right by the number of bits specified by the right operand, and assigns the result back to the left operand while preserving the original sign.
Syntax
number Operands
- Operand Conversion: TypeScript (following ECMAScript specifications) implicitly coerces the left operand to a 32-bit signed integer (
ToInt32) using two’s complement representation. The right operand is coerced to a 32-bit unsigned integer (ToUint32). Any fractional components are truncated before the shift occurs. - Shift Masking: The right operand is masked with
0x1F(bitwise AND with 31, i.e.,y & 0x1F). This ensures the shift amount is always strictly between 0 and 31, preventing out-of-bounds shifts. This bitwise mask is distinct from the remainder operator (%); for example, a negative shift amount like-1correctly masks to31(-1 & 0x1F), whereas-1 % 32would evaluate to-1. - Sign Propagation: As bits are shifted to the right, the vacated most significant bits (MSB) on the left are filled with a copy of the original sign bit. If the original number was positive, the new bits are
0. If the original number was negative, the new bits are1. - Bit Discard: Bits shifted past the least significant bit (LSB) on the right are permanently discarded.
bigint Operands
When both operands are of type bigint, the operator behaves differently:
- No 32-bit Truncation: Operands are not coerced to 32-bit integers. They are treated as having an infinite-length two’s complement representation.
- No Shift Masking: The right operand is not masked with
0x1F. The left operand is shifted by the exact magnitude of the right operand. - Errors: A negative right operand throws a
RangeError. Mixingnumberandbigintoperands throws aTypeError.
number):
number):
number):
bigint):
Master TypeScript with Deep Grasping Methodology!Learn More





