Skip to content

Commit add6bbc

Browse files
committed
Use BindableStaticNameExpression not BindableStaticAccessExpression
This type does allow identifiers, but those are ruled out earlier, so I added an assert for that case.
1 parent d815eff commit add6bbc

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/compiler/binder.ts

+3-5
Original file line numberDiff line numberDiff line change
@@ -2983,18 +2983,16 @@ namespace ts {
29832983
addLateBoundAssignmentDeclarationToSymbol(node, sym);
29842984
}
29852985
else {
2986-
if (!isBindableStaticAccessExpression(node.left)) {
2987-
return Debug.fail(`Invalid cast. The supplied value ${getTextOfNode(node.left)} was not a BindableStaticAccessExpression.`);
2988-
}
2989-
bindStaticPropertyAssignment(node.left as BindableStaticAccessExpression);
2986+
bindStaticPropertyAssignment(cast(node.left, isBindableStaticNameExpression));
29902987
}
29912988
}
29922989

29932990
/**
29942991
* For nodes like `x.y = z`, declare a member 'y' on 'x' if x is a function (or IIFE) or class or {}, or not declared.
29952992
* Also works for expression statements preceded by JSDoc, like / ** @type number * / x.y;
29962993
*/
2997-
function bindStaticPropertyAssignment(node: BindableStaticAccessExpression) {
2994+
function bindStaticPropertyAssignment(node: BindableStaticNameExpression) {
2995+
Debug.assert(!isIdentifier(node));
29982996
node.expression.parent = node;
29992997
bindPropertyAssignment(node.expression, node, /*isPrototypeProperty*/ false, /*containerIsClass*/ false);
30002998
}

0 commit comments

Comments
 (0)