typescript 4.7.0-dev.20220304 → 4.7.0-dev.20220307

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -294,7 +294,7 @@ var ts;
294
294
  // The following is baselined as a literal template type without intervention
295
295
  /** The version of the TypeScript compiler release */
296
296
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
297
- ts.version = ts.versionMajorMinor + ".0-dev.20220304";
297
+ ts.version = ts.versionMajorMinor + ".0-dev.20220307";
298
298
  /* @internal */
299
299
  var Comparison;
300
300
  (function (Comparison) {
@@ -39430,7 +39430,8 @@ var ts;
39430
39430
  name: "jsxFragmentFactory",
39431
39431
  type: "string",
39432
39432
  category: ts.Diagnostics.Language_and_Environment,
39433
- description: ts.Diagnostics.Specify_the_JSX_Fragment_reference_used_for_fragments_when_targeting_React_JSX_emit_e_g_React_Fragment_or_Fragment
39433
+ description: ts.Diagnostics.Specify_the_JSX_Fragment_reference_used_for_fragments_when_targeting_React_JSX_emit_e_g_React_Fragment_or_Fragment,
39434
+ defaultValueDescription: "React.Fragment",
39434
39435
  },
39435
39436
  {
39436
39437
  name: "jsxImportSource",
@@ -44519,7 +44520,7 @@ var ts;
44519
44520
  return ts.isDottedName(expr)
44520
44521
  || (ts.isPropertyAccessExpression(expr) || ts.isNonNullExpression(expr) || ts.isParenthesizedExpression(expr)) && isNarrowableReference(expr.expression)
44521
44522
  || ts.isBinaryExpression(expr) && expr.operatorToken.kind === 27 /* CommaToken */ && isNarrowableReference(expr.right)
44522
- || ts.isElementAccessExpression(expr) && ts.isStringOrNumericLiteralLike(expr.argumentExpression) && isNarrowableReference(expr.expression)
44523
+ || ts.isElementAccessExpression(expr) && (ts.isStringOrNumericLiteralLike(expr.argumentExpression) || ts.isEntityNameExpression(expr.argumentExpression)) && isNarrowableReference(expr.expression)
44523
44524
  || ts.isAssignmentExpression(expr) && isNarrowableReference(expr.left);
44524
44525
  }
44525
44526
  function containsNarrowableReference(expr) {
@@ -52755,7 +52756,15 @@ var ts;
52755
52756
  });
52756
52757
  }
52757
52758
  }
