Skip to content

Commit 42f25b3

Browse files
author
Andy
committed
Merge pull request #8645 from Microsoft/navbar_export_type
Add type aliases to navigation bar
2 parents 66dd91b + eabafc4 commit 42f25b3

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

src/services/navigationBar.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ namespace ts.NavigationBar {
176176
break;
177177
case SyntaxKind.EnumDeclaration:
178178
case SyntaxKind.InterfaceDeclaration:
179+
case SyntaxKind.TypeAliasDeclaration:
179180
topLevelNodes.push(node);
180181
break;
181182

@@ -422,6 +423,9 @@ namespace ts.NavigationBar {
422423

423424
case SyntaxKind.FunctionDeclaration:
424425
return createFunctionItem(<FunctionDeclaration>node);
426+
427+
case SyntaxKind.TypeAliasDeclaration:
428+
return createTypeAliasItem(<TypeAliasDeclaration>node);
425429
}
426430

427431
return undefined;
@@ -474,6 +478,15 @@ namespace ts.NavigationBar {
474478
return undefined;
475479
}
476480

481+
function createTypeAliasItem(node: TypeAliasDeclaration): ts.NavigationBarItem {
482+
return getNavigationBarItem(node.name.text,
483+
ts.ScriptElementKind.typeElement,
484+
getNodeModifiers(node),
485+
[getNodeSpan(node)],
486+
[],
487+
getIndent(node));
488+
}
489+
477490
function createMemberFunctionLikeItem(node: MethodDeclaration | ConstructorDeclaration): ts.NavigationBarItem {
478491
if (node.body && node.body.kind === SyntaxKind.Block) {
479492
let childItems = getItemsWorker(sortNodes((<Block>node.body).statements), createChildItem);
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/// <reference path="fourslash.ts"/>
2+
3+
////type T = number | string;
4+
5+
verify.navigationBarCount(1);
6+
verify.navigationBarContains("T", "type");

0 commit comments

Comments
 (0)