mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Fix getEffectiveCheckNode (#60309)
This commit is contained in:
@@ -726,7 +726,6 @@ import {
|
||||
isRightSideOfQualifiedNameOrPropertyAccess,
|
||||
isRightSideOfQualifiedNameOrPropertyAccessOrJSDocMemberName,
|
||||
isSameEntityName,
|
||||
isSatisfiesExpression,
|
||||
isSetAccessor,
|
||||
isSetAccessorDeclaration,
|
||||
isShorthandAmbientModuleSymbol,
|
||||
@@ -35356,8 +35355,10 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
|
||||
}
|
||||
|
||||
function getEffectiveCheckNode(argument: Expression): Expression {
|
||||
argument = skipParentheses(argument);
|
||||
return isSatisfiesExpression(argument) ? skipParentheses(argument.expression) : argument;
|
||||
const flags = isInJSFile(argument)
|
||||
? OuterExpressionKinds.Parentheses | OuterExpressionKinds.Satisfies | OuterExpressionKinds.ExcludeJSDocTypeAssertion
|
||||
: OuterExpressionKinds.Parentheses | OuterExpressionKinds.Satisfies;
|
||||
return skipOuterExpressions(argument, flags);
|
||||
}
|
||||
|
||||
function getSignatureApplicabilityError(
|
||||
|
||||
@@ -637,8 +637,9 @@ export function isOuterExpression(node: Node, kinds: OuterExpressionKinds = Oute
|
||||
return (kinds & OuterExpressionKinds.Parentheses) !== 0;
|
||||
case SyntaxKind.TypeAssertionExpression:
|
||||
case SyntaxKind.AsExpression:
|
||||
case SyntaxKind.SatisfiesExpression:
|
||||
return (kinds & OuterExpressionKinds.TypeAssertions) !== 0;
|
||||
case SyntaxKind.SatisfiesExpression:
|
||||
return (kinds & (OuterExpressionKinds.TypeAssertions | OuterExpressionKinds.Satisfies)) !== 0;
|
||||
case SyntaxKind.ExpressionWithTypeArguments:
|
||||
return (kinds & OuterExpressionKinds.ExpressionsWithTypeArguments) !== 0;
|
||||
case SyntaxKind.NonNullExpression:
|
||||
|
||||
@@ -8557,8 +8557,9 @@ export const enum OuterExpressionKinds {
|
||||
NonNullAssertions = 1 << 2,
|
||||
PartiallyEmittedExpressions = 1 << 3,
|
||||
ExpressionsWithTypeArguments = 1 << 4,
|
||||
Satisfies = 1 << 5,
|
||||
|
||||
Assertions = TypeAssertions | NonNullAssertions,
|
||||
Assertions = TypeAssertions | NonNullAssertions | Satisfies,
|
||||
All = Parentheses | Assertions | PartiallyEmittedExpressions | ExpressionsWithTypeArguments,
|
||||
|
||||
ExcludeJSDocTypeAssertion = 1 << 31,
|
||||
|
||||
Reference in New Issue
Block a user