mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-30 04:16:48 -05:00
Fix bug: get merged symbol of symbol.parent before checking against module symbol (#21147)
This commit is contained in:
@@ -1200,7 +1200,7 @@ namespace ts.Completions {
|
||||
// Don't add a completion for a re-export, only for the original.
|
||||
// If `symbol.parent !== ...`, this comes from an `export * from "foo"` re-export. Those don't create new symbols.
|
||||
// If `some(...)`, this comes from an `export { foo } from "foo"` re-export, which creates a new symbol (thus isn't caught by the first check).
|
||||
if (symbol.parent !== typeChecker.resolveExternalModuleSymbol(moduleSymbol)
|
||||
if (typeChecker.getMergedSymbol(symbol.parent) !== typeChecker.resolveExternalModuleSymbol(moduleSymbol)
|
||||
|| some(symbol.declarations, d => isExportSpecifier(d) && !!d.parent.parent.moduleSpecifier)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
/// <reference path="fourslash.ts" />
|
||||
|
||||
// @Filename: /b.d.ts
|
||||
////declare namespace N {
|
||||
//// export const foo: number;
|
||||
////}
|
||||
////declare module "n" {
|
||||
//// export = N;
|
||||
////}
|
||||
|
||||
// @Filename: /c.d.ts
|
||||
////declare namespace N {}
|
||||
|
||||
// @Filename: /a.ts
|
||||
////fo/**/
|
||||
|
||||
goTo.marker("");
|
||||
verify.completionListContains({ name: "foo", source: "n" }, "const N.foo: number", "", "const", undefined, /*hasAction*/ true, {
|
||||
includeExternalModuleExports: true,
|
||||
sourceDisplay: "n",
|
||||
});
|
||||
Reference in New Issue
Block a user