-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Closed as duplicate of#11491
Labels
bugSomething isn't workingSomething isn't workingduplicateThis issue or pull request already existsThis issue or pull request already existspackage: eslint-pluginIssues related to @typescript-eslint/eslint-pluginIssues related to @typescript-eslint/eslint-plugin
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 have searched for related issues and found none that matched my issue.
- I have read the FAQ and my problem is not listed.
Playground Link
Repro Code
const x = 1.5
const y = ~~x
console.log({x, y}) // prints { x: 1.5, y: 1 }
ESLint Config
module.exports = {
parser: "@typescript-eslint/parser",
rules: {
"@typescript-eslint/no-unnecessary-type-conversion": "error"
}
};
tsconfig
Expected Result
There should be no lint error.
Actual Result
Rule complains about usage of double tilde operator.
Additional Info
The no-unecessary-type-conversion rule should not be applied when using a a tilde operator twice even if the operand type is already a number.
A double tilde operator will not perform just a type conversion, but will also floor decimal numbers.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingduplicateThis issue or pull request already existsThis issue or pull request already existspackage: eslint-pluginIssues related to @typescript-eslint/eslint-pluginIssues related to @typescript-eslint/eslint-plugin