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.
> (greater than) operator is a relational binary operator that evaluates whether its left operand is strictly greater than its right operand, returning a boolean value (true or false).
> operator applies strict compile-time type checking to restrict the unpredictable implicit type coercion (Abstract Relational Comparison) that occurs in standard JavaScript.
Type Compatibility Rules
TypeScript requires operands to be of compatible, comparable types. The compiler permits the> operator for the following types:
- Numeric Types (
number,bigint): Evaluates the algebraic magnitude. TypeScript explicitly allows cross-type relational comparisons betweennumberandbigint. Comparisons involvingNaNalways evaluate tofalse. - String Types (
string): Evaluates lexicographically based on the sequence of 16-bit unsigned integer values (UTF-16 code units). - Enums (Numeric and String): Numeric enums are compared by their underlying numeric values. String enums are assignable to the
stringtype and are compared lexicographically. - Date Objects (
Date): Evaluates based on their underlying numeric time value (milliseconds since the epoch) via the internalvalueOf()method.
Compiler Errors
If you attempt to use the> operator on incompatible types, TypeScript will throw a compile-time error (TS2365). While number and bigint can be mixed, TypeScript intentionally blocks all other cross-type comparisons (e.g., number > string). It also strictly blocks comparisons between booleans, arrays, and complex objects (excluding Date), unless explicitly bypassed using the any type.
Bypassing Type Checks
If operands are typed asany, TypeScript defers to the JavaScript runtime behavior. The JavaScript engine will attempt to coerce the operands into primitives (preferring numbers) using the internal ToPrimitive and ToNumeric abstract operations before performing the comparison.
Master TypeScript with Deep Grasping Methodology!Learn More





