@@ -376,8 +376,8 @@ namespace ts {
376
376
const moduleAugmentation = <ModuleDeclaration>moduleName.parent;
377
377
if (moduleAugmentation.symbol.valueDeclaration !== moduleAugmentation) {
378
378
// this is a combined symbol for multiple augmentations within the same file.
379
- // its symbol already has accumulated information for all declarations
380
- // so we need to add it just once - do the work only for first declaration
379
+ // its symbol already has accumulated information for all declarations
380
+ // so we need to add it just once - do the work only for first declaration
381
381
Debug.assert(moduleAugmentation.symbol.declarations.length > 1);
382
382
return;
383
383
}
@@ -386,7 +386,7 @@ namespace ts {
386
386
mergeSymbolTable(globals, moduleAugmentation.symbol.exports);
387
387
}
388
388
else {
389
- // find a module that about to be augmented
389
+ // find a module that about to be augmented
390
390
let mainModule = resolveExternalModuleNameWorker(moduleName, moduleName, Diagnostics.Invalid_module_name_in_augmentation_module_0_cannot_be_found);
391
391
if (!mainModule) {
392
392
return;
@@ -812,7 +812,7 @@ namespace ts {
812
812
}
813
813
814
814
// No static member is present.
815
- // Check if we're in an instance method and look for a relevant instance member.
815
+ // Check if we're in an instance method and look for a relevant instance member.
816
816
if (location === container && !(location.flags & NodeFlags.Static)) {
817
817
const instanceType = (<InterfaceType>getDeclaredTypeOfSymbol(classSymbol)).thisType;
818
818
if (getPropertyOfType(instanceType, name)) {
@@ -1163,7 +1163,7 @@ namespace ts {
1163
1163
return getMergedSymbol(sourceFile.symbol);
1164
1164
}
1165
1165
if (moduleNotFoundError) {
1166
- // report errors only if it was requested
1166
+ // report errors only if it was requested
1167
1167
error(moduleReferenceLiteral, Diagnostics.File_0_is_not_a_module, sourceFile.fileName);
1168
1168
}
1169
1169
return undefined;
@@ -2618,7 +2618,7 @@ namespace ts {
2618
2618
}
2619
2619
}
2620
2620
else if (declaration.kind === SyntaxKind.Parameter) {
2621
- // If it's a parameter, see if the parent has a jsdoc comment with an @param
2621
+ // If it's a parameter, see if the parent has a jsdoc comment with an @param
2622
2622
// annotation.
2623
2623
const paramTag = getCorrespondingJSDocParameterTag(<ParameterDeclaration>declaration);
2624
2624
if (paramTag && paramTag.typeExpression) {
@@ -2633,7 +2633,7 @@ namespace ts {
2633
2633
function getTypeForVariableLikeDeclaration(declaration: VariableLikeDeclaration): Type {
2634
2634
if (declaration.parserContextFlags & ParserContextFlags.JavaScriptFile) {
2635
2635
// If this is a variable in a JavaScript file, then use the JSDoc type (if it has
2636
- // one as its type), otherwise fallback to the below standard TS codepaths to
2636
+ // one as its type), otherwise fallback to the below standard TS codepaths to
2637
2637
// try to figure it out.
2638
2638
const type = getTypeForVariableLikeDeclarationFromJSDocComment(declaration);
2639
2639
if (type && type !== unknownType) {
@@ -4058,7 +4058,7 @@ namespace ts {
4058
4058
const isJSConstructSignature = isJSDocConstructSignature(declaration);
4059
4059
let returnType: Type = undefined;
4060
4060
4061
- // If this is a JSDoc construct signature, then skip the first parameter in the
4061
+ // If this is a JSDoc construct signature, then skip the first parameter in the
4062
4062
// parameter list. The first parameter represents the return type of the construct
4063
4063
// signature.
4064
4064
for (let i = isJSConstructSignature ? 1 : 0, n = declaration.parameters.length; i < n; i++) {
@@ -4461,7 +4461,7 @@ namespace ts {
4461
4461
}
4462
4462
4463
4463
if (symbol.flags & SymbolFlags.Value && node.kind === SyntaxKind.JSDocTypeReference) {
4464
- // A JSDocTypeReference may have resolved to a value (as opposed to a type). In
4464
+ // A JSDocTypeReference may have resolved to a value (as opposed to a type). In
4465
4465
// that case, the type of this reference is just the type of the value we resolved
4466
4466
// to.
4467
4467
return getTypeOfSymbol(symbol);
@@ -10404,7 +10404,7 @@ namespace ts {
10404
10404
10405
10405
/*
10406
10406
*TypeScript Specification 1.0 (6.3) - July 2014
10407
- * An explicitly typed function whose return type isn't the Void type,
10407
+ * An explicitly typed function whose return type isn't the Void type,
10408
10408
* the Any type, or a union type containing the Void or Any type as a constituent
10409
10409
* must have at least one return statement somewhere in its body.
10410
10410
* An exception to this rule is if the function implementation consists of a single 'throw' statement.
@@ -14426,10 +14426,10 @@ namespace ts {
14426
14426
if (isAmbientExternalModule) {
14427
14427
if (isExternalModuleAugmentation(node)) {
14428
14428
// body of the augmentation should be checked for consistency only if augmentation was applied to its target (either global scope or module)
14429
- // otherwise we'll be swamped in cascading errors.
14429
+ // otherwise we'll be swamped in cascading errors.
14430
14430
// We can detect if augmentation was applied using following rules:
14431
14431
// - augmentation for a global scope is always applied
14432
- // - augmentation for some external module is applied if symbol for augmentation is merged (it was combined with target module).
14432
+ // - augmentation for some external module is applied if symbol for augmentation is merged (it was combined with target module).
14433
14433
const checkBody = isGlobalAugmentation || (getSymbolOfNode(node).flags & SymbolFlags.Merged);
14434
14434
if (checkBody) {
14435
14435
// body of ambient external module is always a module block
@@ -15200,6 +15200,18 @@ namespace ts {
15200
15200
return getSymbolOfNode(entityName.parent);
15201
15201
}
15202
15202
15203
+ if (isInJavaScriptFile(entityName) && entityName.parent.kind === SyntaxKind.PropertyAccessExpression) {
15204
+ const specialPropertyAssignmentKind = getSpecialPropertyAssignmentKind(entityName.parent.parent);
15205
+ switch (specialPropertyAssignmentKind) {
15206
+ case SpecialPropertyAssignmentKind.ExportsProperty:
15207
+ case SpecialPropertyAssignmentKind.ThisProperty:
15208
+ case SpecialPropertyAssignmentKind.PrototypeProperty:
15209
+ return getSymbolOfNode(entityName.parent);
15210
+ case SpecialPropertyAssignmentKind.ModuleExports:
15211
+ return getSymbolOfNode(entityName.parent.parent);
15212
+ }
15213
+ }
15214
+
15203
15215
if (entityName.parent.kind === SyntaxKind.ExportAssignment) {
15204
15216
return resolveEntityName(<Identifier>entityName,
15205
15217
/*all meanings*/ SymbolFlags.Value | SymbolFlags.Type | SymbolFlags.Namespace | SymbolFlags.Alias);
0 commit comments