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 66501d6 commit 1f54e1d
Show file tree
Hide file tree
Showing 2 changed files with 13 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,15 @@ type T =
},
],
},
{
code: `type Expected = (new (x: number) => boolean) ${operator} string;`,
output: `type Expected = string ${operator} (new (x: number) => boolean);`,
errors: [
{
messageId: 'notSortedNamed',
},
],
},
];
};

Expand Down

0 comments on commit 1f54e1d

Please sign in to comment.