Disable import fix for method of 'export =' value (#20208)
* Disable import fix for method of 'export =' value * Exclude primitives, but allow other interfaces * Use type.flags * Fix comment
This commit is contained in:
parent
5ee640d2b6
commit
94ea38859b
|
@ -1898,13 +1898,17 @@ namespace ts {
|
|||
|
||||
function tryGetMemberInModuleExportsAndProperties(memberName: __String, moduleSymbol: Symbol): Symbol | undefined {
|
||||
const symbol = tryGetMemberInModuleExports(memberName, moduleSymbol);
|
||||
if (!symbol) {
|
||||
const exportEquals = resolveExternalModuleSymbol(moduleSymbol);
|
||||
if (exportEquals !== moduleSymbol) {
|
||||
return getPropertyOfType(getTypeOfSymbol(exportEquals), memberName);
|
||||
}
|
||||
if (symbol) {
|
||||
return symbol;
|
||||
}
|
||||
return symbol;
|
||||
|
||||
const exportEquals = resolveExternalModuleSymbol(moduleSymbol);
|
||||
if (exportEquals === moduleSymbol) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const type = getTypeOfSymbol(exportEquals);
|
||||
return type.flags & TypeFlags.Primitive ? undefined : getPropertyOfType(type, memberName);
|
||||
}
|
||||
|
||||
function getExportsOfSymbol(symbol: Symbol): SymbolTable {
|
||||
|
|
|
@ -2766,7 +2766,10 @@ namespace ts {
|
|||
getAmbientModules(): Symbol[];
|
||||
|
||||
tryGetMemberInModuleExports(memberName: string, moduleSymbol: Symbol): Symbol | undefined;
|
||||
/** Unlike `tryGetMemberInModuleExports`, this includes properties of an `export =` value. */
|
||||
/**
|
||||
* Unlike `tryGetMemberInModuleExports`, this includes properties of an `export =` value.
|
||||
* Does *not* return properties of primitive types.
|
||||
*/
|
||||
/* @internal */ tryGetMemberInModuleExportsAndProperties(memberName: string, moduleSymbol: Symbol): Symbol | undefined;
|
||||
getApparentType(type: Type): Type;
|
||||
getSuggestionForNonexistentProperty(node: Identifier, containingType: Type): string | undefined;
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
/// <reference path="fourslash.ts" />
|
||||
|
||||
////[|valueOf/*0*/();|]
|
||||
|
||||
// @Filename: foo.ts
|
||||
////declare var x: number;
|
||||
////export = x;
|
||||
|
||||
verify.not.codeFixAvailable(); // See GH#20191
|
|
@ -9,8 +9,8 @@
|
|||
//// declare var x: MyStatic;
|
||||
//// export = x;
|
||||
|
||||
verify.importFixAtPosition([
|
||||
-verify.importFixAtPosition([
|
||||
`import { bar } from "./foo";
|
||||
|
||||
bar();`
|
||||
]);
|
||||
]);
|
||||
|
|
Loading…
Reference in a new issue