mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-17 11:24:29 -05:00
Use a single 'untypedModuleSymbol' for all untyped modules instead of creating a new one for each module.
This commit is contained in:
@@ -132,6 +132,8 @@ namespace ts {
|
||||
const evolvingArrayTypes: EvolvingArrayType[] = [];
|
||||
|
||||
const unknownSymbol = createSymbol(SymbolFlags.Property | SymbolFlags.Transient, "unknown");
|
||||
const untypedModuleSymbol = createSymbol(SymbolFlags.ValueModule, "<untyped>");
|
||||
untypedModuleSymbol.exports = createMap<Symbol>();
|
||||
const resolvingSymbol = createSymbol(SymbolFlags.Transient, "__resolving__");
|
||||
|
||||
const anyType = createIntrinsicType(TypeFlags.Any, "any");
|
||||
@@ -1490,10 +1492,10 @@ namespace ts {
|
||||
resolvedModule.resolvedFileName);
|
||||
return undefined;
|
||||
}
|
||||
// Unlike a failed import, an untyped module produces a dummy symbol. This is checked for by `isUntypedOrShorthandAmbientModuleSymbol`.
|
||||
const untypedSymbol = createSymbol(SymbolFlags.ValueModule, `"${moduleName}"`);
|
||||
untypedSymbol.exports = createMap<Symbol>();
|
||||
return untypedSymbol;
|
||||
// Unlike a failed import, an untyped module produces a dummy symbol.
|
||||
// This is checked for by `isUntypedOrShorthandAmbientModuleSymbol`.
|
||||
// This must be different than `unknownSymbol` because `getBaseConstructorTypeOfClass` won't fail for `unknownSymbol`.
|
||||
return untypedModuleSymbol;
|
||||
}
|
||||
|
||||
if (moduleNotFoundError) {
|
||||
|
||||
@@ -12,16 +12,21 @@ class A extends Foo { }
|
||||
|
||||
//// [a.js]
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
var __extends = (this && this.__extends) || (function () {
|
||||
var extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
||||
return function (d, b) {
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
var foo_1 = require("foo");
|
||||
var A = (function (_super) {
|
||||
__extends(A, _super);
|
||||
function A() {
|
||||
return _super.apply(this, arguments) || this;
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
return A;
|
||||
}(foo_1["default"]));
|
||||
|
||||
@@ -12,7 +12,7 @@ verify.numberOfErrorsInCurrentFile(0);
|
||||
|
||||
goTo.marker("fooModule");
|
||||
verify.goToDefinitionIs([]);
|
||||
verify.quickInfoIs('module "foo"');
|
||||
verify.quickInfoIs('module <untyped>');
|
||||
verify.referencesAre([])
|
||||
|
||||
goTo.marker("foo");
|
||||
|
||||
Reference in New Issue
Block a user