mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-19 10:41:56 -05:00
No did-you-mean-to-call error on casts (#42626)
I chose to do the ad-hoc check rather than yet another tree walk. 1. It's faster to run and easier to read. 2. This error came from looking at real code. It happened twice, so I think the best estimate for other uses that happened zero times is in fact zero. 3. I couldn't think of other places to put the cast, given the restrictions on `testedNode` just before the new code.
This commit is contained in:
committed by
GitHub
parent
e72c015bca
commit
f2bcb2101b
@@ -34546,8 +34546,11 @@ namespace ts {
|
||||
: isPropertyAccessExpression(location) ? location.name
|
||||
: isBinaryExpression(location) && isIdentifier(location.right) ? location.right
|
||||
: undefined;
|
||||
const isPropertyExpressionCast = isPropertyAccessExpression(location)
|
||||
&& isParenthesizedExpression(location.expression)
|
||||
&& isAssertionExpression(location.expression.expression);
|
||||
|
||||
if (!testedNode) {
|
||||
if (!testedNode || isPropertyExpressionCast) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user