-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Open
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 workingpackage: 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
class Foo {
bazz() { }
}
class Bar {
bazz = 1;
}
declare const foo: Foo;
declare const union: Foo | Bar;
// a simple case is correctly reported, both as member expression
// and as object pattern:
const bound1 = foo.bazz;
const { bazz: bound2 } = foo;
// in a union, only object pattern is reported, while member access
// isn't:
const bound3 = union.bazz;
const { bazz: bound4 } = union;ESLint Config
module.exports = {
parser: "@typescript-eslint/parser",
rules: {
"@typescript-eslint/unbound-method": "error",
},
};tsconfig
Expected Result
I expected the rule to have consistent behavior in how it reports union types with unbound methods, as I think there's no difference between using ObjectPattern or MemberExpression for creating an unbound method.
Actual Result
The rule didn't report the unbound method created from a MemberExpression of a union type.
Additional Info
No response
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 workingpackage: eslint-pluginIssues related to @typescript-eslint/eslint-pluginIssues related to @typescript-eslint/eslint-plugin
{ "compilerOptions": { "strictNullChecks": true } }