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.
< (less than) operator is a relational binary operator that evaluates whether its left operand is strictly lesser in value than its right operand, yielding a boolean result. TypeScript enhances this standard JavaScript operator by applying static type checking to the operands, preventing unsafe cross-type comparisons that rely on implicit type coercion.
Syntax
< operator to specific types. Both operands must be of a mutually comparable type. Valid types include number, string, bigint, Date, enum, and any.
- Numeric Evaluation: When operands are
number,bigint, or numericenumtypes, the operator performs a standard mathematical comparison. - Lexicographical Evaluation: When operands are
stringtypes, the operator compares the sequence of 16-bit unsigned integer values (UTF-16 code units) from left to right. - Date Evaluation: When both operands are
Dateinstances, TypeScript permits the comparison natively. At runtime, JavaScript implicitly calls thevalueOf()method on the objects, comparing their numeric epoch timestamps. - Any Evaluation: If one or both operands are of type
any, the compiler bypasses strict type checking, deferring to JavaScript’s runtime abstract relational comparison algorithm.
< operator on unsupported complex types like plain objects or arrays, the TypeScript compiler rejects the operation and emits error TS2365. This is a strict compiler rule designed to prevent the unpredictable type coercion inherent to the underlying JavaScript engine.
Master TypeScript with Deep Grasping Methodology!Learn More





