typescript 4.7.0-dev.20220316 → 4.7.0-dev.20220319

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.
package/lib/typescript.js CHANGED
@@ -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.20220316";
297
+ ts.version = ts.versionMajorMinor + ".0-dev.20220319";
298
298
  /* @internal */
299
299
  var Comparison;
300
300
  (function (Comparison) {
@@ -8444,6 +8444,7 @@ var ts;
8444
8444
  Cannot_use_export_import_on_a_type_or_type_only_namespace_when_the_isolatedModules_flag_is_provided: diag(1269, ts.DiagnosticCategory.Error, "Cannot_use_export_import_on_a_type_or_type_only_namespace_when_the_isolatedModules_flag_is_provided_1269", "Cannot use 'export import' on a type or type-only namespace when the '--isolatedModules' flag is provided."),
8445
8445
  Decorator_function_return_type_0_is_not_assignable_to_type_1: diag(1270, ts.DiagnosticCategory.Error, "Decorator_function_return_type_0_is_not_assignable_to_type_1_1270", "Decorator function return type '{0}' is not assignable to type '{1}'."),
8446
8446
  Decorator_function_return_type_is_0_but_is_expected_to_be_void_or_any: diag(1271, ts.DiagnosticCategory.Error, "Decorator_function_return_type_is_0_but_is_expected_to_be_void_or_any_1271", "Decorator function return type is '{0}' but is expected to be 'void' or 'any'."),
8447
+ A_type_referenced_in_a_decorated_signature_must_be_imported_with_import_type_or_a_namespace_import_when_isolatedModules_and_emitDecoratorMetadata_are_enabled: diag(1272, ts.DiagnosticCategory.Error, "A_type_referenced_in_a_decorated_signature_must_be_imported_with_import_type_or_a_namespace_import_w_1272", "A type referenced in a decorated signature must be imported with 'import type' or a namespace import when 'isolatedModules' and 'emitDecoratorMetadata' are enabled."),
8447
8448
  with_statements_are_not_allowed_in_an_async_function_block: diag(1300, ts.DiagnosticCategory.Error, "with_statements_are_not_allowed_in_an_async_function_block_1300", "'with' statements are not allowed in an async function block."),
8448
8449
  await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules: diag(1308, ts.DiagnosticCategory.Error, "await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules_1308", "'await' expressions are only allowed within async functions and at the top levels of modules."),
8449
8450
  Did_you_mean_to_use_a_Colon_An_can_only_follow_a_property_name_when_the_containing_object_literal_is_part_of_a_destructuring_pattern: diag(1312, ts.DiagnosticCategory.Error, "Did_you_mean_to_use_a_Colon_An_can_only_follow_a_property_name_when_the_containing_object_literal_is_1312", "Did you mean to use a ':'? An '=' can only follow a property name when the containing object literal is part of a destructuring pattern."),
@@ -41089,7 +41090,10 @@ var ts;
41089
41090
  * file to. e.g. outDir
41090
41091
  */
41091
41092
  function parseJsonSourceFileConfigFileContent(sourceFile, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions, extendedConfigCache, existingWatchOptions) {
41092
- return parseJsonConfigFileContentWorker(/*json*/ undefined, sourceFile, host, basePath, existingOptions, existingWatchOptions, configFileName, resolutionStack, extraFileExtensions, extendedConfigCache);
41093
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("parse" /* Parse */, "parseJsonSourceFileConfigFileContent", { path: sourceFile.fileName });
41094
+ var result = parseJsonConfigFileContentWorker(/*json*/ undefined, sourceFile, host, basePath, existingOptions, existingWatchOptions, configFileName, resolutionStack, extraFileExtensions, extendedConfigCache);
41095
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
41096
+ return result;
41093
41097
  }
41094
41098
  ts.parseJsonSourceFileConfigFileContent = parseJsonSourceFileConfigFileContent;
41095
41099
  /*@internal*/
@@ -59090,7 +59094,19 @@ var ts;
59090
59094
  return p.typeExpression && ts.isJSDocVariadicType(p.typeExpression.type) ? p.typeExpression.type : undefined;
59091
59095
  });
59092
59096
  var syntheticArgsSymbol = createSymbol(3 /* Variable */, "args", 32768 /* RestParameter */);
