mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Fix bug at bind site rather than in declare func
This commit is contained in:
+10
-3
@@ -564,7 +564,7 @@ namespace ts {
|
||||
// and this case is specially handled. Module augmentations should only be merged with original module definition
|
||||
// and should never be merged directly with other augmentation, and the latter case would be possible if automatic merge is allowed.
|
||||
if (isJSDocTypeAlias(node)) Debug.assert(isInJSFile(node)); // We shouldn't add symbols for JSDoc nodes if not in a JS file.
|
||||
if ((!isAmbientModule(node) && (hasExportModifier || container.flags & NodeFlags.ExportContext)) || (isJSDocTypeAlias(node) && container.symbol)) {
|
||||
if ((!isAmbientModule(node) && (hasExportModifier || container.flags & NodeFlags.ExportContext)) || isJSDocTypeAlias(node)) {
|
||||
if (!container.locals || (hasModifier(node, ModifierFlags.Default) && !getDeclarationName(node))) {
|
||||
return declareSymbol(container.symbol.exports!, container.symbol, node, symbolFlags, symbolExcludes); // No local symbol for an unnamed default!
|
||||
}
|
||||
@@ -2003,7 +2003,12 @@ namespace ts {
|
||||
switch (getAssignmentDeclarationPropertyAccessKind(declName.parent)) {
|
||||
case AssignmentDeclarationKind.ExportsProperty:
|
||||
case AssignmentDeclarationKind.ModuleExports:
|
||||
container = file;
|
||||
if (!isExternalOrCommonJsModule(file)) {
|
||||
container = undefined!;
|
||||
}
|
||||
else {
|
||||
container = file;
|
||||
}
|
||||
break;
|
||||
case AssignmentDeclarationKind.ThisProperty:
|
||||
container = declName.parent.expression;
|
||||
@@ -2017,7 +2022,9 @@ namespace ts {
|
||||
case AssignmentDeclarationKind.None:
|
||||
return Debug.fail("Shouldn't have detected typedef or enum on non-assignment declaration");
|
||||
}
|
||||
declareModuleMember(typeAlias, SymbolFlags.TypeAlias, SymbolFlags.TypeAliasExcludes);
|
||||
if (container) {
|
||||
declareModuleMember(typeAlias, SymbolFlags.TypeAlias, SymbolFlags.TypeAliasExcludes);
|
||||
}
|
||||
container = oldContainer;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user