52758
- if (!symbolName) {
52759
+ if (symbolName === undefined) {
52760
+ var name = ts.firstDefined(symbol.declarations, ts.getNameOfDeclaration);
52761
+ if (name && ts.isComputedPropertyName(name) && ts.isEntityName(name.expression)) {
52762
+ var LHS = createAccessFromSymbolChain(chain, index - 1, stopper);
52763
+ if (ts.isEntityName(LHS)) {
52764
+ return ts.factory.createIndexedAccessTypeNode(ts.factory.createParenthesizedType(ts.factory.createTypeQueryNode(LHS)), ts.factory.createTypeQueryNode(name.expression));
52765
+ }
52766
+ return LHS;
52767
+ }
52759
52768
  symbolName = getNameOfSymbolAsWritten(symbol, context);
52760
52769
  }
52761
52770
  context.approximateLength += symbolName.length + 1;
@@ -65495,7 +65504,7 @@ var ts;
65495
65504
  var requireOptionalProperties = (relation === subtypeRelation || relation === strictSubtypeRelation) && !isObjectLiteralType(source) && !isEmptyArrayLiteralType(source) && !isTupleType(source);
65496
65505
  var unmatchedProperty = getUnmatchedProperty(source, target, requireOptionalProperties, /*matchDiscriminantProperties*/ false);
65497
65506
  if (unmatchedProperty) {
65498
- if (reportErrors) {
65507
+ if (reportErrors && shouldReportUnmatchedPropertyError(source, target)) {
65499
65508
  reportUnmatchedProperty(source, target, unmatchedProperty, requireOptionalProperties);
65500
65509
  }
65501
65510
  return 0 /* False */;
@@ -65651,6 +65660,19 @@ var ts;
65651
65660
  }
65652
65661
  return result;
65653
65662
  }
65663
+ function shouldReportUnmatchedPropertyError(source, target) {
65664
+ var typeCallSignatures = getSignaturesOfStructuredType(source, 0 /* Call */);
65665
+ var typeConstructSignatures = getSignaturesOfStructuredType(source, 1 /* Construct */);
65666
+ var typeProperties = getPropertiesOfObjectType(source);
65667
+ if ((typeCallSignatures.length || typeConstructSignatures.length) && !typeProperties.length) {
65668
+ if ((getSignaturesOfType(target, 0 /* Call */).length && typeCallSignatures.length) ||
65669
+ (getSignaturesOfType(target, 1 /* Construct */).length && typeConstructSignatures.length)) {
65670
+ return true; // target has similar signature kinds to source, still focus on the unmatched property
65671
+ }
65672
+ return false;
65673
+ }
65674
+ return true;
65675
+ }
65654
65676
  function reportIncompatibleCallSignatureReturn(siga, sigb) {
65655
65677
  if (siga.parameters.length === 0 && sigb.parameters.length === 0) {
65656
65678
  return function (source, target) { return reportIncompatibleError(ts.Diagnostics.Call_signatures_with_no_arguments_have_incompatible_return_types_0_and_1, typeToString(source), typeToString(target)); };
@@ -68226,8 +68248,9 @@ var ts;
68226
68248
  return isMatchingReference(source.expression, target);
68227
68249
  case 205 /* PropertyAccessExpression */:
68228
68250
  case 206 /* ElementAccessExpression */:
68229
- return ts.isAccessExpression(target) &&
68230
- getAccessedPropertyName(source) === getAccessedPropertyName(target) &&
68251
+ var sourcePropertyName = getAccessedPropertyName(source);
68252
+ var targetPropertyName = ts.isAccessExpression(target) ? getAccessedPropertyName(target) : undefined;
68253
+ return sourcePropertyName !== undefined && targetPropertyName !== undefined && targetPropertyName === sourcePropertyName &&
68231
68254
  isMatchingReference(source.expression, target.expression);
68232
68255
  case 160 /* QualifiedName */:
68233
68256
  return ts.isAccessExpression(target) &&
@@ -68239,12 +68262,49 @@ var ts;
68239
68262
  return false;
68240
68263
  }
68241
68264
  function getAccessedPropertyName(access) {
68242
- var propertyName;
68243
- return access.kind === 205 /* PropertyAccessExpression */ ? access.name.escapedText :
68244
- access.kind === 206 /* ElementAccessExpression */ && ts.isStringOrNumericLiteralLike(access.argumentExpression) ? ts.escapeLeadingUnderscores(access.argumentExpression.text) :
68245
- access.kind === 202 /* BindingElement */ && (propertyName = getDestructuringPropertyName(access)) ? ts.escapeLeadingUnderscores(propertyName) :
68246
- access.kind === 163 /* Parameter */ ? ("" + access.parent.parameters.indexOf(access)) :
68247
- undefined;
68265
+ if (ts.isPropertyAccessExpression(access)) {
68266
+ return access.name.escapedText;
68267
+ }
68268
+ if (ts.isElementAccessExpression(access)) {
68269
+ return tryGetElementAccessExpressionName(access);
68270
+ }
68271
+ if (ts.isBindingElement(access)) {
68272
+ var name = getDestructuringPropertyName(access);
68273
+ return name ? ts.escapeLeadingUnderscores(name) : undefined;
68274
+ }
68275
+ if (ts.isParameter(access)) {
68276
+ return ("" + access.parent.parameters.indexOf(access));
68277
+ }
68278
+ return undefined;
68279
+ }
68280
+ function tryGetNameFromType(type) {
68281
+ return type.flags & 8192 /* UniqueESSymbol */ ? type.escapedName :
68282
+ type.flags & 384 /* StringOrNumberLiteral */ ? ts.escapeLeadingUnderscores("" + type.value) : undefined;
68283
+ }
68284
+ function tryGetElementAccessExpressionName(node) {
68285
+ if (ts.isStringOrNumericLiteralLike(node.argumentExpression)) {
68286
+ return ts.escapeLeadingUnderscores(node.argumentExpression.text);
68287
+ }
68288
+ if (ts.isEntityNameExpression(node.argumentExpression)) {
68289
+ var symbol = resolveEntityName(node.argumentExpression, 111551 /* Value */, /*ignoreErrors*/ true);
68290
+ if (!symbol || !isConstVariable(symbol))
68291
+ return undefined;
68292
+ var declaration = symbol.valueDeclaration;
68293
+ if (declaration === undefined)
68294
+ return undefined;
68295
+ var type = tryGetTypeFromEffectiveTypeNode(declaration);
68296
+ if (type) {
68297
+ var name = tryGetNameFromType(type);
68298
+ if (name !== undefined) {
68299
+ return name;
68300
+ }
68301
+ }
68302
+ if (ts.hasOnlyExpressionInitializer(declaration)) {
68303
+ var initializer = ts.getEffectiveInitializer(declaration);
68304
+ return initializer && tryGetNameFromType(getTypeOfExpression(initializer));
68305
+ }
68306
+ }
68307
+ return undefined;
68248
68308
  }
68249
68309
  function containsMatchingReference(source, target) {
68250
68310
  while (ts.isAccessExpression(source)) {
@@ -71750,11 +71810,21 @@ var ts;
71750
71810
  }
71751
71811
  return false;
71752
71812
  }
71813
+ function uniqueStrings(strings) {
71814
+ var unique = new ts.Set(strings);
71815
+ var result = [];
71816
+ unique.forEach(function (str) { return result.push(str); });
71817
+ return result;
71818
+ }
71753
71819
  function discriminateContextualTypeByObjectMembers(node, contextualType) {
71754
- return getMatchingUnionConstituentForObjectLiteral(contextualType, node) || discriminateTypeByDiscriminableItems(contextualType, ts.concatenate(ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 295 /* PropertyAssignment */ && isPossiblyDiscriminantValue(p.initializer) && isDiscriminantProperty(contextualType, p.symbol.escapedName); }), function (prop) { return [function () { return getContextFreeTypeOfExpression(prop.initializer); }, prop.symbol.escapedName]; }), ts.map(ts.filter(getPropertiesOfType(contextualType), function (s) { var _a; return !!(s.flags & 16777216 /* Optional */) && !!((_a = node === null || node === void 0 ? void 0 : node.symbol) === null || _a === void 0 ? void 0 : _a.members) && !node.symbol.members.has(s.escapedName) && isDiscriminantProperty(contextualType, s.escapedName); }), function (s) { return [function () { return undefinedType; }, s.escapedName]; })), isTypeAssignableTo, contextualType);
71820
+ return getMatchingUnionConstituentForObjectLiteral(contextualType, node) || discriminateTypeByDiscriminableItems(contextualType, ts.concatenate(ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 295 /* PropertyAssignment */ && isPossiblyDiscriminantValue(p.initializer) && isDiscriminantProperty(contextualType, p.symbol.escapedName); }), function (prop) { return [function () { return getContextFreeTypeOfExpression(prop.initializer); }, prop.symbol.escapedName]; }), ts.map(uniqueStrings(ts.flatMap(contextualType.types, function (memberType) {
71821
+ return ts.map(ts.filter(getPropertiesOfType(memberType), function (s) { var _a; return !!(s.flags & 16777216 /* Optional */) && !!((_a = node === null || node === void 0 ? void 0 : node.symbol) === null || _a === void 0 ? void 0 : _a.members) && !node.symbol.members.has(s.escapedName) && isDiscriminantProperty(contextualType, s.escapedName); }), function (s) { return s.escapedName; });
71822
+ })), function (name) { return [function () { return undefinedType; }, name]; })), isTypeAssignableTo, contextualType);
71755
71823
  }
