@@ -410,6 +410,7 @@ namespace ts {
410410 const location = getParseTreeNode(locationIn);
411411 return location ? getTypeOfSymbolAtLocation(symbol, location) : errorType;
412412 },
413+ getNonMissingTypeOfSymbol,
413414 getSymbolsOfParameterPropertyDeclaration: (parameterIn, parameterName) => {
414415 const parameter = getParseTreeNode(parameterIn, isParameter);
415416 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 {
62416242 }
62426243 const rawName = unescapeLeadingUnderscores(symbol.escapedName);
62436244 const stringNamed = !!length(symbol.declarations) && every(symbol.declarations, isStringNamed);
6244- return createPropertyNameNodeForIdentifierOrLiteral(rawName, stringNamed , singleQuote);
6245+ return createPropertyNameNodeForIdentifierOrLiteral(rawName, getEmitScriptTarget(compilerOptions) , singleQuote, stringNamed );
62456246 }
62466247
62476248 // See getNameForSymbolFromNameType for a stringy equivalent
@@ -6256,20 +6257,14 @@ namespace ts {
62566257 if (isNumericLiteralName(name) && startsWith(name, "-")) {
62576258 return factory.createComputedPropertyName(factory.createNumericLiteral(+name));
62586259 }
6259- return createPropertyNameNodeForIdentifierOrLiteral(name);
6260+ return createPropertyNameNodeForIdentifierOrLiteral(name, getEmitScriptTarget(compilerOptions) );
62606261 }
62616262 if (nameType.flags & TypeFlags.UniqueESSymbol) {
62626263 return factory.createComputedPropertyName(symbolToExpression((nameType as UniqueESSymbolType).symbol, context, SymbolFlags.Value));
62636264 }
62646265 }
62656266 }
62666267
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-
62736268 function cloneNodeBuilderContext(context: NodeBuilderContext): NodeBuilderContext {
62746269 const initial: NodeBuilderContext = { ...context };
62756270 // Make type parameters created within this context not consume the name outside this context
@@ -26950,31 +26945,6 @@ namespace ts {
2695026945 return isTypeAssignableToKind(checkComputedPropertyName(name), TypeFlags.NumberLike);
2695126946 }
2695226947
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-
2697826948 function checkComputedPropertyName(node: ComputedPropertyName): Type {
2697926949 const links = getNodeLinks(node.expression);
2698026950 if (!links.resolvedType) {
0 commit comments