Skip to content

Commit

Permalink
fix(eslint-plugin): [sort-type-union-intersection-members] Wrap the c…
Browse files Browse the repository at this point in the history
…onstructorType in parentheses
  • Loading branch information
islandryu committed Feb 24, 2022
1 parent 5b7d8df commit 3058575
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
Expand Up @@ -85,7 +85,10 @@ function getGroup(node: TSESTree.TypeNode): Group {
}

function requiresParentheses(node: TSESTree.TypeNode): boolean {
return node.type === AST_NODE_TYPES.TSFunctionType;
return (
node.type === AST_NODE_TYPES.TSFunctionType ||
node.type === AST_NODE_TYPES.TSConstructorType
);
}

export type Options = [
Expand Down
Expand Up @@ -272,6 +272,19 @@ type T =
},
],
},
{
code: `
type Expected = ((x: number) => boolean) ${operator} string;
`,
output: `
type Expected = string ${operator} ((x: number) => boolean);
`,
errors: [
{
messageId: 'notSortedNamed',
},
],
},
];
};

Expand Down

0 comments on commit 3058575

Please sign in to comment.