Skip to content

Commit

Permalink
Update assertion: symbol in union type may be a Function
Browse files Browse the repository at this point in the history
  • Loading branch information
Andy Hanson committed Sep 14, 2017
1 parent 66abcb9 commit 7e35772
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/services/symbolDisplay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
15 changes: 15 additions & 0 deletions tests/cases/fourslash/quickInfoUnionOfNamespaces.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// See GH#18461

/// <reference path='fourslash.ts' />

////declare const x: typeof A | typeof B;
////x./**/f;
////
////namespace A {
//// export function f() {}
////}
////namespace B {
//// export function f() {}
////}

verify.quickInfoAt("", "(method) f(): void");

0 comments on commit 7e35772

Please sign in to comment.