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 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
type Broken<T> =
| (T extends number ? 'hi' : 'there')
| string;
ESLint Config
module.exports = {
parser: "@typescript-eslint/parser",
rules: {
"@typescript-eslint/<rule-name>": ["error", ...<options>],
},
};
tsconfig
Expected Result
When using "fix", I expect it to keep the same semantics of the code. This might include keeping the ()
around the T extends
clause.
Also I expect the "fix" to be stable, so that it no longer reports an error.
Actual Result
It fixes to this, which changes the meaning of the code:
type Broken<T> =
string | T extends number ? 'hi' : 'there';
Also, it still complains about the order. If you fix again it changes to
type Broken<T> =
T | string extends number ? 'hi' : 'there';
Additional Info
I don't know/care what order it sorts to, as long as it doesn't break my code! 🙂
{ "compilerOptions": {} }