> ## 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 Division

The `/` (division) operator is a binary arithmetic operator that calculates the quotient of its left operand (dividend) divided by its right operand (divisor). In TypeScript, the compiler strictly enforces type constraints on this operator, requiring both operands to be of compatible numeric types (`number` or `bigint`) and preventing the implicit type coercion of non-numeric types found in standard JavaScript.

## Syntax

```typescript theme={"dark"}
leftOperand / rightOperand
```

## Type Resolution and Behavior

TypeScript applies specific type-checking rules and runtime behaviors depending on the operand types:

* **`number` / `number`**: Returns a `number`. Because TypeScript uses the IEEE 754 double-precision 64-bit floating-point format, the result includes fractional components. Division by zero does not throw a runtime error; it evaluates to `Infinity`, `-Infinity`, or `NaN`.
* **`bigint` / `bigint`**: Returns a `bigint`. The result is always truncated towards zero (fractional digits are discarded). Division by zero throws a runtime `RangeError`.
* **Mixed Types (`number` / `bigint`)**: Results in a compile-time `TypeError`. TypeScript does not implicitly convert between `number` and `bigint` during arithmetic operations.
* **Non-Numeric Types**: Results in a compile-time `TypeError`. Unlike JavaScript, which attempts to coerce strings or booleans into numbers, TypeScript statically rejects these operations.

## Syntax Visualization

```typescript theme={"dark"}
// 1. Standard number division
const floatResult: number = 10 / 4;      // Evaluates to 2.5
const zeroDiv: number = 10 / 0;          // Evaluates to Infinity
const zeroDivNeg: number = -10 / 0;      // Evaluates to -Infinity
const nanResult: number = 0 / 0;         // Evaluates to NaN

// 2. BigInt division (requires 'n' suffix)
const bigIntResult: bigint = 10n / 4n;   // Evaluates to 2n (truncated towards zero)

// 3. Compile-time Type Errors
const mixedError = 10 / 2n;              // Error: Operator '/' cannot be applied to types 'number' and 'bigint'.
const stringError = "10" / 2;            // Error: The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type.
```

## Compound Assignment (`/=`)

The division operator can be combined with the assignment operator to divide a variable by a value and assign the quotient back to the variable. The strict type-checking rules of the standard division operator apply identically to the compound assignment.

```typescript theme={"dark"}
let x: number = 20;
x /= 4;  // Equivalent to: x = x / 4; Evaluates to 5

let y: bigint = 10n;
y /= 3n; // Equivalent to: y = y / 3n; Evaluates to 3n
```

<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>
