mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-16 07:13:45 -05:00
Merge pull request #34631 from amcasey/ComputedPropName
Handle undefined from getPropertyNameForPropertyNameNode
This commit is contained in:
@@ -648,7 +648,8 @@ namespace ts.NavigationBar {
|
||||
|
||||
const declName = getNameOfDeclaration(<Declaration>node);
|
||||
if (declName && isPropertyName(declName)) {
|
||||
return unescapeLeadingUnderscores(getPropertyNameForPropertyNameNode(declName)!); // TODO: GH#18217
|
||||
const propertyName = getPropertyNameForPropertyNameNode(declName);
|
||||
return propertyName && unescapeLeadingUnderscores(propertyName);
|
||||
}
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.FunctionExpression:
|
||||
|
||||
57
tests/cases/fourslash/navigationBarComputedPropertyName.ts
Normal file
57
tests/cases/fourslash/navigationBarComputedPropertyName.ts
Normal file
@@ -0,0 +1,57 @@
|
||||
/// <reference path="fourslash.ts"/>
|
||||
|
||||
////function F(key, value) {
|
||||
//// return {
|
||||
//// [key]: value,
|
||||
//// "prop": true
|
||||
//// }
|
||||
////}
|
||||
|
||||
verify.navigationTree({
|
||||
"text": "<global>",
|
||||
"kind": "script",
|
||||
"childItems": [
|
||||
{
|
||||
"text": "F",
|
||||
"kind": "function",
|
||||
"childItems": [
|
||||
{
|
||||
"text": "[key]",
|
||||
"kind": "property"
|
||||
},
|
||||
{
|
||||
"text": "\"prop\"",
|
||||
"kind": "property"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
verify.navigationBar([
|
||||
{
|
||||
"text": "<global>",
|
||||
"kind": "script",
|
||||
"childItems": [
|
||||
{
|
||||
"text": "F",
|
||||
"kind": "function"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"text": "F",
|
||||
"kind": "function",
|
||||
"childItems": [
|
||||
{
|
||||
"text": "[key]",
|
||||
"kind": "property"
|
||||
},
|
||||
{
|
||||
"text": "\"prop\"",
|
||||
"kind": "property"
|
||||
}
|
||||
],
|
||||
"indent": 1
|
||||
}
|
||||
]);
|
||||
Reference in New Issue
Block a user