mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-05 08:11:30 -06:00
Merge pull request #34631 from amcasey/ComputedPropName
Handle undefined from getPropertyNameForPropertyNameNode
This commit is contained in:
commit
159b6262ea
@ -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
|
||||
}
|
||||
]);
|
||||
Loading…
x
Reference in New Issue
Block a user