> ## 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 Less Than Or Equal To

The `<=` (less than or equal to) operator is a binary relational operator that evaluates to the boolean `true` if the left operand's value is mathematically, lexicographically, or chronologically less than or identical to the right operand's value, and `false` otherwise.

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

## TypeScript Type Constraints

TypeScript applies strict static type checking to the `<=` operator to prevent the unpredictable implicit type coercion inherent in standard JavaScript's Abstract Relational Comparison.

1. **Permitted Types:** The operands must resolve to type `number`, `bigint`, `string`, `Date`, an `enum` type, or `any`.
2. **Type Homogeneity:** TypeScript generally requires both operands to be of the same type. Exceptions include comparisons between `number` and `bigint`, and comparisons involving numeric `enum` types and `number`.
3. **Compile-Time Errors:** Attempting to apply the operator to unsupported types (such as `boolean`, uncast objects, or arrays) or mixing incompatible types results in a `TS2365` compiler error.

```typescript theme={"dark"}
enum Size { Small, Medium, Large }

// Valid comparisons
const numCheck: boolean = 5 <= 10;             // true
const strCheck: boolean = "apple" <= "banana"; // true
const bigIntCheck: boolean = 50n <= 50;        // true (mixed number/bigint is valid)
const enumCheck: boolean = Size.Small <= Size.Large; // true
const dateCheck: boolean = new Date("2023-01-01") <= new Date("2024-01-01"); // true

// Invalid comparisons (Compile-time errors)
const err1 = 5 <= "5";       // TS2365: Operator '<=' cannot be applied to types 'number' and 'string'.
const err2 = {} <= {};       // TS2365: Operator '<=' cannot be applied to types '{}' and '{}'.
const err3 = false <= true;  // TS2365: Operator '<=' cannot be applied to types 'boolean' and 'boolean'.
```

## Evaluation Mechanics

When the TypeScript code is compiled and executed, the operator follows specific evaluation algorithms based on the resolved primitive types:

* **Numeric Evaluation (`number`, `bigint`, numeric `enum`):** Evaluates mathematical magnitude. For `number` types, it adheres to IEEE 754 floating-point comparison rules. If either operand evaluates to `NaN` (Not-a-Number), the operator strictly returns `false`.
* **String Evaluation (`string`, string `enum`):** Performs a lexicographical comparison. It compares the strings character by character from left to right, evaluating the 16-bit UTF-16 code unit values of each character.
* **Date Evaluation (`Date`):** Evaluates chronological order. The JavaScript runtime implicitly invokes the `valueOf()` method on the `Date` objects, converting them to their primitive numeric timestamp values (milliseconds since the Unix Epoch) before performing a numeric comparison.
* **Bypassed Typing (`any`):** If TypeScript's static typing is bypassed (e.g., using `any` or `@ts-ignore`), the runtime engine falls back to JavaScript's Abstract Relational Comparison algorithm. This forces implicit type coercion, invoking `[Symbol.toPrimitive]`, `valueOf()`, or `toString()` on objects to resolve them to primitives before executing either a numeric or string comparison.

```typescript theme={"dark"}
// Enum evaluation mechanics
enum Status { Pending = 1, Active = 2 }
Status.Pending <= 2; // true (enum and number mix is valid)

// String evaluation mechanics (UTF-16 code units)
"Z" <= "a"; // true (Code unit 90 <= 97)

// NaN evaluation mechanics
NaN <= 5;   // false
NaN <= NaN; // false

// Date evaluation mechanics
new Date("2024-01-01") <= new Date("2024-01-01"); // true (compares numeric timestamps)

// Bypassed typing mechanics (Abstract Relational Comparison)
const left: any = [2];
const right: any = "3";
left <= right; // true (Array coerces to "2", then string "2" <= "3")
```

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