-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Closed
Labels
accepting prsGo ahead, send a pull request that resolves this issueGo ahead, send a pull request that resolves this issuebugSomething isn't workingSomething isn't workinglocked due to agePlease open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing.Please open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing.package: 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
// fails
const test1: (someCondition: boolean) => void = someCondition => {
if (someCondition === true) {}
};
// should fail
const test2: <T extends boolean>(someCondition: T) => void = someCondition => {
if (someCondition === true) {}
};
ESLint Config
module.exports = {
parser: "@typescript-eslint/parser",
rules: {
"@typescript-eslint/no-unnecessary-boolean-literal-compare": "error"
},
};
tsconfig
Expected Result
I expect all use-cases to be consistent and report as errors.
Actual Result
The use-cases with a type constraint doesn't report as an error (even though it should).
Additional Info
This seems similar to #10311, and it looks like the fix should be similar.
Note that this issue is also similar to #10442, and I wasn't sure if I should create one issue for each rule or aggregate them under a single issue. I apologize if this was a bit spammy. I checked existing rules for similar problems after resolving #10311.
kirkwaiblinger
Metadata
Metadata
Assignees
Labels
accepting prsGo ahead, send a pull request that resolves this issueGo ahead, send a pull request that resolves this issuebugSomething isn't workingSomething isn't workinglocked due to agePlease open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing.Please open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing.package: eslint-pluginIssues related to @typescript-eslint/eslint-pluginIssues related to @typescript-eslint/eslint-plugin