Skip to content

Commit e872dbd

Browse files
authored
feat(isParenthesized): support the latest typescript-eslint (#261)
1 parent 161ffe1 commit e872dbd

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

src/is-parenthesized.mjs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,16 @@ function getParentSyntaxParen(node, sourceCode) {
2222
case "NewExpression":
2323
if (parent.arguments.length === 1 && parent.arguments[0] === node) {
2424
return sourceCode.getTokenAfter(
25-
/** @type {RuleNode} */ (
26-
/** @type {unknown} */ (
27-
/** @type {TSNewExpression | TSCallExpression} */ (
28-
parent
29-
).typeParameters
30-
)
31-
) || parent.callee,
25+
// @ts-expect-error https://github.com/typescript-eslint/typescript-eslint/pull/5384
26+
parent.typeArguments ||
27+
/** @type {RuleNode} */ (
28+
/** @type {unknown} */ (
29+
/** @type {TSNewExpression | TSCallExpression} */ (
30+
parent
31+
).typeParameters
32+
)
33+
) ||
34+
parent.callee,
3235
isOpeningParenToken,
3336
)
3437
}

0 commit comments

Comments
 (0)