typescript 4.7.0-dev.20220317 → 4.7.0-dev.20220320

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.20220317";
297
+ ts.version = ts.versionMajorMinor + ".0-dev.20220320";
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*/
@@ -80826,20 +80830,31 @@ var ts;
80826
80830
  * marked as referenced to prevent import elision.
80827
80831
  */
80828
80832
  function markTypeNodeAsReferenced(node) {
80829
- markEntityNameOrEntityExpressionAsReference(node && ts.getEntityNameFromTypeNode(node));
80833
+ markEntityNameOrEntityExpressionAsReference(node && ts.getEntityNameFromTypeNode(node), /*forDecoratorMetadata*/ false);
80830
80834
  }
80831
- function markEntityNameOrEntityExpressionAsReference(typeName) {
80835
+ function markEntityNameOrEntityExpressionAsReference(typeName, forDecoratorMetadata) {
80832
80836
  if (!typeName)
80833
80837
  return;
80834
80838
  var rootName = ts.getFirstIdentifier(typeName);
80835
80839
  var meaning = (typeName.kind === 79 /* Identifier */ ? 788968 /* Type */ : 1920 /* Namespace */) | 2097152 /* Alias */;
80836
80840
  var rootSymbol = resolveName(rootName, rootName.escapedText, meaning, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isReference*/ true);
80837
- if (rootSymbol
80838
- && rootSymbol.flags & 2097152 /* Alias */
80839
- && symbolIsValue(rootSymbol)
80840
- && !isConstEnumOrConstEnumOnlyModule(resolveAlias(rootSymbol))
80841
- && !getTypeOnlyAliasDeclaration(rootSymbol)) {
80842
- 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
+ }
80843
80858
  }
80844
80859
  }
80845
80860
  /**
@@ -80852,7 +80867,7 @@ var ts;
80852
80867
  function markDecoratorMedataDataTypeNodeAsReferenced(node) {
80853
80868
  var entityName = getEntityNameForDecoratorMetadata(node);
80854
80869
  if (entityName && ts.isEntityName(entityName)) {
80855
- markEntityNameOrEntityExpressionAsReference(entityName);
80870
+ markEntityNameOrEntityExpressionAsReference(entityName, /*forDecoratorMetadata*/ true);
80856
80871
  }
80857
80872
  }
80858
80873
  function getEntityNameForDecoratorMetadata(node) {
@@ -84504,7 +84519,7 @@ var ts;
84504
84519
  // If we hit an export in an illegal context, just bail out to avoid cascading errors.
84505
84520
  return;
84506
84521
  }
84507
- if (!checkGrammarDecoratorsAndModifiers(node) && ts.hasEffectiveModifiers(node)) {
84522
+ if (!checkGrammarDecoratorsAndModifiers(node) && ts.hasSyntacticModifiers(node)) {
84508
84523
  grammarErrorOnFirstToken(node, ts.Diagnostics.An_export_declaration_cannot_have_modifiers);
84509
84524
  }
84510
84525
  if (node.moduleSpecifier && node.exportClause && ts.isNamedExports(node.exportClause) && ts.length(node.exportClause.elements) && languageVersion === 0 /* ES3 */) {
@@ -154205,6 +154220,74 @@ var ts;
154205
154220
  })(ts || (ts = {}));
154206
154221
  /* @internal */
154207
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;
154208
154291
  (function (ts) {
154209
154292
  var codefix;
154210
154293
  (function (codefix) {
@@ -156772,6 +156855,7 @@ var ts;
156772
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);
156773
156856
  }
156774
156857
  function addDefiniteAssignmentAssertion(changeTracker, propertyDeclarationSourceFile, propertyDeclaration) {
156858
+ ts.suppressLeadingAndTrailingTrivia(propertyDeclaration);
156775
156859
  var property = ts.factory.updatePropertyDeclaration(propertyDeclaration, propertyDeclaration.decorators, propertyDeclaration.modifiers, propertyDeclaration.name, ts.factory.createToken(53 /* ExclamationToken */), propertyDeclaration.type, propertyDeclaration.initializer);
156776
156860
  changeTracker.replaceNode(propertyDeclarationSourceFile, propertyDeclaration, property);
156777
156861
  }
@@ -156801,6 +156885,7 @@ var ts;
156801
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);
156802
156886
  }
