diff --git a/src/rules/unbound-method.ts b/src/rules/unbound-method.ts index 57065a62d..7aad84d0f 100644 --- a/src/rules/unbound-method.ts +++ b/src/rules/unbound-method.ts @@ -15,7 +15,11 @@ const isJestExpectCall = (node: TSESTree.CallExpression) => { const { matcher } = parseExpectCall(node); - return !toThrowMatchers.includes(matcher?.name ?? ''); + if (!matcher) { + return false; + } + + return !toThrowMatchers.includes(matcher.name); }; const baseRule = (() => {