59093
- syntheticArgsSymbol.type = lastParamVariadicType ? createArrayType(getTypeFromTypeNode(lastParamVariadicType.type)) : anyArrayType;
59097
+ if (lastParamVariadicType) {
59098
+ // Parameter has effective annotation, lock in type
59099
+ syntheticArgsSymbol.type = createArrayType(getTypeFromTypeNode(lastParamVariadicType.type));
59100
+ }
59101
+ else {
59102
+ // Parameter has no annotation
59103
+ // By using a `DeferredType` symbol, we allow the type of this rest arg to be overriden by contextual type assignment so long as its type hasn't been
59104
+ // cached by `getTypeOfSymbol` yet.
59105
+ syntheticArgsSymbol.checkFlags |= 65536 /* DeferredType */;
59106
+ syntheticArgsSymbol.deferralParent = neverType;
59107
+ syntheticArgsSymbol.deferralConstituents = [anyArrayType];
59108
+ syntheticArgsSymbol.deferralWriteConstituents = [anyArrayType];
59109
+ }
59094
59110
  if (lastParamVariadicType) {
59095
59111
  // Replace the last parameter with a rest parameter.
59096
59112
  parameters.pop();
@@ -76977,7 +76993,11 @@ var ts;
76977
76993
  if (signatureHasRestParameter(signature)) {
76978
76994
  // parameter might be a transient symbol generated by use of `arguments` in the function body.
76979
76995
  var parameter = ts.last(signature.parameters);
76980
- if (ts.isTransientSymbol(parameter) || !ts.getEffectiveTypeAnnotationNode(parameter.valueDeclaration)) {
76996
+ if (parameter.valueDeclaration
76997
+ ? !ts.getEffectiveTypeAnnotationNode(parameter.valueDeclaration)
76998
+ // a declarationless parameter may still have a `.type` already set by its construction logic
76999
+ // (which may pull a type from a jsdoc) - only allow fixing on `DeferredType` parameters with a fallback type
77000
+ : !!(ts.getCheckFlags(parameter) & 65536 /* DeferredType */)) {
76981
77001
  var contextualParameterType = getRestTypeAtPosition(context, len);
76982
77002
  assignParameterType(parameter, contextualParameterType);
76983
77003
  }
@@ -76996,8 +77016,8 @@ var ts;
76996
77016
  var links = getSymbolLinks(parameter);
76997
77017
  if (!links.type) {
76998
77018
  var declaration = parameter.valueDeclaration;
76999
- links.type = type || getWidenedTypeForVariableLikeDeclaration(declaration, /*reportErrors*/ true);
77000
- if (declaration.name.kind !== 79 /* Identifier */) {
77019
+ links.type = type || (declaration ? getWidenedTypeForVariableLikeDeclaration(declaration, /*reportErrors*/ true) : getTypeOfSymbol(parameter));
77020
+ if (declaration && declaration.name.kind !== 79 /* Identifier */) {
77001
77021
  // if inference didn't come up with anything but unknown, fall back to the binding pattern if present.
77002
77022
  if (links.type === unknownType) {
77003
77023
  links.type = getTypeFromBindingPattern(declaration.name);
@@ -80810,20 +80830,31 @@ var ts;
80810
80830
  * marked as referenced to prevent import elision.
80811
80831
  */
80812
80832
  function markTypeNodeAsReferenced(node) {
80813
- markEntityNameOrEntityExpressionAsReference(node && ts.getEntityNameFromTypeNode(node));
80833
+ markEntityNameOrEntityExpressionAsReference(node && ts.getEntityNameFromTypeNode(node), /*forDecoratorMetadata*/ false);
80814
80834
  }
80815
- function markEntityNameOrEntityExpressionAsReference(typeName) {
80835
+ function markEntityNameOrEntityExpressionAsReference(typeName, forDecoratorMetadata) {
80816
80836
  if (!typeName)
80817
80837
  return;
80818
80838
  var rootName = ts.getFirstIdentifier(typeName);
80819
80839
  var meaning = (typeName.kind === 79 /* Identifier */ ? 788968 /* Type */ : 1920 /* Namespace */) | 2097152 /* Alias */;
80820
80840
  var rootSymbol = resolveName(rootName, rootName.escapedText, meaning, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isReference*/ true);
80821
- if (rootSymbol
80822
- && rootSymbol.flags & 2097152 /* Alias */
80823
- && symbolIsValue(rootSymbol)
80824
- && !isConstEnumOrConstEnumOnlyModule(resolveAlias(rootSymbol))
80825
- && !getTypeOnlyAliasDeclaration(rootSymbol)) {
80826
- markAliasSymbolAsReferenced(rootSymbol);
80841
+ if (rootSymbol && rootSymbol.flags & 2097152 /* Alias */) {
80842
+ if (symbolIsValue(rootSymbol)
80843
+ && !isConstEnumOrConstEnumOnlyModule(resolveAlias(rootSymbol))
80844
+ && !getTypeOnlyAliasDeclaration(rootSymbol)) {
80845
+ markAliasSymbolAsReferenced(rootSymbol);
80846
+ }
80847
+ else if (forDecoratorMetadata
80848
+ && compilerOptions.isolatedModules
80849
+ && ts.getEmitModuleKind(compilerOptions) >= ts.ModuleKind.ES2015
80850
+ && !symbolIsValue(rootSymbol)
80851
+ && !ts.some(rootSymbol.declarations, ts.isTypeOnlyImportOrExportDeclaration)) {
80852
+ var diag = error(typeName, ts.Diagnostics.A_type_referenced_in_a_decorated_signature_must_be_imported_with_import_type_or_a_namespace_import_when_isolatedModules_and_emitDecoratorMetadata_are_enabled);
80853
+ var aliasDeclaration = ts.find(rootSymbol.declarations || ts.emptyArray, isAliasSymbolDeclaration);
80854
+ if (aliasDeclaration) {
80855
+ ts.addRelatedInfo(diag, ts.createDiagnosticForNode(aliasDeclaration, ts.Diagnostics._0_was_imported_here, ts.idText(rootName)));
80856
+ }
80857
+ }
80827
80858
  }
80828
80859
  }
80829
80860
  /**
@@ -80836,7 +80867,7 @@ var ts;
80836
80867
  function markDecoratorMedataDataTypeNodeAsReferenced(node) {
80837
80868
  var entityName = getEntityNameForDecoratorMetadata(node);
80838
80869
  if (entityName && ts.isEntityName(entityName)) {
80839
- markEntityNameOrEntityExpressionAsReference(entityName);
80870
+ markEntityNameOrEntityExpressionAsReference(entityName, /*forDecoratorMetadata*/ true);
80840
80871
  }
80841
80872
  }
80842
80873
  function getEntityNameForDecoratorMetadata(node) {
@@ -84488,7 +84519,7 @@ var ts;
84488
84519
  // If we hit an export in an illegal context, just bail out to avoid cascading errors.
84489
84520
  return;
84490
84521
  }
84491
- if (!checkGrammarDecoratorsAndModifiers(node) && ts.hasEffectiveModifiers(node)) {
84522
+ if (!checkGrammarDecoratorsAndModifiers(node) && ts.hasSyntacticModifiers(node)) {
84492
84523
  grammarErrorOnFirstToken(node, ts.Diagnostics.An_export_declaration_cannot_have_modifiers);
84493
84524
  }
84494
84525
  if (node.moduleSpecifier && node.exportClause && ts.isNamedExports(node.exportClause) && ts.length(node.exportClause.elements) && languageVersion === 0 /* ES3 */) {
@@ -87665,10 +87696,9 @@ var ts;
87665
87696
  }
87666
87697
  var parent = ts.walkUpParenthesizedTypes(node.parent);
87667
87698
  if (ts.isInJSFile(parent) && ts.isJSDocTypeExpression(parent)) {
87668
- parent = parent.parent;
87669
- if (ts.isJSDocTypeTag(parent)) {
87670
- // walk up past JSDoc comment node
87671
- parent = parent.parent.parent;
87699
+ var host_2 = ts.getJSDocHost(parent);
87700
+ if (host_2) {
87701
+ parent = ts.getSingleVariableOfVariableStatement(host_2) || host_2;
87672
87702
  }
87673
87703
  }
87674
87704
  switch (parent.kind) {
@@ -130903,14 +130933,15 @@ var ts;
130903
130933
  SortText["SuggestedClassMembers"] = "14";
130904
130934
  SortText["GlobalsOrKeywords"] = "15";
130905
130935
  SortText["AutoImportSuggestions"] = "16";
130906
- SortText["JavascriptIdentifiers"] = "17";
130907
- SortText["DeprecatedLocalDeclarationPriority"] = "18";
130908
- SortText["DeprecatedLocationPriority"] = "19";
130909
- SortText["DeprecatedOptionalMember"] = "20";
130910
- SortText["DeprecatedMemberDeclaredBySpreadAssignment"] = "21";
130911
- SortText["DeprecatedSuggestedClassMembers"] = "22";
130912
- SortText["DeprecatedGlobalsOrKeywords"] = "23";
130913
- SortText["DeprecatedAutoImportSuggestions"] = "24";
130936
+ SortText["ClassMemberSnippets"] = "17";
130937
+ SortText["JavascriptIdentifiers"] = "18";
130938
+ SortText["DeprecatedLocalDeclarationPriority"] = "19";
130939
+ SortText["DeprecatedLocationPriority"] = "20";
130940
+ SortText["DeprecatedOptionalMember"] = "21";
130941
+ SortText["DeprecatedMemberDeclaredBySpreadAssignment"] = "22";
130942
+ SortText["DeprecatedSuggestedClassMembers"] = "23";
130943
+ SortText["DeprecatedGlobalsOrKeywords"] = "24";
130944
+ SortText["DeprecatedAutoImportSuggestions"] = "25";
130914
130945
  })(SortText = Completions.SortText || (Completions.SortText = {}));
130915
130946
  var SortTextId;
130916
130947
  (function (SortTextId) {
@@ -130922,10 +130953,10 @@ var ts;
130922
130953
  SortTextId[SortTextId["GlobalsOrKeywords"] = 15] = "GlobalsOrKeywords";
130923
130954
  SortTextId[SortTextId["AutoImportSuggestions"] = 16] = "AutoImportSuggestions";
130924
130955
  // Don't use these directly.
130925
- SortTextId[SortTextId["_JavaScriptIdentifiers"] = 17] = "_JavaScriptIdentifiers";
130926
- SortTextId[SortTextId["_DeprecatedStart"] = 18] = "_DeprecatedStart";
130956
+ SortTextId[SortTextId["_JavaScriptIdentifiers"] = 18] = "_JavaScriptIdentifiers";
130957
+ SortTextId[SortTextId["_DeprecatedStart"] = 19] = "_DeprecatedStart";
130927
130958
  SortTextId[SortTextId["_First"] = 10] = "_First";
130928
- SortTextId[SortTextId["DeprecatedOffset"] = 8] = "DeprecatedOffset";
130959
+ SortTextId[SortTextId["DeprecatedOffset"] = 9] = "DeprecatedOffset";
130929
130960
  })(SortTextId || (SortTextId = {}));
130930
130961
  /**
130931
130962
  * Special values for `CompletionInfo['source']` used to disambiguate
@@ -131406,6 +131437,7 @@ var ts;
131406
131437
  isClassLikeMemberCompletion(symbol, location)) {
131407
131438
  var importAdder = void 0;
131408
131439
  (_b = getEntryForMemberCompletion(host, program, options, preferences, name, symbol, location, contextToken, formatContext), insertText = _b.insertText, isSnippet = _b.isSnippet, importAdder = _b.importAdder, replacementSpan = _b.replacementSpan);
131440
+ sortText = SortText.ClassMemberSnippets; // sortText has to be lower priority than the sortText for keywords. See #47852.
131409
131441
  if (importAdder === null || importAdder === void 0 ? void 0 : importAdder.hasFixes()) {
131410
131442
  hasAction = true;
131411
131443
  source = CompletionSource.ClassMemberSnippet;
@@ -131769,7 +131801,7 @@ var ts;
131769
131801
  }
131770
131802
  var name = info.name, needsConvertPropertyAccess = info.needsConvertPropertyAccess;
131771
131803
  var sortTextId = (_a = symbolToSortTextIdMap === null || symbolToSortTextIdMap === void 0 ? void 0 : symbolToSortTextIdMap[ts.getSymbolId(symbol)]) !== null && _a !== void 0 ? _a : 11 /* LocationPriority */;
131772
- var sortText = (isDeprecated(symbol, typeChecker) ? 8 /* DeprecatedOffset */ + sortTextId : sortTextId).toString();
131804
+ var sortText = (isDeprecated(symbol, typeChecker) ? 9 /* DeprecatedOffset */ + sortTextId : sortTextId).toString();
131773
131805
  var entry = createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, sourceFile, host, program, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, importCompletionNode, useSemicolons, compilerOptions, preferences, kind, formatContext, isJsxIdentifierExpected, isRightOfOpenTag);
131774
131806
  if (!entry) {
131775
131807
  continue;
@@ -143009,7 +143041,7 @@ var ts;
143009
143041
  if (!typeDisplayString) {
143010
143042
  continue;
143011
143043
  }
143012
- addTypeHints(typeDisplayString, param.name.end);
143044
+ addTypeHints(typeDisplayString, param.questionToken ? param.questionToken.end : param.name.end);
143013
143045
  }
143014
143046
  }
143015
143047
  function getParameterDeclarationTypeDisplayString(symbol) {
@@ -154188,6 +154220,74 @@ var ts;
154188
154220
  })(ts || (ts = {}));
154189
154221
  /* @internal */
154190
154222
  var ts;
154223
+ (function (ts) {
154224
+ var codefix;
154225
+ (function (codefix) {
154226
+ var fixId = "fixUnreferenceableDecoratorMetadata";
154227
+ var errorCodes = [ts.Diagnostics.A_type_referenced_in_a_decorated_signature_must_be_imported_with_import_type_or_a_namespace_import_when_isolatedModules_and_emitDecoratorMetadata_are_enabled.code];
154228
+ codefix.registerCodeFix({
154229
+ errorCodes: errorCodes,
154230
+ getCodeActions: function (context) {
154231
+ var importDeclaration = getImportDeclaration(context.sourceFile, context.program, context.span.start);
154232
+ if (!importDeclaration)
154233
+ return;
154234
+ var namespaceChanges = ts.textChanges.ChangeTracker.with(context, function (t) { return importDeclaration.kind === 269 /* ImportSpecifier */ && doNamespaceImportChange(t, context.sourceFile, importDeclaration, context.program); });
154235
+ var typeOnlyChanges = ts.textChanges.ChangeTracker.with(context, function (t) { return doTypeOnlyImportChange(t, context.sourceFile, importDeclaration, context.program); });
154236
+ var actions;
154237
+ if (namespaceChanges.length) {
154238
+ actions = ts.append(actions, codefix.createCodeFixActionWithoutFixAll(fixId, namespaceChanges, ts.Diagnostics.Convert_named_imports_to_namespace_import));
154239
+ }
154240
+ if (typeOnlyChanges.length) {
154241
+ actions = ts.append(actions, codefix.createCodeFixActionWithoutFixAll(fixId, typeOnlyChanges, ts.Diagnostics.Convert_to_type_only_import));
154242
+ }
154243
+ return actions;
154244
+ },
154245
+ fixIds: [fixId],
154246
+ });
154247
+ function getImportDeclaration(sourceFile, program, start) {
154248
+ var identifier = ts.tryCast(ts.getTokenAtPosition(sourceFile, start), ts.isIdentifier);
154249
+ if (!identifier || identifier.parent.kind !== 177 /* TypeReference */)
154250
+ return;
154251
+ var checker = program.getTypeChecker();
154252
+ var symbol = checker.getSymbolAtLocation(identifier);
154253
+ return ts.find((symbol === null || symbol === void 0 ? void 0 : symbol.declarations) || ts.emptyArray, ts.or(ts.isImportClause, ts.isImportSpecifier, ts.isImportEqualsDeclaration));
154254
+ }
154255
+ // Converts the import declaration of the offending import to a type-only import,
154256
+ // only if it can be done without affecting other imported names. If the conversion
154257
+ // cannot be done cleanly, we could offer to *extract* the offending import to a
154258
+ // new type-only import declaration, but honestly I doubt anyone will ever use this
154259
+ // codefix at all, so it's probably not worth the lines of code.
154260
+ function doTypeOnlyImportChange(changes, sourceFile, importDeclaration, program) {
154261
+ if (importDeclaration.kind === 264 /* ImportEqualsDeclaration */) {
154262
+ changes.insertModifierBefore(sourceFile, 151 /* TypeKeyword */, importDeclaration.name);
154263
+ return;
154264
+ }
154265
+ var importClause = importDeclaration.kind === 266 /* ImportClause */ ? importDeclaration : importDeclaration.parent.parent;
154266
+ if (importClause.name && importClause.namedBindings) {
154267
+ // Cannot convert an import with a default import and named bindings to type-only
154268
+ // (it's a grammar error).
154269
+ return;
154270
+ }
154271
+ var checker = program.getTypeChecker();
154272
+ var importsValue = !!ts.forEachImportClauseDeclaration(importClause, function (decl) {
154273
+ if (ts.skipAlias(decl.symbol, checker).flags & 111551 /* Value */)
154274
+ return true;
154275
+ });
154276
+ if (importsValue) {
154277
+ // Assume that if someone wrote a non-type-only import that includes some values,
154278
+ // they intend to use those values in value positions, even if they haven't yet.
154279
+ // Don't convert it to type-only.
154280
+ return;
154281
+ }
154282
+ changes.insertModifierBefore(sourceFile, 151 /* TypeKeyword */, importClause);
154283
+ }
154284
+ function doNamespaceImportChange(changes, sourceFile, importDeclaration, program) {
154285
+ ts.refactor.doChangeNamedToNamespaceOrDefault(sourceFile, program, changes, importDeclaration.parent);
154286
+ }
154287
+ })(codefix = ts.codefix || (ts.codefix = {}));
154288
+ })(ts || (ts = {}));
154289
+ /* @internal */
154290
+ var ts;
154191
154291
  (function (ts) {
154192
154292
  var codefix;
154193
154293
  (function (codefix) {
@@ -156755,6 +156855,7 @@ var ts;
156755
156855
  return codefix.createCodeFixAction(fixName, changes, [ts.Diagnostics.Add_definite_assignment_assertion_to_property_0, info.prop.getText()], fixIdAddDefiniteAssignmentAssertions, ts.Diagnostics.Add_definite_assignment_assertions_to_all_uninitialized_properties);
156756
156856
  }
156757
156857
  function addDefiniteAssignmentAssertion(changeTracker, propertyDeclarationSourceFile, propertyDeclaration) {
156858
+ ts.suppressLeadingAndTrailingTrivia(propertyDeclaration);
156758
156859
  var property = ts.factory.updatePropertyDeclaration(propertyDeclaration, propertyDeclaration.decorators, propertyDeclaration.modifiers, propertyDeclaration.name, ts.factory.createToken(53 /* ExclamationToken */), propertyDeclaration.type, propertyDeclaration.initializer);
156759
156860
  changeTracker.replaceNode(propertyDeclarationSourceFile, propertyDeclaration, property);
156760
156861
  }
@@ -156784,6 +156885,7 @@ var ts;
156784
156885
  return codefix.createCodeFixAction(fixName, changes, [ts.Diagnostics.Add_initializer_to_property_0, info.prop.name.getText()], fixIdAddInitializer, ts.Diagnostics.Add_initializers_to_all_uninitialized_properties);
156785
156886
  }
156786
156887
  function addInitializer(changeTracker, propertyDeclarationSourceFile, propertyDeclaration, initializer) {
156888
+ ts.suppressLeadingAndTrailingTrivia(propertyDeclaration);
156787
156889
  var property = ts.factory.updatePropertyDeclaration(propertyDeclaration, propertyDeclaration.decorators, propertyDeclaration.modifiers, propertyDeclaration.name, propertyDeclaration.questionToken, propertyDeclaration.type, initializer);
156788
156890
  changeTracker.replaceNode(propertyDeclarationSourceFile, propertyDeclaration, property);
156789
156891
  }
@@ -157707,20 +157809,22 @@ var ts;
157707
157809
  if (importClause.namedBindings.kind === 267 /* NamespaceImport */) {
157708
157810
  return { convertTo: 0 /* Named */, import: importClause.namedBindings };
157709
157811
  }
157710
- var compilerOptions = context.program.getCompilerOptions();
157711
- var shouldUseDefault = ts.getAllowSyntheticDefaultImports(compilerOptions)
157712
- && isExportEqualsModule(importClause.parent.moduleSpecifier, context.program.getTypeChecker());
157812
+ var shouldUseDefault = getShouldUseDefault(context.program, importClause);
157713
157813
  return shouldUseDefault
157714
157814
  ? { convertTo: 1 /* Default */, import: importClause.namedBindings }
157715
157815
  : { convertTo: 2 /* Namespace */, import: importClause.namedBindings };
157716
157816
  }
157817
+ function getShouldUseDefault(program, importClause) {
157818
+ return ts.getAllowSyntheticDefaultImports(program.getCompilerOptions())
157819
+ && isExportEqualsModule(importClause.parent.moduleSpecifier, program.getTypeChecker());
157820
+ }
157717
157821
  function doChange(sourceFile, program, changes, info) {
157718
157822
  var checker = program.getTypeChecker();
157719
157823
  if (info.convertTo === 0 /* Named */) {
157720
157824
  doChangeNamespaceToNamed(sourceFile, checker, changes, info.import, ts.getAllowSyntheticDefaultImports(program.getCompilerOptions()));
157721
157825
  }
157722
157826
  else {
157723
- doChangeNamedToNamespaceOrDefault(sourceFile, checker, changes, info.import, info.convertTo === 1 /* Default */);
157827
+ doChangeNamedToNamespaceOrDefault(sourceFile, program, changes, info.import, info.convertTo === 1 /* Default */);
157724
157828
  }
157725
157829
  }
157726
157830
  function doChangeNamespaceToNamed(sourceFile, checker, changes, toConvert, allowSyntheticDefaultImports) {
@@ -157770,7 +157874,9 @@ var ts;
157770
157874
  function getLeftOfPropertyAccessOrQualifiedName(propertyAccessOrQualifiedName) {
157771
157875
  return ts.isPropertyAccessExpression(propertyAccessOrQualifiedName) ? propertyAccessOrQualifiedName.expression : propertyAccessOrQualifiedName.left;
157772
157876
  }
157773
- function doChangeNamedToNamespaceOrDefault(sourceFile, checker, changes, toConvert, shouldUseDefault) {
157877
+ function doChangeNamedToNamespaceOrDefault(sourceFile, program, changes, toConvert, shouldUseDefault) {
157878
+ if (shouldUseDefault === void 0) { shouldUseDefault = getShouldUseDefault(program, toConvert.parent); }
157879
+ var checker = program.getTypeChecker();
157774
157880
  var importDecl = toConvert.parent.parent;
157775
157881
  var moduleSpecifier = importDecl.moduleSpecifier;
157776
157882
  var toConvertSymbols = new ts.Set();
@@ -157831,6 +157937,7 @@ var ts;
157831
157937
  changes.insertNodeAfter(sourceFile, toConvert.parent.parent, updateImport(importDecl, /*defaultImportName*/ undefined, newNamedImports));
157832
157938
  }
157833
157939
  }
157940
+ refactor.doChangeNamedToNamespaceOrDefault = doChangeNamedToNamespaceOrDefault;
157834
157941
  function isExportEqualsModule(moduleSpecifier, checker) {
157835
157942
  var externalModule = checker.resolveExternalModuleName(moduleSpecifier);
157836
157943
  if (!externalModule)
@@ -159231,7 +159338,9 @@ var ts;
159231
159338
  var checker = context.program.getTypeChecker();
159232
159339
  // Make a unique name for the extracted variable
159233
159340
  var file = scope.getSourceFile();
159234
- var localNameText = ts.getUniqueName(ts.isClassLike(scope) ? "newProperty" : "newLocal", file);
159341
+ var localNameText = ts.isPropertyAccessExpression(node) && !ts.isClassLike(scope) && !checker.resolveName(node.name.text, node, 111551 /* Value */, /*excludeGlobals*/ false) && !ts.isPrivateIdentifier(node.name) && !ts.isKeyword(node.name.originalKeywordKind)
159342
+ ? node.name.text
159343
+ : ts.getUniqueName(ts.isClassLike(scope) ? "newProperty" : "newLocal", file);
159235
159344
  var isJS = ts.isInJSFile(scope);
159236
159345
  var variableType = isJS || !checker.isContextSensitive(node)
159237
159346
  ? undefined
@@ -162998,10 +163107,12 @@ var ts;
162998
163107
  this.fileNameToEntry = new ts.Map();
162999
163108
  // Initialize the list with the root file names
163000
163109
  var rootFileNames = host.getScriptFileNames();
163110
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("session" /* Session */, "initializeHostCache", { count: rootFileNames.length });
163001
163111
  for (var _i = 0, rootFileNames_1 = rootFileNames; _i < rootFileNames_1.length; _i++) {
163002
163112
  var fileName = rootFileNames_1[_i];
163003
163113
  this.createEntry(fileName, ts.toPath(fileName, this.currentDirectory, getCanonicalFileName));
163004
163114
  }
163115
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
163005
163116
  }
163006
163117
  HostCache.prototype.createEntry = function (fileName, path) {
163007
163118
  var entry;