156803
156887
  function addInitializer(changeTracker, propertyDeclarationSourceFile, propertyDeclaration, initializer) {
156888
+ ts.suppressLeadingAndTrailingTrivia(propertyDeclaration);
156804
156889
  var property = ts.factory.updatePropertyDeclaration(propertyDeclaration, propertyDeclaration.decorators, propertyDeclaration.modifiers, propertyDeclaration.name, propertyDeclaration.questionToken, propertyDeclaration.type, initializer);
156805
156890
  changeTracker.replaceNode(propertyDeclarationSourceFile, propertyDeclaration, property);
156806
156891
  }
@@ -157724,20 +157809,22 @@ var ts;
157724
157809
  if (importClause.namedBindings.kind === 267 /* NamespaceImport */) {
157725
157810
  return { convertTo: 0 /* Named */, import: importClause.namedBindings };
157726
157811
  }
157727
- var compilerOptions = context.program.getCompilerOptions();
157728
- var shouldUseDefault = ts.getAllowSyntheticDefaultImports(compilerOptions)
157729
- && isExportEqualsModule(importClause.parent.moduleSpecifier, context.program.getTypeChecker());
157812
+ var shouldUseDefault = getShouldUseDefault(context.program, importClause);
157730
157813
  return shouldUseDefault
157731
157814
  ? { convertTo: 1 /* Default */, import: importClause.namedBindings }
157732
157815
  : { convertTo: 2 /* Namespace */, import: importClause.namedBindings };
157733
157816
  }
157817
+ function getShouldUseDefault(program, importClause) {
157818
+ return ts.getAllowSyntheticDefaultImports(program.getCompilerOptions())
157819
+ && isExportEqualsModule(importClause.parent.moduleSpecifier, program.getTypeChecker());
157820
+ }
157734
157821
  function doChange(sourceFile, program, changes, info) {
157735
157822
  var checker = program.getTypeChecker();
157736
157823
  if (info.convertTo === 0 /* Named */) {
157737
157824
  doChangeNamespaceToNamed(sourceFile, checker, changes, info.import, ts.getAllowSyntheticDefaultImports(program.getCompilerOptions()));
157738
157825
  }
157739
157826
  else {
157740
- doChangeNamedToNamespaceOrDefault(sourceFile, checker, changes, info.import, info.convertTo === 1 /* Default */);
157827
+ doChangeNamedToNamespaceOrDefault(sourceFile, program, changes, info.import, info.convertTo === 1 /* Default */);
157741
157828
  }
157742
157829
  }
157743
157830
  function doChangeNamespaceToNamed(sourceFile, checker, changes, toConvert, allowSyntheticDefaultImports) {
@@ -157787,7 +157874,9 @@ var ts;
157787
157874
  function getLeftOfPropertyAccessOrQualifiedName(propertyAccessOrQualifiedName) {
157788
157875
  return ts.isPropertyAccessExpression(propertyAccessOrQualifiedName) ? propertyAccessOrQualifiedName.expression : propertyAccessOrQualifiedName.left;
157789
157876
  }
157790
- 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();
157791
157880
  var importDecl = toConvert.parent.parent;
157792
157881
  var moduleSpecifier = importDecl.moduleSpecifier;
157793
157882
  var toConvertSymbols = new ts.Set();
@@ -157848,6 +157937,7 @@ var ts;
157848
157937
  changes.insertNodeAfter(sourceFile, toConvert.parent.parent, updateImport(importDecl, /*defaultImportName*/ undefined, newNamedImports));
157849
157938
  }
157850
157939
  }
