TypeScript Types

bigint — arbitrary-precision integer type

The bigint primitive represents integer values without the ordinary Number safe-integer limit. The n suffix denotes a bigint literal; the compiler does not convert a number into a bigint implicitly. Mixing number and bigint in arithmetic is rejected and is not supported at runtime. BigInt literals require an ES2020-or-newer target; the actual runtime must support BigInt. Example output: "9007199254740995". 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: bigint;

Working Example

Example Snippettypescript
const total: bigint = 9007199254740993n;console.log((total + 2n).toString());
TypeScript Reference