@@ -410,6 +410,7 @@ namespace ts {
410
410
const location = getParseTreeNode(locationIn);
411
411
return location ? getTypeOfSymbolAtLocation(symbol, location) : errorType;
412
412
},
413
+ getNonMissingTypeOfSymbol,
413
414
getSymbolsOfParameterPropertyDeclaration: (parameterIn, parameterName) => {
414
415
const parameter = getParseTreeNode(parameterIn, isParameter);
415
416
if (parameter === undefined) return Debug.fail("Cannot get symbols of a synthetic parameter that cannot be resolved to a parse-tree node.");
@@ -6241,7 +6242,7 @@ namespace ts {
6241
6242
}
6242
6243
const rawName = unescapeLeadingUnderscores(symbol.escapedName);
6243
6244
const stringNamed = !!length(symbol.declarations) && every(symbol.declarations, isStringNamed);
6244
- return createPropertyNameNodeForIdentifierOrLiteral(rawName, stringNamed , singleQuote);
6245
+ return createPropertyNameNodeForIdentifierOrLiteral(rawName, getEmitScriptTarget(compilerOptions) , singleQuote, stringNamed );
6245
6246
}
6246
6247
6247
6248
// See getNameForSymbolFromNameType for a stringy equivalent
@@ -6256,20 +6257,14 @@ namespace ts {
6256
6257
if (isNumericLiteralName(name) && startsWith(name, "-")) {
6257
6258
return factory.createComputedPropertyName(factory.createNumericLiteral(+name));
6258
6259
}
6259
- return createPropertyNameNodeForIdentifierOrLiteral(name);
6260
+ return createPropertyNameNodeForIdentifierOrLiteral(name, getEmitScriptTarget(compilerOptions) );
6260
6261
}
6261
6262
if (nameType.flags & TypeFlags.UniqueESSymbol) {
6262
6263
return factory.createComputedPropertyName(symbolToExpression((nameType as UniqueESSymbolType).symbol, context, SymbolFlags.Value));
6263
6264
}
6264
6265
}
6265
6266
}
6266
6267
6267
- function createPropertyNameNodeForIdentifierOrLiteral(name: string, stringNamed?: boolean, singleQuote?: boolean) {
6268
- return isIdentifierText(name, getEmitScriptTarget(compilerOptions)) ? factory.createIdentifier(name) :
6269
- !stringNamed && isNumericLiteralName(name) && +name >= 0 ? factory.createNumericLiteral(+name) :
6270
- factory.createStringLiteral(name, !!singleQuote);
6271
- }
6272
-
6273
6268
function cloneNodeBuilderContext(context: NodeBuilderContext): NodeBuilderContext {
6274
6269
const initial: NodeBuilderContext = { ...context };
6275
6270
// Make type parameters created within this context not consume the name outside this context
@@ -26950,31 +26945,6 @@ namespace ts {
26950
26945
return isTypeAssignableToKind(checkComputedPropertyName(name), TypeFlags.NumberLike);
26951
26946
}
26952
26947
26953
- function isNumericLiteralName(name: string | __String) {
26954
- // The intent of numeric names is that
26955
- // - they are names with text in a numeric form, and that
26956
- // - setting properties/indexing with them is always equivalent to doing so with the numeric literal 'numLit',
26957
- // acquired by applying the abstract 'ToNumber' operation on the name's text.
26958
- //
26959
- // The subtlety is in the latter portion, as we cannot reliably say that anything that looks like a numeric literal is a numeric name.
26960
- // In fact, it is the case that the text of the name must be equal to 'ToString(numLit)' for this to hold.
26961
- //
26962
- // Consider the property name '"0xF00D"'. When one indexes with '0xF00D', they are actually indexing with the value of 'ToString(0xF00D)'
26963
- // according to the ECMAScript specification, so it is actually as if the user indexed with the string '"61453"'.
26964
- // Thus, the text of all numeric literals equivalent to '61543' such as '0xF00D', '0xf00D', '0170015', etc. are not valid numeric names
26965
- // because their 'ToString' representation is not equal to their original text.
26966
- // This is motivated by ECMA-262 sections 9.3.1, 9.8.1, 11.1.5, and 11.2.1.
26967
- //
26968
- // Here, we test whether 'ToString(ToNumber(name))' is exactly equal to 'name'.
26969
- // The '+' prefix operator is equivalent here to applying the abstract ToNumber operation.
26970
- // Applying the 'toString()' method on a number gives us the abstract ToString operation on a number.
26971
- //
26972
- // Note that this accepts the values 'Infinity', '-Infinity', and 'NaN', and that this is intentional.
26973
- // This is desired behavior, because when indexing with them as numeric entities, you are indexing
26974
- // with the strings '"Infinity"', '"-Infinity"', and '"NaN"' respectively.
26975
- return (+name).toString() === name;
26976
- }
26977
-
26978
26948
function checkComputedPropertyName(node: ComputedPropertyName): Type {
26979
26949
const links = getNodeLinks(node.expression);
26980
26950
if (!links.resolvedType) {
0 commit comments