157940
+ refactor.doChangeNamedToNamespaceOrDefault = doChangeNamedToNamespaceOrDefault;
157851
157941
  function isExportEqualsModule(moduleSpecifier, checker) {
157852
157942
  var externalModule = checker.resolveExternalModuleName(moduleSpecifier);
157853
157943
  if (!externalModule)
@@ -159248,7 +159338,9 @@ var ts;
159248
159338
  var checker = context.program.getTypeChecker();
159249
159339
  // Make a unique name for the extracted variable
159250
159340
  var file = scope.getSourceFile();
159251
- 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);
159252
159344
  var isJS = ts.isInJSFile(scope);
159253
159345
  var variableType = isJS || !checker.isContextSensitive(node)
159254
159346
  ? undefined
@@ -163015,10 +163107,12 @@ var ts;
163015
163107
  this.fileNameToEntry = new ts.Map();
163016
163108
  // Initialize the list with the root file names
163017
163109
  var rootFileNames = host.getScriptFileNames();
163110
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("session" /* Session */, "initializeHostCache", { count: rootFileNames.length });
163018
163111
  for (var _i = 0, rootFileNames_1 = rootFileNames; _i < rootFileNames_1.length; _i++) {
163019
163112
  var fileName = rootFileNames_1[_i];
163020
163113
  this.createEntry(fileName, ts.toPath(fileName, this.currentDirectory, getCanonicalFileName));
163021
163114
  }
163115
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
163022
163116
  }
