Skip to content

Commit 11f589f

Browse files
committed
do not include constructor parameters with binding patterns as names when collecting nav bar items
1 parent 60a6b28 commit 11f589f

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

Diff for: src/services/navigationBar.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -423,11 +423,11 @@ module ts.NavigationBar {
423423
});
424424

425425
// Add the constructor parameters in as children of the class (for property parameters).
426-
// Note that *all* parameters will be added to the nodes array, but parameters that
426+
// Note that *all non-binding pattern named* parameters will be added to the nodes array, but parameters that
427427
// are not properties will be filtered out later by createChildItem.
428428
var nodes: Node[] = removeDynamicallyNamedProperties(node);
429429
if (constructor) {
430-
nodes.push.apply(nodes, constructor.parameters);
430+
nodes.push.apply(nodes, filter(constructor.parameters, p => !isBindingPattern(p.name)));
431431
}
432432

433433
var childItems = getItemsWorker(sortNodes(nodes), createChildItem);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/// <reference path='fourslash.ts'/>
2+
3+
////class A {
4+
//// x: any
5+
//// constructor([a]: any) {
6+
//// }
7+
////}
8+
////class B {
9+
//// x: any;
10+
//// constructor( {a} = { a: 1 }) {
11+
//// }
12+
////}
13+
14+
verify.getScriptLexicalStructureListCount(6); // 2x(class + field + constructor)

0 commit comments

Comments
 (0)