Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork2.8k
Closed
Description
Before You File a Bug Report Please Confirm You Have Done The Following...
- I have tried restarting my IDE and the issue persists.
- I have updated to the latest version of the packages.
- I havesearched for related issues and found none that matched my issue.
- I haveread the FAQ and my problem is not listed.
Playground Link
Repro Code
// Warns about invalid operandsletfnNumber=(a:number,b:string)=>a+b;// Doesn't warnletfnBigint=(a:bigint,b:string)=>a+b;
ESLint Config
{"rules":{"@typescript-eslint/restrict-plus-operands":["error",{"allowNumberAndString":false}]}}
tsconfig
{"compilerOptions": {"strictNullChecks":true }}
Expected Result
I expected that the 4th line should report the error "Operands of '+' operations must be a number or string, allowing a string + any of:any
,boolean
,null
,RegExp
,undefined
. Gotbigint
+string
."
The docs forallowNumberAndString
specifically mention supportingbigint
:
Whether to allow bigint/number typed values and string typed values to be added together.
Actual Result
There was no error on the 4th line.
Additional Info
Inrestrict-plus-operands.ts
, line221
should compareotherType
tots.TypeFlags.NumberLike | ts.TypeFlags.BigIntLike
instead of justts.TypeFlags.NumberLike
.