-
-
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 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
let a: string | null = null;
let b: string | null = null;
a || b
ESLint Config
module.exports = {
parser: "@typescript-eslint/parser",
rules: {
"@typescript-eslint/prefer-nullish-coalescing": "error"
},
};
tsconfig
Expected Result
No internal errors
Actual Result
eslint throws when linting on the line a || b
TypeError: Cannot read properties of undefined (reading 'some')
Occurred while linting /input.tsx:4
Rule: "@typescript-eslint/prefer-nullish-coalescing"
at LogicalExpression[operator = "||"] (https://typescript-eslint.io/sandbox/index.js:140:49356)
at https://typescript-eslint.io/sandbox/index.js:105:2536
at https://typescript-eslint.io/sandbox/index.js:99:32978
at Array.forEach (<anonymous>)
at Object.emit (https://typescript-eslint.io/sandbox/index.js:99:32967)
at Sx.applySelector (https://typescript-eslint.io/sandbox/index.js:40:22861)
at Sx.applySelectors (https://typescript-eslint.io/sandbox/index.js:40:23157)
at Sx.enterNode (https://typescript-eslint.io/sandbox/index.js:40:23248)
at ex.enterNode (https://typescript-eslint.io/sandbox/index.js:34:23858)
at https://typescript-eslint.io/sandbox/index.js:105:2972 4:1 - 4:7
The error is probably thrown from
(type as ts.UnionOrIntersectionType).types.some(t => |
Additional Info
(I didn't figure out how to run the lint again with --debug
flag on the playground)
The reproduction is extracted from the Babel source: https://github.com/babel/babel/blob/main/packages/babel-helper-create-class-features-plugin/src/features.ts, first reported here.
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