163023
163117
  HostCache.prototype.createEntry = function (fileName, path) {
163024
163118
  var entry;
@@ -89,7 +89,7 @@ var ts;
89
89
  // The following is baselined as a literal template type without intervention
90
90
  /** The version of the TypeScript compiler release */
91
91
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
92
- ts.version = ts.versionMajorMinor + ".0-dev.20220317";
92
+ ts.version = ts.versionMajorMinor + ".0-dev.20220320";
93
93
  /* @internal */
94
94
  var Comparison;
95
95
  (function (Comparison) {
@@ -8239,6 +8239,7 @@ var ts;
8239
8239
  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."),
8240
8240
  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}'."),
8241
8241
  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'."),
8242
+ 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."),
8242
8243
  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."),
8243
8244
  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."),
8244
8245
  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."),
@@ -40884,7 +40885,10 @@ var ts;
40884
40885
  * file to. e.g. outDir
40885
40886
  */
40886
40887
  function parseJsonSourceFileConfigFileContent(sourceFile, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions, extendedConfigCache, existingWatchOptions) {
40887
- return parseJsonConfigFileContentWorker(/*json*/ undefined, sourceFile, host, basePath, existingOptions, existingWatchOptions, configFileName, resolutionStack, extraFileExtensions, extendedConfigCache);
40888
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("parse" /* Parse */, "parseJsonSourceFileConfigFileContent", { path: sourceFile.fileName });
40889
+ var result = parseJsonConfigFileContentWorker(/*json*/ undefined, sourceFile, host, basePath, existingOptions, existingWatchOptions, configFileName, resolutionStack, extraFileExtensions, extendedConfigCache);
40890
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
40891
+ return result;
40888
40892
  }
40889
40893
  ts.parseJsonSourceFileConfigFileContent = parseJsonSourceFileConfigFileContent;
40890
40894
  /*@internal*/
@@ -80621,20 +80625,31 @@ var ts;
80621
80625
  * marked as referenced to prevent import elision.
80622
80626
  */
80623
80627
  function markTypeNodeAsReferenced(node) {
80624
- markEntityNameOrEntityExpressionAsReference(node && ts.getEntityNameFromTypeNode(node));
80628
+ markEntityNameOrEntityExpressionAsReference(node && ts.getEntityNameFromTypeNode(node), /*forDecoratorMetadata*/ false);
80625
80629
  }
80626
- function markEntityNameOrEntityExpressionAsReference(typeName) {
80630
+ function markEntityNameOrEntityExpressionAsReference(typeName, forDecoratorMetadata) {
80627
80631
  if (!typeName)
80628
80632
  return;
80629
80633
  var rootName = ts.getFirstIdentifier(typeName);
80630
80634
  var meaning = (typeName.kind === 79 /* Identifier */ ? 788968 /* Type */ : 1920 /* Namespace */) | 2097152 /* Alias */;
80631
80635
  var rootSymbol = resolveName(rootName, rootName.escapedText, meaning, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isReference*/ true);
80632
- if (rootSymbol
80633
- && rootSymbol.flags & 2097152 /* Alias */
80634
- && symbolIsValue(rootSymbol)
80635
- && !isConstEnumOrConstEnumOnlyModule(resolveAlias(rootSymbol))
80636
- && !getTypeOnlyAliasDeclaration(rootSymbol)) {
80637
- markAliasSymbolAsReferenced(rootSymbol);
80636
+ if (rootSymbol && rootSymbol.flags & 2097152 /* Alias */) {
80637
+ if (symbolIsValue(rootSymbol)
80638
+ && !isConstEnumOrConstEnumOnlyModule(resolveAlias(rootSymbol))
80639
+ && !getTypeOnlyAliasDeclaration(rootSymbol)) {
80640
+ markAliasSymbolAsReferenced(rootSymbol);
80641
+ }
80642
+ else if (forDecoratorMetadata
80643
+ && compilerOptions.isolatedModules
80644
+ && ts.getEmitModuleKind(compilerOptions) >= ts.ModuleKind.ES2015
80645
+ && !symbolIsValue(rootSymbol)
80646
+ && !ts.some(rootSymbol.declarations, ts.isTypeOnlyImportOrExportDeclaration)) {
80647
+ 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);
80648
+ var aliasDeclaration = ts.find(rootSymbol.declarations || ts.emptyArray, isAliasSymbolDeclaration);
80649
+ if (aliasDeclaration) {
80650
+ ts.addRelatedInfo(diag, ts.createDiagnosticForNode(aliasDeclaration, ts.Diagnostics._0_was_imported_here, ts.idText(rootName)));
80651
+ }
80652
+ }
80638
80653
  }
80639
80654
  }
80640
80655
  /**
@@ -80647,7 +80662,7 @@ var ts;
80647
80662
  function markDecoratorMedataDataTypeNodeAsReferenced(node) {
80648
80663
  var entityName = getEntityNameForDecoratorMetadata(node);
80649
80664
  if (entityName && ts.isEntityName(entityName)) {
80650
- markEntityNameOrEntityExpressionAsReference(entityName);
80665
+ markEntityNameOrEntityExpressionAsReference(entityName, /*forDecoratorMetadata*/ true);
80651
80666
  }
80652
80667
  }
80653
80668
  function getEntityNameForDecoratorMetadata(node) {
@@ -84299,7 +84314,7 @@ var ts;
84299
84314
  // If we hit an export in an illegal context, just bail out to avoid cascading errors.
84300
84315
  return;
84301
84316
  }
84302
- if (!checkGrammarDecoratorsAndModifiers(node) && ts.hasEffectiveModifiers(node)) {
84317
+ if (!checkGrammarDecoratorsAndModifiers(node) && ts.hasSyntacticModifiers(node)) {
84303
84318
  grammarErrorOnFirstToken(node, ts.Diagnostics.An_export_declaration_cannot_have_modifiers);
84304
84319
  }
84305
84320
  if (node.moduleSpecifier && node.exportClause && ts.isNamedExports(node.exportClause) && ts.length(node.exportClause.elements) && languageVersion === 0 /* ES3 */) {
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "typescript",
3
3
  "author": "Microsoft Corp.",
4
4
  "homepage": "https://www.typescriptlang.org/",
5
- "version": "4.7.0-dev.20220317",
5
+ "version": "4.7.0-dev.20220320",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [