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.
/= (division assignment) operator divides the value of the left operand by the value of the right operand and assigns the resulting quotient to the left operand.
x = x / y, the /= operator evaluates the left operand x exactly once. This distinction is critical when the left operand is a property access expression with side effects (e.g., getObj().prop /= 2 invokes getObj() only once, whereas getObj().prop = getObj().prop / 2 invokes it twice).
Type Constraints
In TypeScript, the compiler enforces strict type rules for the/= operator:
- Operand Types: Both operands must resolve to type
number,bigint, a numericenum, orany. - Type Homogeneity: You cannot mix
bigintwithnumberorenumtypes. However,numberand numericenumtypes are interoperable and can be freely mixed in the same operation. - Mutability: The left operand must be a mutable reference (e.g., a variable declared with
let,var, or a writable object property).
Syntax Visualization
Standard Number and Enum Division:Runtime Evaluation Rules
While TypeScript handles compile-time type checking, the runtime execution follows standard IEEE 754 rules inherited from JavaScript:- Division by Zero (
number): If the right operand is0, the operation evaluates toInfinity,-Infinity, orNaN(if the left operand is also0), and assigns this value to the left operand. - Division by Zero (
bigint): If the right operand is0n, the operation throws a runtimeRangeError: Division by zero.
Master TypeScript with Deep Grasping Methodology!Learn More





