Skip to content

Lint warning "ts(80008)" ignoring numeric separators #46195

Description

Bug Report

The linter that looks for large (>2^53) literals is not taking the numeric separators into account, resulting in it firing for very large numbers that are still in range (because of the added characters in the literal as a string).

e.g. For 18! (factorial) which is <2^53 (https://www.wolframalpha.com/input/?i=2%5E53-1+%3E+18%21).

🔎 Search Terms

ts80008, numeric separator, numeric literals

🕗 Version & Regression Information

Started in 3.7.5.

  • This is the behavior in every version I tried, and I reviewed the FAQ for entries about Type System Behavior

⏯ Playground Link

Playground link with relevant code

💻 Code

const OK_FACT_18 = 6402373705728000;
const FLAGGED_FACT_18 = 6_402_373_705_728_000;

console.log(OK_FACT_18 === FLAGGED_FACT_18); // true

🙁 Actual behavior

Lint flagged the literal 6_402_373_705_728_000 with ts(80008).

🙂 Expected behavior

It shouldn't be flagged.

Activity

  1. MingweiSamuel commented on Oct 4, 2021

    @MingweiSamuel

    Relevant code is here: https://github.com/microsoft/TypeScript/pull/33300/files#diff-d9ab6589e714c71e657f601cf30ff51dfc607fc98419bf72e04f6b0fa92cc4b8R33703 (linking to PR since file is too long for regular view)

    When there are underscores in the literal then +getTextOfNode(node) results in NaN, which causes the warning to be triggered in the next conditional.

  2. locked as resolved and limited conversation to collaborators on Oct 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptEffort: ModerateRequires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual".Help WantedYou can do this

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions