Merge pull request #34631 from amcasey/ComputedPropName

Handle undefined from getPropertyNameForPropertyNameNode
This commit is contained in:
Andrew Casey 2019-10-22 10:17:05 -07:00 committed by GitHub
commit 159b6262ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 59 additions and 1 deletions

View File

@ -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:

View 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
}
]);