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
2020-04-20 12:58:38 -07:00
committed by GitHub
parent 0f3f37b30c
commit e7774c6144
8 changed files with 119 additions and 5 deletions

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) {