mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-12-12 20:25:48 -06:00
When the exported symbol is merged symbol from declaration use that name to verify quality
Fixes #27880
This commit is contained in:
parent
9ec71c3f97
commit
b8e779d89a
@ -445,9 +445,12 @@ namespace ts.codefix {
|
||||
const aliased = checker.getImmediateAliasedSymbol(defaultExport);
|
||||
return aliased && getDefaultExportInfoWorker(aliased, Debug.assertDefined(aliased.parent), checker, compilerOptions);
|
||||
}
|
||||
else {
|
||||
return { symbolForMeaning: defaultExport, name: moduleSymbolToValidIdentifier(moduleSymbol, compilerOptions.target!) };
|
||||
|
||||
if (defaultExport.escapedName !== InternalSymbolName.Default &&
|
||||
defaultExport.escapedName !== InternalSymbolName.ExportEquals) {
|
||||
return { symbolForMeaning: defaultExport, name: defaultExport.getName() };
|
||||
}
|
||||
return { symbolForMeaning: defaultExport, name: moduleSymbolToValidIdentifier(moduleSymbol, compilerOptions.target!) };
|
||||
}
|
||||
|
||||
function getNameForExportDefault(symbol: Symbol): string | undefined {
|
||||
|
||||
@ -0,0 +1,44 @@
|
||||
/// <reference path="fourslash.ts" />
|
||||
|
||||
// @module: commonjs
|
||||
|
||||
// @Filename: /node_modules/@types/range-parser/index.d.ts
|
||||
////declare function RangeParser(): string;
|
||||
////declare namespace RangeParser {
|
||||
//// interface Options {
|
||||
//// combine?: boolean;
|
||||
//// }
|
||||
////}
|
||||
////export = RangeParser;
|
||||
|
||||
// @Filename: /b.ts
|
||||
////R/*0*/
|
||||
|
||||
verify.completions(
|
||||
{
|
||||
marker: "0",
|
||||
includes: {
|
||||
name: "RangeParser",
|
||||
kind: "function",
|
||||
kindModifiers: "declare",
|
||||
source: "/node_modules/@types/range-parser/index",
|
||||
sourceDisplay: "range-parser",
|
||||
hasAction: true,
|
||||
sortText: completion.SortText.AutoImportSuggestions,
|
||||
text: `namespace RangeParser
|
||||
function RangeParser(): string`
|
||||
},
|
||||
preferences: {
|
||||
includeCompletionsForModuleExports: true
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
verify.applyCodeActionFromCompletion("0", {
|
||||
name: "RangeParser",
|
||||
source: "/node_modules/@types/range-parser/index",
|
||||
description: `Import 'RangeParser' from module "range-parser"`,
|
||||
newFileContent: `import RangeParser = require("range-parser");
|
||||
|
||||
R`,
|
||||
});
|
||||
Loading…
x
Reference in New Issue
Block a user