Skip to content

Commit d4f6c8c

Browse files
committed
Merge branch 'js-ctor-props-type-annotation-as-declaration' into jsdoc-values-as-namespaces
2 parents 2f0e581 + 082802e commit d4f6c8c

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

src/compiler/binder.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2009,6 +2009,9 @@ namespace ts {
20092009
if (currentFlow && isNarrowableReference(<Expression>node)) {
20102010
node.flowNode = currentFlow;
20112011
}
2012+
if (isSpecialPropertyDeclaration(node as PropertyAccessExpression)) {
2013+
bindThisPropertyAssignment(node as PropertyAccessExpression);
2014+
}
20122015
break;
20132016
case SyntaxKind.BinaryExpression:
20142017
const specialKind = getSpecialPropertyAssignmentKind(node as BinaryExpression);
@@ -2317,7 +2320,7 @@ namespace ts {
23172320
declareSymbol(file.symbol.exports, file.symbol, node, SymbolFlags.Property | SymbolFlags.ExportValue | SymbolFlags.ValueModule, SymbolFlags.None);
23182321
}
23192322

2320-
function bindThisPropertyAssignment(node: BinaryExpression) {
2323+
function bindThisPropertyAssignment(node: BinaryExpression | PropertyAccessExpression) {
23212324
Debug.assert(isInJavaScriptFile(node));
23222325
const container = getThisContainer(node, /*includeArrowFunctions*/ false);
23232326
switch (container.kind) {

src/compiler/utilities.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1508,6 +1508,12 @@ namespace ts {
15081508
return SpecialPropertyAssignmentKind.None;
15091509
}
15101510

1511+
export function isSpecialPropertyDeclaration(expr: ts.PropertyAccessExpression): boolean {
1512+
return isInJavaScriptFile(expr) &&
1513+
expr.parent && expr.parent.kind === SyntaxKind.ExpressionStatement &&
1514+
!!getJSDocTypeTag(expr.parent);
1515+
}
1516+
15111517
export function getExternalModuleName(node: Node): Expression {
15121518
if (node.kind === SyntaxKind.ImportDeclaration) {
15131519
return (<ImportDeclaration>node).moduleSpecifier;

0 commit comments

Comments
 (0)