71756
71824
  function discriminateContextualTypeByJSXAttributes(node, contextualType) {
71757
- return discriminateTypeByDiscriminableItems(contextualType, ts.concatenate(ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 284 /* JsxAttribute */ && isDiscriminantProperty(contextualType, p.symbol.escapedName) && (!p.initializer || isPossiblyDiscriminantValue(p.initializer)); }), function (prop) { return [!prop.initializer ? (function () { return trueType; }) : (function () { return getContextFreeTypeOfExpression(prop.initializer); }), prop.symbol.escapedName]; }), ts.map(ts.filter(getPropertiesOfType(contextualType), function (s) { var _a; return !!(s.flags & 16777216 /* Optional */) && !!((_a = node === null || node === void 0 ? void 0 : node.symbol) === null || _a === void 0 ? void 0 : _a.members) && !node.symbol.members.has(s.escapedName) && isDiscriminantProperty(contextualType, s.escapedName); }), function (s) { return [function () { return undefinedType; }, s.escapedName]; })), isTypeAssignableTo, contextualType);
71825
+ return discriminateTypeByDiscriminableItems(contextualType, ts.concatenate(ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 284 /* JsxAttribute */ && isDiscriminantProperty(contextualType, p.symbol.escapedName) && (!p.initializer || isPossiblyDiscriminantValue(p.initializer)); }), function (prop) { return [!prop.initializer ? (function () { return trueType; }) : (function () { return getContextFreeTypeOfExpression(prop.initializer); }), prop.symbol.escapedName]; }), ts.map(uniqueStrings(ts.flatMap(contextualType.types, function (memberType) {
71826
+ return ts.map(ts.filter(getPropertiesOfType(memberType), function (s) { var _a; return !!(s.flags & 16777216 /* Optional */) && !!((_a = node === null || node === void 0 ? void 0 : node.symbol) === null || _a === void 0 ? void 0 : _a.members) && !node.symbol.members.has(s.escapedName) && isDiscriminantProperty(contextualType, s.escapedName); }), function (s) { return s.escapedName; });
71827
+ })), function (name) { return [function () { return undefinedType; }, name]; })), isTypeAssignableTo, contextualType);
71758
71828
  }
