Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[sort-type-union-intersection-members] Autofixed type not equivalent to original type #4581

Closed
iliubinskii opened this issue Feb 21, 2022 · 2 comments · Fixed by #4590
Closed
Labels
accepting prs Go ahead, send a pull request that resolves this issue bug Something isn't working package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin

Comments

@iliubinskii
Copy link

Repro

{
  "rules": {
    "@typescript-eslint/sort-type-union-intersection-members": "warn"
  }
}
type Expected = (new (x: string) => object) &
  ((x: number) => boolean) & {
    readonly x: number;
    readonly y: string;
  };

Expected Result

Should be fixed to:

type Expected = ((x: number) => boolean) &
  (new (x: string) => object) & {
    readonly x: number;
    readonly y: string;
  };

Actual Result

Got:

type Expected = ((x: number) => boolean) & new (x: string) => object & {
  readonly x: number;
  readonly y: string;
};

Additional Info

No

Versions

package version
@typescript-eslint/eslint-plugin 5.12.1
@typescript-eslint/parser 5.12.1
TypeScript 4.5.5
ESLint 8.9.0
node 14.18.0
@iliubinskii iliubinskii added package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin triage Waiting for maintainers to take a look labels Feb 21, 2022
@bradzacher bradzacher added accepting prs Go ahead, send a pull request that resolves this issue bug Something isn't working and removed triage Waiting for maintainers to take a look labels Feb 22, 2022
@islandryu
Copy link
Contributor

I think this issue has a bug where the parentheses are removed in constructorType, and a bug where the line breaks don't work.
I fixed the former in #4590.

@JoshuaKGoldberg
Copy link
Member

Hmm, do you have a repro case for the line breaks version?

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 25, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
accepting prs Go ahead, send a pull request that resolves this issue bug Something isn't working package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin
Projects
None yet
4 participants