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.
number type in TypeScript is a primitive data type that represents both integer and floating-point values. Inheriting JavaScript’s numeric implementation, TypeScript evaluates all number values as IEEE 754 double-precision 64-bit floating-point formats. There is no distinct type for integers (e.g., int or float) within the standard number type.
Literal Representations
TypeScript supports strict typing for base numeral systems and scientific notation using specific literal formats:Numeric Separators
To improve the readability of large numeric literals, TypeScript supports the ECMAScript numeric separator feature. Underscores (_) can be used to visually group digits, but they must be placed strictly between two digits. They cannot appear at the beginning or end of a literal, adjacent to a decimal point, adjacent to a base prefix, or consecutively. These separators are stripped out during compilation and do not affect the underlying value.
Special Numeric Values
Thenumber type encompasses several special global properties that result from specific mathematical operations or represent boundary limits:
Precision and Bounds
Becausenumber relies on a 64-bit floating-point format, it can only safely represent integers between -(2^53 - 1) and 2^53 - 1.
bigint primitive, which is not strictly compatible with number without explicit coercion.
Primitive vs. Wrapper Object
TypeScript distinguishes between the lowercasenumber primitive and the uppercase Number global wrapper object. Type annotations should always use the lowercase number to avoid assigning an object reference where a primitive value is expected.
Master TypeScript with Deep Grasping Methodology!Learn More