71759
71829
  // Return the contextual type for a given expression node. During overload resolution, a contextual type may temporarily
71760
71830
  // be "pushed" onto a node using the contextualType property.
@@ -73249,21 +73319,20 @@ var ts;
73249
73319
  // of the property as base classes
73250
73320
  var enclosingClass = forEachEnclosingClass(location, function (enclosingDeclaration) {
73251
73321
  var enclosingClass = getDeclaredTypeOfSymbol(getSymbolOfNode(enclosingDeclaration));
73252
- return isClassDerivedFromDeclaringClasses(enclosingClass, prop, writing) ? enclosingClass : undefined;
73322
+ return isClassDerivedFromDeclaringClasses(enclosingClass, prop, writing);
73253
73323
  });
73254
73324
  // A protected property is accessible if the property is within the declaring class or classes derived from it
73255
73325
  if (!enclosingClass) {
73256
73326
  // allow PropertyAccessibility if context is in function with this parameter
73257
- // static member access is disallow
73258
- var thisParameter = void 0;
73259
- if (flags & 32 /* Static */ || !(thisParameter = getThisParameterFromNodeContext(location)) || !thisParameter.type) {
73327
+ // static member access is disallowed
73328
+ enclosingClass = getEnclosingClassFromThisParameter(location);
73329
+ enclosingClass = enclosingClass && isClassDerivedFromDeclaringClasses(enclosingClass, prop, writing);
73330
+ if (flags & 32 /* Static */ || !enclosingClass) {
73260
73331
  if (errorNode) {
73261
73332
  error(errorNode, ts.Diagnostics.Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses, symbolToString(prop), typeToString(getDeclaringClass(prop) || containingType));
73262
73333
  }
73263
73334
  return false;
73264
73335
  }
73265
- var thisType = getTypeFromTypeNode(thisParameter.type);
73266
- enclosingClass = ((thisType.flags & 262144 /* TypeParameter */) ? getConstraintOfTypeParameter(thisType) : thisType).target;
73267
73336
  }
73268
73337
  // No further restrictions for static properties
73269
73338
  if (flags & 32 /* Static */) {
@@ -73281,6 +73350,17 @@ var ts;
73281
73350
  }
73282
73351
  return true;
73283
73352
  }
