Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[restrict-plus-operands] rule doesn't support bigint #309

Closed
novemberborn opened this Issue Feb 22, 2019 · 2 comments

Comments

Projects
None yet
3 participants
@novemberborn
Copy link

commented Feb 22, 2019

Repro

{
  "plugins": ["@typescript-eslint"],
  "rules": {
    "@typescript-eslint/restrict-plus-operands": "error"
  }
}
1n + 1n

Expected Result

No errors.

Actual Result

The operands are not numbers, but they're bigints which are still addable without type conversion.

Additional Info

Versions

package version
@typescript-eslint/eslint-plugin 1.4.0
@typescript-eslint/parser 1.4.0
TypeScript 3.2.1
ESLint X.Y.Z
node X.Y.Z
npm X.Y.Z

@armano2 armano2 added bug and removed triage labels Feb 22, 2019

@bradzacher bradzacher changed the title [restrict-plus-operands] no bigint support [restrict-plus-operands] rule doesn't support bigint Feb 23, 2019

@webschik

This comment has been minimized.

Copy link
Contributor

commented Feb 23, 2019

Hi!

I've created a PR with the fix #310.

@novemberborn

This comment has been minimized.

Copy link
Author

commented Feb 25, 2019

This fixes 1n + 2n but not BigInt(1) + 2n or const foo = 1n; foo + 2n.

"bigint" should be mentioned in the error messages. (Yes I can PR that one. Not sure about the type checking for the other use cases.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.