# no-loss-of-precision

Rule `typescript/no-loss-of-precision`. Disallow literal numbers that lose precision

- Source: typescript
- Technologies: TypeScript
- Kind: correctness
- Needs type information: no
- Autofix: no
- Deprecated: yes
- Reach: 2.2M weekly downloads of presets that enable it
- Trend: +6.6% last quarter
- Rank: #1498 by reach, #1480 by growth

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `@typescript-eslint/no-loss-of-precision` | no | no | package `@typescript-eslint/eslint-plugin` | [docs](https://typescript-eslint.io/rules/no-loss-of-precision) |
| Biome | `correctness/noPrecisionLoss` | yes | no | group correctness, since 1.0.0 | [docs](https://biomejs.dev/linter/rules/no-precision-loss/) |

## Code examples

### Incorrect: the rule reports this

```js
const x = 9007199254740993
```

```js
const x = 5.123000000000000000000000000001
```

```js
const x = 0x20000000000001
```

### Correct: the rule accepts this

```js
const x = 12345
const x = 123.456
const x = 123e34
const x = 12300000000000000000000000
const x = 0x1FFFFFFFFFFFFF
const x = 9007199254740991
const x = 9007_1992547409_91
```

Examples from the Biome documentation.

## Enable it

### ESLint: `eslint.config.js`

```js
import tseslint from "typescript-eslint";

export default [
  {
    plugins: { "@typescript-eslint": tseslint.plugin },
    rules: {
      "@typescript-eslint/no-loss-of-precision": "error",
    },
  },
];
```

### Biome: `biome.json`

```json
{
  "linter": {
    "rules": {
      "correctness": {
        "noPrecisionLoss": "error"
      }
    }
  }
}
```

## Presets that enable it

| Preset | Linter | Package | Rules | Weekly downloads | Trend |
| --- | --- | --- | --- | --- | --- |
| [Airbnb TypeScript](https://lintradar.dev/presets/airbnb-typescript.md) | ESLint | `eslint-config-airbnb-typescript` | 19 | 1.8M | +1.2% |
| [neostandard](https://lintradar.dev/presets/neostandard.md) | ESLint | `neostandard` | 95 | 317.6K | +50.2% |
| [Alloy](https://lintradar.dev/presets/alloy.md) | ESLint | `eslint-config-alloy` | 166 | 31.4K | +32.4% |

## Related rules

- [eslint/no-loss-of-precision](https://lintradar.dev/rules/eslint/no-loss-of-precision.md): Disallow literal numbers that lose precision
- [vue/no-loss-of-precision](https://lintradar.dev/rules/vue/no-loss-of-precision.md): Disallow literal numbers that lose precision in `<template>`
- [unicorn/no-loss-of-precision](https://lintradar.dev/rules/unicorn/no-loss-of-precision.md): Disallow numeric literals that lose precision when represented as IEEE 754 binary64 values.
- [typescript/explicit-member-accessibility](https://lintradar.dev/rules/typescript/explicit-member-accessibility.md): Require explicit accessibility modifiers on class properties and methods
- [typescript/no-unsafe-type-assertion](https://lintradar.dev/rules/typescript/no-unsafe-type-assertion.md): Disallow type assertions that narrow a type
- [typescript/parameter-properties](https://lintradar.dev/rules/typescript/parameter-properties.md): Require or disallow parameter properties in class constructors

---

Web page: https://lintradar.dev/rules/typescript/no-loss-of-precision. Data from npm and the linters' documentation, collected Dec 4, 2026. Site guide for agents: https://lintradar.dev/llms.txt
