TypeScript Types

number — JavaScript numeric type

The number type describes ordinary JavaScript numeric values, including integers, fractions, NaN and infinities. It does not enforce a range, integrality or safe-integer precision. Validate those conditions at runtime when the application needs them. bigint is a separate primitive and is not interchangeable with number. Example output: "25". The example was designed for strict checking with an ES2022 target; type annotations do not add runtime validation.

Formal Syntax & Structure

typescript syntaxtypescript
let value: number;

Working Example

Example Snippettypescript
const price: number = 12.5;console.log(price * 2);
TypeScript Reference