Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork2.8k
Closed
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 havesearched for related issues and found none that matched my issue.
- I haveread the FAQ and my problem is not listed.
Playground Link
Repro Code
typeFoo<T>=Textends{bar:string} ?string :numbertypeBar<T>=Textends(bar:string)=>void ?string :numbertypeBaz<T>=Textends(bar:string)=>void ?{x:string} :{y:string}
ESLint Config
module.exports={"rules":{"@typescript-eslint/space-infix-ops":"error"}}
tsconfig
{"compilerOptions": {"strictNullChecks":true }}
Expected Result
there should not be errors reported
Actual Result
Operator ':' must be spaced. 1:30 - 1:31
Operator ':' must be spaced. 3:29 - 3:30
Additional Info
most likely can be fixed by improving token selection of
typescript-eslint/packages/eslint-plugin/src/rules/space-infix-ops.ts
Lines 185 to 198 inf0fb2e5
functioncheckForTypeConditional(node:TSESTree.TSConditionalType):void{ | |
constextendsTypeNode=sourceCode.getTokenByRangeStart( | |
node.extendsType.range[0], | |
)!; | |
consttrueTypeNode=sourceCode.getTokenByRangeStart( | |
node.trueType.range[0], | |
)!; | |
constfalseTypeNode=sourceCode.getTokenByRangeStart( | |
node.falseType.range[0], | |
); | |
checkAndReportAssignmentSpace(node,extendsTypeNode,trueTypeNode); | |
checkAndReportAssignmentSpace(node,trueTypeNode,falseTypeNode); | |
} |
Versions
package | version |
---|---|
@typescript-eslint/eslint-plugin | 5.27.0 |
@typescript-eslint/parser | 5.27.0 |
TypeScript | 4.7.2 |
ESLint | 8.15.0 |
node | web |