diff --git a/src/services/symbolDisplay.ts b/src/services/symbolDisplay.ts index 05c451cc3f3..ad8e7ddf975 100644 --- a/src/services/symbolDisplay.ts +++ b/src/services/symbolDisplay.ts @@ -61,7 +61,8 @@ namespace ts.SymbolDisplay { if (rootSymbolFlags & (SymbolFlags.PropertyOrAccessor | SymbolFlags.Variable)) { return ScriptElementKind.memberVariableElement; } - Debug.assert(!!(rootSymbolFlags & SymbolFlags.Method)); + // May be a Function if this was from `typeof N` with `namespace N { function f();. }`. + Debug.assert(!!(rootSymbolFlags & (SymbolFlags.Method | SymbolFlags.Function))); }); if (!unionPropertyKind) { // If this was union of all methods, diff --git a/tests/cases/fourslash/quickInfoUnionOfNamespaces.ts b/tests/cases/fourslash/quickInfoUnionOfNamespaces.ts new file mode 100644 index 00000000000..9b2431092e7 --- /dev/null +++ b/tests/cases/fourslash/quickInfoUnionOfNamespaces.ts @@ -0,0 +1,15 @@ +// See GH#18461 + +/// + +////declare const x: typeof A | typeof B; +////x./**/f; +//// +////namespace A { +//// export function f() {} +////} +////namespace B { +//// export function f() {} +////} + +verify.quickInfoAt("", "(method) f(): void");