[restrict-plus-operands] Valid number and bigint intersections aren't supported in the restrict-plus-operands
rule
#4798
Labels
accepting prs
Go ahead, send a pull request that resolves this issue
bug
Something isn't working
package: eslint-plugin
Issues related to @typescript-eslint/eslint-plugin
Related PR: #4795 (review)
Repro
Playground link: https://typescript-eslint.io/play/#ts=4.6.2&sourceType=module&code=MYewdgzgLgBAhjAvDA5NATgSzAcxfCGDbHGAMhgG8YAzEEALlQCM518BfAKFElmaQwALACYCMMAFcAtswCm6clVr0mKVuxgcA3D3DQYwQaLDjmmHNlgVqdRizaddeyCAA2cgHRuQOABQIANSoxLgoAJQuEO5ePv4CwaLhurzRHt6+fkaJImDJXEA&rules=N4IgAgLgngDgpgZwMYCcCWMIFpEBs0B2EA9CohOktjLgK4JYD28KAhgQCYIgBcIcKFIxQgAvkA&tsConfig=N4XyA
Expected Result
No linting error on lines 6 and 7, as the rule
restrict-plus-operands
doesn't error when there is a valid string intersection but errors with valid number and bigint intersections.Actual Result
Error on line 6:
Operands of '+' operation must either be both strings or both numbers.ESLint(@typescript-eslint/restrict-plus-operands)
Error on line 7:
Operands of '+' operation must be both bigints.ESLint(@typescript-eslint/restrict-plus-operands)
Additional Info
Real-world use case: vuejs/eslint-plugin-vue#1839 (comment)
Versions
@typescript-eslint/eslint-plugin
5.18.0
@typescript-eslint/parser
5.18.0
TypeScript
4.6.2
ESLint
8.7.0
node
The text was updated successfully, but these errors were encountered: