Handle non literal computed name when trying to get the name for object literal property name in json object (#37988)

Fixes #37984
This commit is contained in:
Sheetal Nandi authored and GitHub committed 2020-04-20 12:58:38 -07:00
1 parent 0f3f37b30c
commit e7774c6144
8 files changed
+119 -5

No files matched your search

+1 -1
View File
@@ -1721,7 +1721,7 @@ namespace ts {
errors.push(createDiagnosticForNodeInSourceFile(sourceFile, element.name, Diagnostics.String_literal_with_double_quotes_expected));
}
const textOfKey = getTextOfPropertyName(element.name);
const textOfKey = isComputedNonLiteralName(element.name) ? undefined : getTextOfPropertyName(element.name);
const keyText = textOfKey && unescapeLeadingUnderscores(textOfKey);
const option = keyText && knownOptions ? knownOptions.get(keyText) : undefined;
if (keyText && extraKeyDiagnostics && !option) {