@@ -531,6 +531,24 @@ module ts {
531531 }
532532 }
533533
534+ // This function creates a synthetic symbol that combines the value side of one symbol with the
535+ // type/namespace side of another symbol. Consider this example:
536+ //
537+ // declare module graphics {
538+ // interface Point {
539+ // x: number;
540+ // y: number;
541+ // }
542+ // }
543+ // declare var graphics: {
544+ // Point: new (x: number, y: number) => graphics.Point;
545+ // }
546+ // declare module "graphics" {
547+ // export = graphics;
548+ // }
549+ //
550+ // An 'import { Point } from "graphics"' needs to create a symbol that combines the value side 'Point'
551+ // property with the type/namespace side interface 'Point'.
534552 function combineValueAndTypeSymbols(valueSymbol: Symbol, typeSymbol: Symbol): Symbol {
535553 if (valueSymbol.flags & (SymbolFlags.Type | SymbolFlags.Namespace)) {
536554 return valueSymbol;
@@ -776,10 +794,15 @@ module ts {
776794 error(moduleReferenceLiteral, Diagnostics.Cannot_find_external_module_0, moduleName);
777795 }
778796
797+ // An external module with an 'export =' declaration resolves to the target of the 'export =' declaration,
798+ // and an external module with no 'export =' declaration resolves to the module itself.
779799 function resolveExternalModuleSymbol(moduleSymbol: Symbol): Symbol {
780800 return moduleSymbol && resolveSymbol(moduleSymbol.exports["export="]) || moduleSymbol;
781801 }
782802
803+ // An external module with an 'export =' declaration may be referenced as an ES6 module provided the 'export ='
804+ // references a symbol that is at least declared as a module or a variable. The target of the 'export =' may
805+ // combine other declarations with the module or variable (e.g. a class/module, function/module, interface/variable).
783806 function resolveESModuleSymbol(moduleSymbol: Symbol, moduleReferenceExpression: Expression): Symbol {
784807 let symbol = resolveExternalModuleSymbol(moduleSymbol);
785808 if (symbol && !(symbol.flags & (SymbolFlags.Module | SymbolFlags.Variable))) {
0 commit comments