> ## Documentation Index
> Fetch the complete documentation index at: https://docs.syntblaze.com/llms.txt
> Use this file to discover all available pages before exploring further.

# TypeScript Multiplication Assignment

The `*=` (multiplication assignment) operator multiplies the value of the left operand by the value of the right operand and assigns the computed product to the left operand.

```typescript theme={"dark"}
leftOperand *= rightOperand;
```

## Technical Mechanics

1. **Single Evaluation:** The reference to the left operand is evaluated exactly once. This is a critical distinction from the expanded form `leftOperand = leftOperand * rightOperand`, which evaluates the left side twice. If the left operand contains an expression with side effects (such as `arr[i++]`), the `*=` operator ensures the side effect executes only once.
2. **Mutability Requirement:** The left operand must be a valid, mutable l-value, such as a variable declared with `let` or `var`, or a writable object property. Attempting to use `*=` on a `const` declaration will result in a compiler error.
3. **Return Value:** The operation returns the newly assigned value of the left operand, allowing the assignment to be chained or embedded within larger expressions.

## TypeScript Type Constraints

TypeScript enforces strict compile-time type checking on both operands involved in the `*=` operation:

* **Permitted Types:** Both operands must resolve to type `number`, `bigint`, `any`, or an `enum` type.
* **Type Homogeneity:** You cannot mix `number` and `bigint` operands. Doing so violates both TypeScript's static type rules and JavaScript's runtime rules.
* **Assignment Compatibility:** The resulting product must be assignable back to the declared type of the left operand.

## Syntax Visualization

**Valid Operations:**

```typescript theme={"dark"}
let intVal: number = 10;
intVal *= 5; // Evaluates to 50

let bigIntVal: bigint = 10n;
bigIntVal *= 5n; // Evaluates to 50n

let anyVal: any = 10;
anyVal *= "5"; // Valid in TS due to 'any', evaluates to 50 at runtime

enum Multiplier { Base = 2 }
let enumVal: number = 10;
enumVal *= Multiplier.Base; // Evaluates to 20

// Single evaluation demonstration
let arr: number[] = [3, 4, 5];
let i: number = 0;
arr[i++] *= 2; // arr becomes [6, 4, 5], i becomes 1 (evaluated once)
```

**TypeScript Compiler Errors:**

```typescript theme={"dark"}
let num: number = 10;

// Error: The right-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type.
num *= "5"; 

// Error: Operator '*=' cannot be applied to types 'number' and 'bigint'.
num *= 5n; 

const fixedNum: number = 10;

// Error: Cannot assign to 'fixedNum' because it is a constant.
fixedNum *= 5; 
```

<div
  style={{ 
display: "flex", 
justifyContent: "space-between", 
alignItems: "center", 
maxWidth: "754px", 
padding: "1rem 0",
marginBottom: "24px"
}}
>
  <span style={{ fontWeight: "bold", fontSize: "1.25rem", color: "var(--tw-prose-headings)", fontFamily: "Inter, ui-sans-serif, system-ui, sans-serif" }}>Tired of Poor TypeScript Skills? Fix That With Deep Grasping!</span>

  <a
    href="https://syntblaze.com"
    target="_blank"
    style={{ 
  marginLeft: "24px",
  textDecoration: "none", 
  backgroundColor: "#007AFF",
  color: "#ffffff", 
  padding: "6px 16px", 
  borderRadius: "16px",
  fontSize: "0.9rem",
  fontWeight: "600",
  textAlign: "center",
  transition: "background-color 0.2s ease"
}}
  >
    Learn More
  </a>
</div>

<div style={{ display: "flex", gap: "12px", flexWrap: "wrap" }}>
  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/skill-tracking.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=b9b0305c93bb501c9e767b5c76c88835" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/skill-tracking.png" />

  <img src="https://mintcdn.com/syntblazellc/23tyuOzaWS88qFlc/images/nuggets.png?fit=max&auto=format&n=23tyuOzaWS88qFlc&q=85&s=c86c80197299762989e9b882419b2109" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/nuggets.png" />

  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/bite-sized-exercises.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=a65f9a38c37ff28ab73ed783c53c60e3" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/bite-sized-exercises.png" />
</div>

<div style={{ display: "flex", gap: "12px", flexWrap: "wrap", marginTop: "12px" }}>
  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/mastery-chain.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=748a1763454713e679260fbb95f154a2" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/mastery-chain.png" />

  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/element-previews.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=242f61448ff5dd6deaaab2dccc13b507" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/element-previews.png" />

  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/element-explanations.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=cf0fc1c31f9cd0fc26716781be05fbc9" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/element-explanations.png" />
</div>
