🤖 Pick PR #59285 (Fix captured shorthand properties i...) into release-5.5 (#59288)

Co-authored-by: Jake Bailey <5341706+jakebailey@users.noreply.github.com>
This commit is contained in:
TypeScript Bot
2024-07-17 03:21:43 +09:00
committed by GitHub
co-authored by Jake Bailey
parent d5434c85f7
commit 6c7df1f324
20 changed files with 157 additions and 30 deletions
+1 -1
View File
@@ -49223,7 +49223,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
const nodeLinks = getNodeLinks(node);
nodeLinks.calculatedFlags |= NodeCheckFlags.ConstructorReference | NodeCheckFlags.CapturedBlockScopedBinding | NodeCheckFlags.BlockScopedBindingInLoop;
if (isIdentifier(node) && isExpressionNode(node) && !(isPropertyAccessExpression(node.parent) && node.parent.name === node)) {
const s = getSymbolAtLocation(node, /*ignoreErrors*/ true);
const s = getResolvedSymbol(node);
if (s && s !== unknownSymbol) {
checkIdentifierCalculateNodeCheckFlags(node, s);
}
+1 -1
View File
@@ -3492,7 +3492,7 @@ export function isInExpressionContext(node: Node): boolean {
case SyntaxKind.ExpressionWithTypeArguments:
return (parent as ExpressionWithTypeArguments).expression === node && !isPartOfTypeNode(parent);
case SyntaxKind.ShorthandPropertyAssignment:
return (parent as ShorthandPropertyAssignment).objectAssignmentInitializer === node;
return ((parent as ShorthandPropertyAssignment).objectAssignmentInitializer ?? (parent as ShorthandPropertyAssignment).name) === node;
case SyntaxKind.SatisfiesExpression:
return node === (parent as SatisfiesExpression).expression;
default: