Preserve input key style of computed properties in declaration emit (#55298)

This commit is contained in:
Mateusz Burzyński
2023-08-14 22:13:42 +02:00
committed by GitHub
parent 38553696e2
commit 16dab6d5d6
9 changed files with 144 additions and 14 deletions

View File

@@ -8082,7 +8082,14 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
function isStringNamed(d: Declaration) {
const name = getNameOfDeclaration(d);
return !!name && isStringLiteral(name);
if (!name) {
return false;
}
if (isComputedPropertyName(name)) {
const type = checkExpression(name.expression);
return !!(type.flags & TypeFlags.StringLike);
}
return isStringLiteral(name);
}
function isSingleQuotedStringNamed(d: Declaration) {