@@ -12106,7 +12106,7 @@ namespace ts {
1210612106 }
1210712107
1210812108 function getApplicableIndexInfoForName(type: Type, name: __String): IndexInfo | undefined {
12109- return getApplicableIndexInfo(type, getStringLiteralType(unescapeLeadingUnderscores(name)));
12109+ return getApplicableIndexInfo(type, isLateBoundName(name) ? esSymbolType : getStringLiteralType(unescapeLeadingUnderscores(name)));
1211012110 }
1211112111
1211212112 // Return list of type parameters with duplicates removed (duplicate identifier errors are generated in the actual
@@ -27121,8 +27121,12 @@ namespace ts {
2712127121 */
2712227122 function isKnownProperty(targetType: Type, name: __String, isComparingJsxAttributes: boolean): boolean {
2712327123 if (targetType.flags & TypeFlags.Object) {
27124+ // For backwards compatibility a symbol-named property is satisfied by a string index signature. This
27125+ // is incorrect and inconsistent with element access expressions, where it is an error, so eventually
27126+ // we should remove this exception.
2712427127 if (getPropertyOfObjectType(targetType, name) ||
2712527128 getApplicableIndexInfoForName(targetType, name) ||
27129+ isLateBoundName(name) && getIndexInfoOfType(targetType, stringType) ||
2712627130 isComparingJsxAttributes && !isUnhyphenatedJsxName(name)) {
2712727131 // For JSXAttributes, if the attribute has a hyphenated name, consider that the attribute to be known.
2712827132 return true;
@@ -28724,8 +28728,10 @@ namespace ts {
2872428728 * Returns the this argument in calls like x.f(...) and x[f](...). Undefined otherwise.
2872528729 */
2872628730 function getThisArgumentOfCall(node: CallLikeExpression): LeftHandSideExpression | undefined {
28727- if (node.kind === SyntaxKind.CallExpression) {
28728- const callee = skipOuterExpressions(node.expression);
28731+ const expression = node.kind === SyntaxKind.CallExpression ? node.expression :
28732+ node.kind === SyntaxKind.TaggedTemplateExpression ? node.tag : undefined;
28733+ if (expression) {
28734+ const callee = skipOuterExpressions(expression);
2872928735 if (isAccessExpression(callee)) {
2873028736 return callee.expression;
2873128737 }
@@ -31403,8 +31409,9 @@ namespace ts {
3140331409 }
3140431410
3140531411 function checkDeleteExpressionMustBeOptional(expr: AccessExpression, type: Type) {
31406- const AnyOrUnknownOrNeverFlags = TypeFlags.AnyOrUnknown | TypeFlags.Never;
31407- if (strictNullChecks && !(type.flags & AnyOrUnknownOrNeverFlags) && !(getFalsyFlags(type) & TypeFlags.Undefined)) {
31412+ if (strictNullChecks &&
31413+ !(type.flags & (TypeFlags.AnyOrUnknown | TypeFlags.Never)) &&
31414+ !(exactOptionalPropertyTypes ? 0 : getFalsyFlags(type) & TypeFlags.Undefined)) {
3140831415 error(expr, Diagnostics.The_operand_of_a_delete_operator_must_be_optional);
3140931416 }
3141031417 }
0 commit comments