73353
+ function getEnclosingClassFromThisParameter(node) {
73354
+ var thisParameter = getThisParameterFromNodeContext(node);
73355
+ var thisType = (thisParameter === null || thisParameter === void 0 ? void 0 : thisParameter.type) && getTypeFromTypeNode(thisParameter.type);
73356
+ if (thisType && thisType.flags & 262144 /* TypeParameter */) {
73357
+ thisType = getConstraintOfTypeParameter(thisType);
73358
+ }
73359
+ if (thisType && ts.getObjectFlags(thisType) & (3 /* ClassOrInterface */ | 4 /* Reference */)) {
73360
+ return getTargetType(thisType);
73361
+ }
73362
+ return undefined;
73363
+ }
73284
73364
  function getThisParameterFromNodeContext(node) {
73285
73365
  var thisContainer = ts.getThisContainer(node, /* includeArrowFunctions */ false);
73286
73366
  return thisContainer && ts.isFunctionLike(thisContainer) ? ts.getThisParameter(thisContainer) : undefined;
@@ -75389,7 +75469,7 @@ var ts;
75389
75469
  // then it cannot be instantiated.
75390
75470
  // In the case of a merged class-module or class-interface declaration,
75391
75471
  // only the class declaration node will have the Abstract flag set.
75392
- if (constructSignatures.some(function (signature) { return signature.flags & 4 /* Abstract */; })) {
75472
+ if (someSignature(constructSignatures, function (signature) { return !!(signature.flags & 4 /* Abstract */); })) {
75393
75473
  error(node, ts.Diagnostics.Cannot_create_an_instance_of_an_abstract_class);
75394
75474
  return resolveErrorCall(node);
75395
75475
  }
@@ -75420,6 +75500,12 @@ var ts;
75420
75500
  invocationError(node.expression, expressionType, 1 /* Construct */);
75421
75501
  return resolveErrorCall(node);
75422
75502
  }
75503
+ function someSignature(signatures, f) {
75504
+ if (ts.isArray(signatures)) {
75505
+ return ts.some(signatures, function (signature) { return someSignature(signature, f); });
75506
+ }
75507
+ return signatures.compositeKind === 1048576 /* Union */ ? ts.some(signatures.compositeSignatures, f) : f(signatures);
75508
+ }
75423
75509
  function typeHasProtectedAccessibleBase(target, type) {
75424
75510
  var baseTypes = getBaseTypes(type);
75425
75511
  if (!ts.length(baseTypes)) {
@@ -77262,7 +77348,7 @@ var ts;
77262
77348
  case 40 /* MinusToken */:
77263
77349
  case 54 /* TildeToken */:
77264
77350
  checkNonNullType(operandType, node.operand);
77265
- if (maybeTypeOfKind(operandType, 12288 /* ESSymbolLike */)) {
77351
+ if (maybeTypeOfKindConsideringBaseConstraint(operandType, 12288 /* ESSymbolLike */)) {
77266
77352
  error(node.operand, ts.Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, ts.tokenToString(node.operator));
77267
77353
  }
77268
77354
  if (node.operator === 39 /* PlusToken */) {
@@ -77310,6 +77396,13 @@ var ts;
77310
77396
  // If it's not a bigint type, implicit coercion will result in a number
77311
77397
  return numberType;
77312
77398
  }
77399
+ function maybeTypeOfKindConsideringBaseConstraint(type, kind) {
77400
+ if (maybeTypeOfKind(type, kind)) {
77401
+ return true;
77402
+ }
77403
+ var baseConstraint = getBaseConstraintOrType(type);
77404
+ return !!baseConstraint && maybeTypeOfKind(baseConstraint, kind);
77405
+ }
77313
77406
  // Return true if type might be of the given kind. A union or intersection type might be of a given
77314
77407
  // kind if at least one constituent type is of the given kind.
77315
77408
  function maybeTypeOfKind(type, kind) {
@@ -78019,8 +78112,8 @@ var ts;
78019
78112
  }
78020
78113
  // Return true if there was no error, false if there was an error.
78021
78114
  function checkForDisallowedESSymbolOperand(operator) {
78022
- var offendingSymbolOperand = maybeTypeOfKind(leftType, 12288 /* ESSymbolLike */) ? left :
78023
- maybeTypeOfKind(rightType, 12288 /* ESSymbolLike */) ? right :
78115
+ var offendingSymbolOperand = maybeTypeOfKindConsideringBaseConstraint(leftType, 12288 /* ESSymbolLike */) ? left :
78116
+ maybeTypeOfKindConsideringBaseConstraint(rightType, 12288 /* ESSymbolLike */) ? right :
78024
78117
  undefined;
78025
78118
  if (offendingSymbolOperand) {
78026
78119
  error(offendingSymbolOperand, ts.Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, ts.tokenToString(operator));
@@ -78224,7 +78317,7 @@ var ts;
78224
78317
  for (var _i = 0, _a = node.templateSpans; _i < _a.length; _i++) {
78225
78318
  var span = _a[_i];
78226
78319
  var type = checkExpression(span.expression);
78227
- if (maybeTypeOfKind(type, 12288 /* ESSymbolLike */)) {
78320
+ if (maybeTypeOfKindConsideringBaseConstraint(type, 12288 /* ESSymbolLike */)) {
78228
78321
  error(span.expression, ts.Diagnostics.Implicit_conversion_of_a_symbol_to_a_string_will_fail_at_runtime_Consider_wrapping_this_expression_in_String);
78229
78322
  }
78230
78323
  texts.push(span.literal.text);
@@ -83251,7 +83344,7 @@ var ts;
83251
83344
  }
83252
83345
  if (!ts.isStatic(member) && isPropertyWithoutInitializer(member)) {
83253
83346
  var propName = member.name;
83254
- if (ts.isIdentifier(propName) || ts.isPrivateIdentifier(propName)) {
83347
+ if (ts.isIdentifier(propName) || ts.isPrivateIdentifier(propName) || ts.isComputedPropertyName(propName)) {
83255
83348
  var type = getTypeOfSymbol(getSymbolOfNode(member));
83256
83349
  if (!(type.flags & 3 /* AnyOrUnknown */ || getFalsyFlags(type) & 32768 /* Undefined */)) {
83257
83350
  if (!constructor || !isPropertyInitializedInConstructor(propName, type, constructor)) {
@@ -83286,7 +83379,9 @@ var ts;
83286
83379
  return false;
83287
83380
  }
83288
83381
  function isPropertyInitializedInConstructor(propName, propType, constructor) {
83289
- var reference = ts.factory.createPropertyAccessExpression(ts.factory.createThis(), propName);
83382
+ var reference = ts.isComputedPropertyName(propName)
83383
+ ? ts.factory.createElementAccessExpression(ts.factory.createThis(), propName.expression)
83384
+ : ts.factory.createPropertyAccessExpression(ts.factory.createThis(), propName);
83290
83385
  ts.setParent(reference.expression, reference);
83291
83386
  ts.setParent(reference, constructor);
83292
83387
  reference.flowNode = constructor.returnFlowNode;
@@ -92843,10 +92938,7 @@ var ts;
92843
92938
  var substitute = typeof constantValue === "string" ? factory.createStringLiteral(constantValue) : factory.createNumericLiteral(constantValue);
92844
92939
  if (!compilerOptions.removeComments) {
92845
92940
  var originalNode = ts.getOriginalNode(node, ts.isAccessExpression);
92846
- var propertyName = ts.isPropertyAccessExpression(originalNode)
92847
- ? ts.declarationNameToString(originalNode.name)
92848
- : safeMultiLineComment(ts.getTextOfNode(originalNode.argumentExpression));
92849
- ts.addSyntheticTrailingComment(substitute, 3 /* MultiLineCommentTrivia */, " " + propertyName + " ");
92941
+ ts.addSyntheticTrailingComment(substitute, 3 /* MultiLineCommentTrivia */, " " + safeMultiLineComment(ts.getTextOfNode(originalNode)) + " ");
92850
92942
  }
92851
92943
  return substitute;
92852
92944
  }
@@ -151464,8 +151556,10 @@ var ts;
151464
151556
  var checker = program.getTypeChecker();
151465
151557
  var compilerOptions = program.getCompilerOptions();
151466
151558
  var symbolName = getSymbolName(sourceFile, checker, symbolToken, compilerOptions);
151467
- // "default" is a keyword and not a legal identifier for the import, so we don't expect it here
151468
- ts.Debug.assert(symbolName !== "default" /* Default */, "'default' isn't a legal identifier and couldn't occur here");
151559
+ // "default" is a keyword and not a legal identifier for the import, but appears as an identifier.
151560
+ if (symbolName === "default" /* Default */) {
151561
+ return undefined;
151562
+ }
151469
151563
  var isValidTypeOnlyUseSite = ts.isValidTypeOnlyAliasUseSite(symbolToken);
151470
151564
  var useRequire = shouldUseRequire(sourceFile, program);
151471
151565
  var exportInfo = getExportInfos(symbolName, ts.isJSXTagName(symbolToken), ts.getMeaningFromLocation(symbolToken), cancellationToken, sourceFile, program, useAutoImportProvider, host, preferences);