@typescript-deploys/pr-build 4.7.0-pr-48294-7 → 4.7.0-pr-36747-12

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/tsc.js CHANGED
@@ -69,7 +69,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
69
69
  var ts;
70
70
  (function (ts) {
71
71
  ts.versionMajorMinor = "4.7";
72
- ts.version = ts.versionMajorMinor + ".0-insiders.20220316";
72
+ ts.version = ts.versionMajorMinor + ".0-insiders.20220321";
73
73
  var NativeCollections;
74
74
  (function (NativeCollections) {
75
75
  var globals = typeof globalThis !== "undefined" ? globalThis :
@@ -5437,6 +5437,7 @@ var ts;
5437
5437
  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."),
5438
5438
  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}'."),
5439
5439
  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'."),
5440
+ 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."),
5440
5441
  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."),
5441
5442
  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."),
5442
5443
  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."),
@@ -33318,7 +33319,10 @@ var ts;
33318
33319
  }
33319
33320
  ts.parseJsonConfigFileContent = parseJsonConfigFileContent;
33320
33321
  function parseJsonSourceFileConfigFileContent(sourceFile, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions, extendedConfigCache, existingWatchOptions) {
33321
- return parseJsonConfigFileContentWorker(undefined, sourceFile, host, basePath, existingOptions, existingWatchOptions, configFileName, resolutionStack, extraFileExtensions, extendedConfigCache);
33322
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("parse", "parseJsonSourceFileConfigFileContent", { path: sourceFile.fileName });
33323
+ var result = parseJsonConfigFileContentWorker(undefined, sourceFile, host, basePath, existingOptions, existingWatchOptions, configFileName, resolutionStack, extraFileExtensions, extendedConfigCache);
33324
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
33325
+ return result;
33322
33326
  }
33323
33327
  ts.parseJsonSourceFileConfigFileContent = parseJsonSourceFileConfigFileContent;
33324
33328
  function setConfigFileInOptions(options, configFile) {
@@ -38817,7 +38821,7 @@ var ts;
38817
38821
  (preserveConstEnums && moduleState === 2);
38818
38822
  }
38819
38823
  ts.isInstantiatedModule = isInstantiatedModule;
38820
- function createTypeChecker(host, produceDiagnostics) {
38824
+ function createTypeChecker(host) {
38821
38825
  var getPackagesMap = ts.memoize(function () {
38822
38826
  var map = new ts.Map();
38823
38827
  host.getSourceFiles().forEach(function (sf) {
@@ -38830,6 +38834,10 @@ var ts;
38830
38834
  });
38831
38835
  return map;
38832
38836
  });
38837
+ var deferredDiagnosticsCallbacks = [];
38838
+ var addLazyDiagnostic = function (arg) {
38839
+ deferredDiagnosticsCallbacks.push(arg);
38840
+ };
38833
38841
  var cancellationToken;
38834
38842
  var requestedExternalEmitHelpers;
38835
38843
  var externalHelpersModule;
@@ -39171,7 +39179,7 @@ var ts;
39171
39179
  var diagnostics;
39172
39180
  try {
39173
39181
  cancellationToken = ct;
39174
- checkSourceFile(file);
39182
+ checkSourceFileWithEagerDiagnostics(file);
39175
39183
  ts.Debug.assert(!!(getNodeLinks(file).flags & 1));
39176
39184
  diagnostics = ts.addRange(diagnostics, suggestionDiagnostics.getDiagnostics(file.fileName));
39177
39185
  checkUnusedIdentifiers(getPotentiallyUnusedIdentifiers(file), function (containingNode, kind, diag) {
@@ -40324,91 +40332,95 @@ var ts;
40324
40332
  }
40325
40333
  }
40326
40334
  if (!result) {
40327
- if (nameNotFoundMessage && produceDiagnostics) {
40328
- if (!errorLocation ||
40329
- !checkAndReportErrorForMissingPrefix(errorLocation, name, nameArg) &&
40330
- !checkAndReportErrorForExtendingInterface(errorLocation) &&
40331
- !checkAndReportErrorForUsingTypeAsNamespace(errorLocation, name, meaning) &&
40332
- !checkAndReportErrorForExportingPrimitiveType(errorLocation, name) &&
40333
- !checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning) &&
40334
- !checkAndReportErrorForUsingNamespaceModuleAsValue(errorLocation, name, meaning) &&
40335
- !checkAndReportErrorForUsingValueAsType(errorLocation, name, meaning)) {
40336
- var suggestion = void 0;
40337
- if (getSpellingSuggestions && suggestionCount < maximumSuggestionCount) {
40338
- suggestion = getSuggestedSymbolForNonexistentSymbol(originalLocation, name, meaning);
40339
- var isGlobalScopeAugmentationDeclaration = (suggestion === null || suggestion === void 0 ? void 0 : suggestion.valueDeclaration) && ts.isAmbientModule(suggestion.valueDeclaration) && ts.isGlobalScopeAugmentation(suggestion.valueDeclaration);
40340
- if (isGlobalScopeAugmentationDeclaration) {
40341
- suggestion = undefined;
40342
- }
40343
- if (suggestion) {
40344
- var suggestionName = symbolToString(suggestion);
40345
- var isUncheckedJS = isUncheckedJSSuggestion(originalLocation, suggestion, false);
40346
- var message = meaning === 1920 || nameArg && typeof nameArg !== "string" && ts.nodeIsSynthesized(nameArg) ? ts.Diagnostics.Cannot_find_namespace_0_Did_you_mean_1
40347
- : isUncheckedJS ? ts.Diagnostics.Could_not_find_name_0_Did_you_mean_1
40348
- : ts.Diagnostics.Cannot_find_name_0_Did_you_mean_1;
40349
- var diagnostic = createError(errorLocation, message, diagnosticName(nameArg), suggestionName);
40350
- addErrorOrSuggestion(!isUncheckedJS, diagnostic);
40351
- if (suggestion.valueDeclaration) {
40352
- ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(suggestion.valueDeclaration, ts.Diagnostics._0_is_declared_here, suggestionName));
40335
+ if (nameNotFoundMessage) {
40336
+ addLazyDiagnostic(function () {
40337
+ if (!errorLocation ||
40338
+ !checkAndReportErrorForMissingPrefix(errorLocation, name, nameArg) &&
40339
+ !checkAndReportErrorForExtendingInterface(errorLocation) &&
40340
+ !checkAndReportErrorForUsingTypeAsNamespace(errorLocation, name, meaning) &&
40341
+ !checkAndReportErrorForExportingPrimitiveType(errorLocation, name) &&
40342
+ !checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning) &&
40343
+ !checkAndReportErrorForUsingNamespaceModuleAsValue(errorLocation, name, meaning) &&
40344
+ !checkAndReportErrorForUsingValueAsType(errorLocation, name, meaning)) {
40345
+ var suggestion = void 0;
40346
+ if (getSpellingSuggestions && suggestionCount < maximumSuggestionCount) {
40347
+ suggestion = getSuggestedSymbolForNonexistentSymbol(originalLocation, name, meaning);
40348
+ var isGlobalScopeAugmentationDeclaration = (suggestion === null || suggestion === void 0 ? void 0 : suggestion.valueDeclaration) && ts.isAmbientModule(suggestion.valueDeclaration) && ts.isGlobalScopeAugmentation(suggestion.valueDeclaration);
40349
+ if (isGlobalScopeAugmentationDeclaration) {
40350
+ suggestion = undefined;
40353
40351
  }
40354
- }
40355
- }
40356
- if (!suggestion) {
40357
- if (nameArg) {
40358
- var lib = getSuggestedLibForNonExistentName(nameArg);
40359
- if (lib) {
40360
- error(errorLocation, nameNotFoundMessage, diagnosticName(nameArg), lib);
40352
+ if (suggestion) {
40353
+ var suggestionName = symbolToString(suggestion);
40354
+ var isUncheckedJS = isUncheckedJSSuggestion(originalLocation, suggestion, false);
40355
+ var message = meaning === 1920 || nameArg && typeof nameArg !== "string" && ts.nodeIsSynthesized(nameArg) ? ts.Diagnostics.Cannot_find_namespace_0_Did_you_mean_1
40356
+ : isUncheckedJS ? ts.Diagnostics.Could_not_find_name_0_Did_you_mean_1
40357
+ : ts.Diagnostics.Cannot_find_name_0_Did_you_mean_1;
40358
+ var diagnostic = createError(errorLocation, message, diagnosticName(nameArg), suggestionName);
40359
+ addErrorOrSuggestion(!isUncheckedJS, diagnostic);
40360
+ if (suggestion.valueDeclaration) {
40361
+ ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(suggestion.valueDeclaration, ts.Diagnostics._0_is_declared_here, suggestionName));
40362
+ }
40361
40363
  }
40362
- else {
40363
- error(errorLocation, nameNotFoundMessage, diagnosticName(nameArg));
40364
+ }
40365
+ if (!suggestion) {
40366
+ if (nameArg) {
40367
+ var lib = getSuggestedLibForNonExistentName(nameArg);
40368
+ if (lib) {
40369
+ error(errorLocation, nameNotFoundMessage, diagnosticName(nameArg), lib);
40370
+ }
40371
+ else {
40372
+ error(errorLocation, nameNotFoundMessage, diagnosticName(nameArg));
40373
+ }
40364
40374
  }
40365
40375
  }
40376
+ suggestionCount++;
40366
40377
  }
40367
- suggestionCount++;
40368
- }
40378
+ });
40369
40379
  }
40370
40380
  return undefined;
40371
40381
  }
40372
- if (nameNotFoundMessage && produceDiagnostics) {
40373
- if (propertyWithInvalidInitializer && !(ts.getEmitScriptTarget(compilerOptions) === 99 && useDefineForClassFields)) {
40374
- var propertyName = propertyWithInvalidInitializer.name;
40375
- error(errorLocation, ts.Diagnostics.Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor, ts.declarationNameToString(propertyName), diagnosticName(nameArg));
40376
- return undefined;
40377
- }
40378
- if (errorLocation &&
40379
- (meaning & 2 ||
40380
- ((meaning & 32 || meaning & 384) && (meaning & 111551) === 111551))) {
40381
- var exportOrLocalSymbol = getExportSymbolOfValueSymbolIfExported(result);
40382
- if (exportOrLocalSymbol.flags & 2 || exportOrLocalSymbol.flags & 32 || exportOrLocalSymbol.flags & 384) {
40383
- checkResolvedBlockScopedVariable(exportOrLocalSymbol, errorLocation);
40384
- }
40385
- }
40386
- if (result && isInExternalModule && (meaning & 111551) === 111551 && !(originalLocation.flags & 4194304)) {
40387
- var merged = getMergedSymbol(result);
40388
- if (ts.length(merged.declarations) && ts.every(merged.declarations, function (d) { return ts.isNamespaceExportDeclaration(d) || ts.isSourceFile(d) && !!d.symbol.globalExports; })) {
40389
- errorOrSuggestion(!compilerOptions.allowUmdGlobalAccess, errorLocation, ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead, ts.unescapeLeadingUnderscores(name));
40382
+ if (propertyWithInvalidInitializer && !(ts.getEmitScriptTarget(compilerOptions) === 99 && useDefineForClassFields)) {
40383
+ var propertyName = propertyWithInvalidInitializer.name;
40384
+ error(errorLocation, ts.Diagnostics.Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor, ts.declarationNameToString(propertyName), diagnosticName(nameArg));
40385
+ return undefined;
40386
+ }
40387
+ if (nameNotFoundMessage) {
40388
+ addLazyDiagnostic(function () {
40389
+ if (errorLocation &&
40390
+ (meaning & 2 ||
40391
+ ((meaning & 32 || meaning & 384) && (meaning & 111551) === 111551))) {
40392
+ var exportOrLocalSymbol = getExportSymbolOfValueSymbolIfExported(result);
40393
+ if (exportOrLocalSymbol.flags & 2 || exportOrLocalSymbol.flags & 32 || exportOrLocalSymbol.flags & 384) {
40394
+ checkResolvedBlockScopedVariable(exportOrLocalSymbol, errorLocation);
40395
+ }
40390
40396
  }
40391
- }
40392
- if (result && associatedDeclarationForContainingInitializerOrBindingName && !withinDeferredContext && (meaning & 111551) === 111551) {
40393
- var candidate = getMergedSymbol(getLateBoundSymbol(result));
40394
- var root = ts.getRootDeclaration(associatedDeclarationForContainingInitializerOrBindingName);
40395
- if (candidate === getSymbolOfNode(associatedDeclarationForContainingInitializerOrBindingName)) {
40396
- error(errorLocation, ts.Diagnostics.Parameter_0_cannot_reference_itself, ts.declarationNameToString(associatedDeclarationForContainingInitializerOrBindingName.name));
40397
+ if (result && isInExternalModule && (meaning & 111551) === 111551 && !(originalLocation.flags & 4194304)) {
40398
+ var merged = getMergedSymbol(result);
40399
+ if (ts.length(merged.declarations) && ts.every(merged.declarations, function (d) { return ts.isNamespaceExportDeclaration(d) || ts.isSourceFile(d) && !!d.symbol.globalExports; })) {
40400
+ errorOrSuggestion(!compilerOptions.allowUmdGlobalAccess, errorLocation, ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead, ts.unescapeLeadingUnderscores(name));
40401
+ }
40397
40402
  }
40398
- else if (candidate.valueDeclaration && candidate.valueDeclaration.pos > associatedDeclarationForContainingInitializerOrBindingName.pos && root.parent.locals && lookup(root.parent.locals, candidate.escapedName, meaning) === candidate) {
40399
- error(errorLocation, ts.Diagnostics.Parameter_0_cannot_reference_identifier_1_declared_after_it, ts.declarationNameToString(associatedDeclarationForContainingInitializerOrBindingName.name), ts.declarationNameToString(errorLocation));
40403
+ if (result && associatedDeclarationForContainingInitializerOrBindingName && !withinDeferredContext && (meaning & 111551) === 111551) {
40404
+ var candidate = getMergedSymbol(getLateBoundSymbol(result));
40405
+ var root = ts.getRootDeclaration(associatedDeclarationForContainingInitializerOrBindingName);
40406
+ if (candidate === getSymbolOfNode(associatedDeclarationForContainingInitializerOrBindingName)) {
40407
+ error(errorLocation, ts.Diagnostics.Parameter_0_cannot_reference_itself, ts.declarationNameToString(associatedDeclarationForContainingInitializerOrBindingName.name));
40408
+ }
40409
+ else if (candidate.valueDeclaration && candidate.valueDeclaration.pos > associatedDeclarationForContainingInitializerOrBindingName.pos && root.parent.locals && lookup(root.parent.locals, candidate.escapedName, meaning) === candidate) {
40410
+ error(errorLocation, ts.Diagnostics.Parameter_0_cannot_reference_identifier_1_declared_after_it, ts.declarationNameToString(associatedDeclarationForContainingInitializerOrBindingName.name), ts.declarationNameToString(errorLocation));
40411
+ }
40400
40412
  }
40401
- }
40402
- if (result && errorLocation && meaning & 111551 && result.flags & 2097152 && !(result.flags & 111551) && !ts.isValidTypeOnlyAliasUseSite(errorLocation)) {
40403
- var typeOnlyDeclaration = getTypeOnlyAliasDeclaration(result);
40404
- if (typeOnlyDeclaration) {
40405
- var message = typeOnlyDeclaration.kind === 274
40406
- ? ts.Diagnostics._0_cannot_be_used_as_a_value_because_it_was_exported_using_export_type
40407
- : ts.Diagnostics._0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type;
40408
- var unescapedName = ts.unescapeLeadingUnderscores(name);
40409
- addTypeOnlyDeclarationRelatedInfo(error(errorLocation, message, unescapedName), typeOnlyDeclaration, unescapedName);
40413
+ if (result && errorLocation && meaning & 111551 && result.flags & 2097152 && !(result.flags & 111551) && !ts.isValidTypeOnlyAliasUseSite(errorLocation)) {
40414
+ var typeOnlyDeclaration = getTypeOnlyAliasDeclaration(result);
40415
+ if (typeOnlyDeclaration) {
40416
+ var message = typeOnlyDeclaration.kind === 274
40417
+ ? ts.Diagnostics._0_cannot_be_used_as_a_value_because_it_was_exported_using_export_type
40418
+ : ts.Diagnostics._0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type;
40419
+ var unescapedName = ts.unescapeLeadingUnderscores(name);
40420
+ addTypeOnlyDeclarationRelatedInfo(error(errorLocation, message, unescapedName), typeOnlyDeclaration, unescapedName);
40421
+ }
40410
40422
  }
40411
- }
40423
+ });
40412
40424
  }
40413
40425
  return result;
40414
40426
  }
@@ -41870,9 +41882,7 @@ var ts;
41870
41882
  var result = new Type(checker, flags);
41871
41883
  typeCount++;
41872
41884
  result.id = typeCount;
41873
- if (produceDiagnostics) {
41874
- ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.recordType(result);
41875
- }
41885
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.recordType(result);
41876
41886
  return result;
41877
41887
  }
41878
41888
  function createOriginType(flags) {
@@ -45300,7 +45310,7 @@ var ts;
45300
45310
  if (!omitTypeAlias) {
45301
45311
  return errorType;
45302
45312
  }
45303
- return getGlobalTypeAliasInstantiation(omitTypeAlias, [source, omitKeyType]);
45313
+ return getTypeAliasInstantiation(omitTypeAlias, [source, omitKeyType]);
45304
45314
  }
45305
45315
  var members = ts.createSymbolTable();
45306
45316
  for (var _b = 0, spreadableProperties_1 = spreadableProperties; _b < spreadableProperties_1.length; _b++) {
@@ -46866,7 +46876,7 @@ var ts;
46866
46876
  }
46867
46877
  }
46868
46878
  if (memberTypeList.length) {
46869
- var enumType_1 = getUnionType(memberTypeList, 1, symbol, undefined, undefined);
46879
+ var enumType_1 = getUnionType(memberTypeList, 1, symbol, undefined);
46870
46880
  if (enumType_1.flags & 1048576) {
46871
46881
  enumType_1.flags |= 1024;
46872
46882
  enumType_1.symbol = symbol;
@@ -49213,7 +49223,7 @@ var ts;
49213
49223
  type.resolvedTypeArguments = source.resolvedTypeArguments;
49214
49224
  return type;
49215
49225
  }
49216
- function createDeferredTypeReference(target, node, mapper, aliasSymbol, aliasTypeArguments, aliasMapper) {
49226
+ function createDeferredTypeReference(target, node, mapper, aliasSymbol, aliasTypeArguments) {
49217
49227
  if (!aliasSymbol) {
49218
49228
  aliasSymbol = getAliasSymbolForTypeNode(node);
49219
49229
  var localAliasTypeArguments = getTypeArgumentsForAliasSymbol(aliasSymbol);
@@ -49225,7 +49235,6 @@ var ts;
49225
49235
  type.mapper = mapper;
49226
49236
  type.aliasSymbol = aliasSymbol;
49227
49237
  type.aliasTypeArguments = aliasTypeArguments;
49228
- type.aliasMapper = aliasMapper;
49229
49238
  return type;
49230
49239
  }
49231
49240
  function getTypeArguments(type) {
@@ -49283,7 +49292,7 @@ var ts;
49283
49292
  }
49284
49293
  return checkNoTypeArguments(node, symbol) ? type : errorType;
49285
49294
  }
49286
- function getGlobalTypeAliasInstantiation(symbol, typeArguments, aliasSymbol, aliasTypeArguments) {
49295
+ function getTypeAliasInstantiation(symbol, typeArguments, aliasSymbol, aliasTypeArguments) {
49287
49296
  var type = getDeclaredTypeOfSymbol(symbol);
49288
49297
  if (type === intrinsicMarkerType && intrinsicTypeKinds.has(symbol.escapedName) && typeArguments && typeArguments.length === 1) {
49289
49298
  return getStringMappingType(symbol, typeArguments[0]);
@@ -49297,33 +49306,6 @@ var ts;
49297
49306
  }
49298
49307
  return instantiation;
49299
49308
  }
49300
- function getLocalTypeAliasInstantiation(symbol, typeArguments, outerTypeParameterMapper, aliasSymbol, aliasTypeArguments) {
49301
- var type = getDeclaredTypeOfSymbol(symbol);
49302
- if (type === intrinsicMarkerType && intrinsicTypeKinds.has(symbol.escapedName) && typeArguments && typeArguments.length === 1) {
49303
- return getStringMappingType(symbol, typeArguments[0]);
49304
- }
49305
- var links = getSymbolLinks(symbol);
49306
- var outerTypeParameters = getOuterTypeParametersOfAlias(symbol);
49307
- var mappedOuterParams = outerTypeParameterMapper && outerTypeParameters && instantiateTypes(outerTypeParameters, outerTypeParameterMapper);
49308
- var typeParameters = links.typeParameters;
49309
- var id = getTypeListId(ts.concatenate(mappedOuterParams, typeArguments)) + getAliasId(aliasSymbol, aliasTypeArguments);
49310
- var instantiation = links.instantiations.get(id);
49311
- if (!instantiation) {
49312
- var outerTypeArgumentMapper = outerTypeParameters && mappedOuterParams && createTypeMapper(outerTypeParameters, mappedOuterParams);
49313
- var argumentMapper = createTypeMapper(typeParameters, fillMissingTypeArguments(typeArguments, typeParameters, getMinTypeArgumentCount(typeParameters), ts.isInJSFile(symbol.valueDeclaration)));
49314
- var combinedMapper = outerTypeArgumentMapper ? combineTypeMappers(argumentMapper, outerTypeArgumentMapper) : argumentMapper;
49315
- links.instantiations.set(id, instantiation = instantiateTypeWithAlias(type, combinedMapper, aliasSymbol, aliasTypeArguments));
49316
- }
49317
- return instantiation;
49318
- }
49319
- function getOuterTypeParametersOfAlias(symbol) {
49320
- var _a;
49321
- var links = getSymbolLinks(symbol);
49322
- if (!links.outerTypeParameters) {
49323
- links.outerTypeParameters = ((_a = symbol.declarations) === null || _a === void 0 ? void 0 : _a[0]) && getOuterTypeParameters(symbol.declarations[0], true);
49324
- }
49325
- return links.outerTypeParameters;
49326
- }
49327
49309
  function getTypeFromTypeAliasReference(node, symbol) {
49328
49310
  if (ts.getCheckFlags(symbol) & 1048576) {
49329
49311
  var typeArguments = typeArgumentsFromTypeReferenceNode(node);
@@ -49350,7 +49332,7 @@ var ts;
49350
49332
  }
49351
49333
  var aliasSymbol = getAliasSymbolForTypeNode(node);
49352
49334
  var newAliasSymbol = aliasSymbol && (isLocalTypeAlias(symbol) || !isLocalTypeAlias(aliasSymbol)) ? aliasSymbol : undefined;
49353
- return getGlobalTypeAliasInstantiation(symbol, typeArgumentsFromTypeReferenceNode(node), newAliasSymbol, getTypeArgumentsForAliasSymbol(newAliasSymbol));
49335
+ return getTypeAliasInstantiation(symbol, typeArgumentsFromTypeReferenceNode(node), newAliasSymbol, getTypeArgumentsForAliasSymbol(newAliasSymbol));
49354
49336
  }
49355
49337
  return checkNoTypeArguments(node, symbol) ? type : errorType;
49356
49338
  }
@@ -50186,7 +50168,7 @@ var ts;
50186
50168
  result.types = types;
50187
50169
  return result;
50188
50170
  }
50189
- function getUnionType(types, unionReduction, aliasSymbol, aliasTypeArguments, aliasMapper, origin) {
50171
+ function getUnionType(types, unionReduction, aliasSymbol, aliasTypeArguments, origin) {
50190
50172
  if (unionReduction === void 0) { unionReduction = 1; }
50191
50173
  if (types.length === 0) {
50192
50174
  return neverType;
@@ -50253,7 +50235,7 @@ var ts;
50253
50235
  }
50254
50236
  var objectFlags = (includes & 36323363 ? 0 : 65536) |
50255
50237
  (includes & 2097152 ? 33554432 : 0);
50256
- return getUnionTypeFromSortedList(typeSet, objectFlags, aliasSymbol, aliasTypeArguments, aliasMapper, origin);
50238
+ return getUnionTypeFromSortedList(typeSet, objectFlags, aliasSymbol, aliasTypeArguments, origin);
50257
50239
  }
50258
50240
  function getUnionOrIntersectionTypePredicate(signatures, kind) {
50259
50241
  var first;
@@ -50288,7 +50270,7 @@ var ts;
50288
50270
  function typePredicateKindsMatch(a, b) {
50289
50271
  return a.kind === b.kind && a.parameterIndex === b.parameterIndex;
50290
50272
  }
50291
- function getUnionTypeFromSortedList(types, objectFlags, aliasSymbol, aliasTypeArguments, aliasMapper, origin) {
50273
+ function getUnionTypeFromSortedList(types, objectFlags, aliasSymbol, aliasTypeArguments, origin) {
50292
50274
  if (types.length === 0) {
50293
50275
  return neverType;
50294
50276
  }
@@ -50308,7 +50290,6 @@ var ts;
50308
50290
  type.origin = origin;
50309
50291
  type.aliasSymbol = aliasSymbol;
50310
50292
  type.aliasTypeArguments = aliasTypeArguments;
50311
- type.aliasMapper = aliasMapper;
50312
50293
  if (types.length === 2 && types[0].flags & 512 && types[1].flags & 512) {
50313
50294
  type.flags |= 16;
50314
50295
  type.intrinsicName = "boolean";
@@ -50321,7 +50302,7 @@ var ts;
50321
50302
  var links = getNodeLinks(node);
50322
50303
  if (!links.resolvedType) {
50323
50304
  var aliasSymbol = getAliasSymbolForTypeNode(node);
50324
- links.resolvedType = getUnionType(ts.map(node.types, getTypeFromTypeNode), 1, aliasSymbol, getTypeArgumentsForAliasSymbol(aliasSymbol), undefined);
50305
+ links.resolvedType = getUnionType(ts.map(node.types, getTypeFromTypeNode), 1, aliasSymbol, getTypeArgumentsForAliasSymbol(aliasSymbol));
50325
50306
  }
50326
50307
  return links.resolvedType;
50327
50308
  }
@@ -50459,16 +50440,15 @@ var ts;
50459
50440
  types[index] = getUnionTypeFromSortedList(result, 65536);
50460
50441
  return true;
50461
50442
  }
50462
- function createIntersectionType(types, aliasSymbol, aliasTypeArguments, aliasMapper) {
50443
+ function createIntersectionType(types, aliasSymbol, aliasTypeArguments) {
50463
50444
  var result = createType(2097152);
50464
50445
  result.objectFlags = getPropagatingFlagsOfTypes(types, 98304);
50465
50446
  result.types = types;
50466
50447
  result.aliasSymbol = aliasSymbol;
50467
50448
  result.aliasTypeArguments = aliasTypeArguments;
50468
- result.aliasMapper = aliasMapper;
50469
50449
  return result;
50470
50450
  }
50471
- function getIntersectionType(types, aliasSymbol, aliasTypeArguments, aliasMapper) {
50451
+ function getIntersectionType(types, aliasSymbol, aliasTypeArguments) {
50472
50452
  var typeMembershipMap = new ts.Map();
50473
50453
  var includes = addTypesToIntersection(typeMembershipMap, 0, types);
50474
50454
  var typeSet = ts.arrayFrom(typeMembershipMap.values());
@@ -50516,16 +50496,16 @@ var ts;
50516
50496
  if (!result) {
50517
50497
  if (includes & 1048576) {
50518
50498
  if (intersectUnionsOfPrimitiveTypes(typeSet)) {
50519
- result = getIntersectionType(typeSet, aliasSymbol, aliasTypeArguments, aliasMapper);
50499
+ result = getIntersectionType(typeSet, aliasSymbol, aliasTypeArguments);
50520
50500
  }
50521
50501
  else if (eachIsUnionContaining(typeSet, 32768)) {
50522
50502
  var undefinedOrMissingType = exactOptionalPropertyTypes && ts.some(typeSet, function (t) { return containsType(t.types, missingType); }) ? missingType : undefinedType;
50523
50503
  removeFromEach(typeSet, 32768);
50524
- result = getUnionType([getIntersectionType(typeSet), undefinedOrMissingType], 1, aliasSymbol, aliasTypeArguments, aliasMapper);
50504
+ result = getUnionType([getIntersectionType(typeSet), undefinedOrMissingType], 1, aliasSymbol, aliasTypeArguments);
50525
50505
  }
50526
50506
  else if (eachIsUnionContaining(typeSet, 65536)) {
50527
50507
  removeFromEach(typeSet, 65536);
50528
- result = getUnionType([getIntersectionType(typeSet), nullType], 1, aliasSymbol, aliasTypeArguments, aliasMapper);
50508
+ result = getUnionType([getIntersectionType(typeSet), nullType], 1, aliasSymbol, aliasTypeArguments);
50529
50509
  }
50530
50510
  else {
50531
50511
  if (!checkCrossProductUnion(typeSet)) {
@@ -50533,7 +50513,7 @@ var ts;
50533
50513
  }
50534
50514
  var constituents = getCrossProductIntersections(typeSet);
50535
50515
  var origin = ts.some(constituents, function (t) { return !!(t.flags & 2097152); }) ? createOriginUnionOrIntersectionType(2097152, typeSet) : undefined;
50536
- result = getUnionType(constituents, 1, aliasSymbol, aliasTypeArguments, aliasMapper, origin);
50516
+ result = getUnionType(constituents, 1, aliasSymbol, aliasTypeArguments, origin);
50537
50517
  }
50538
50518
  }
50539
50519
  else {
@@ -50579,7 +50559,7 @@ var ts;
50579
50559
  var links = getNodeLinks(node);
50580
50560
  if (!links.resolvedType) {
50581
50561
  var aliasSymbol = getAliasSymbolForTypeNode(node);
50582
- links.resolvedType = getIntersectionType(ts.map(node.types, getTypeFromTypeNode), aliasSymbol, getTypeArgumentsForAliasSymbol(aliasSymbol), undefined);
50562
+ links.resolvedType = getIntersectionType(ts.map(node.types, getTypeFromTypeNode), aliasSymbol, getTypeArgumentsForAliasSymbol(aliasSymbol));
50583
50563
  }
50584
50564
  return links.resolvedType;
50585
50565
  }
@@ -50674,7 +50654,7 @@ var ts;
50674
50654
  var propertyTypes = ts.map(getPropertiesOfType(type), function (prop) { return getLiteralTypeFromProperty(prop, include); });
50675
50655
  var indexKeyTypes = ts.map(getIndexInfosOfType(type), function (info) { return info !== enumNumberIndexInfo && isKeyTypeIncluded(info.keyType, include) ?
50676
50656
  info.keyType === stringType && include & 8 ? stringOrNumberType : info.keyType : neverType; });
50677
- return getUnionType(ts.concatenate(propertyTypes, indexKeyTypes), 1, undefined, undefined, undefined, origin);
50657
+ return getUnionType(ts.concatenate(propertyTypes, indexKeyTypes), 1, undefined, undefined, origin);
50678
50658
  }
50679
50659
  function isPossiblyReducibleByInstantiation(type) {
50680
50660
  return ts.some(type.types, function (t) {
@@ -50701,7 +50681,7 @@ var ts;
50701
50681
  return type;
50702
50682
  }
50703
50683
  var extractTypeAlias = getGlobalExtractSymbol();
50704
- return extractTypeAlias ? getGlobalTypeAliasInstantiation(extractTypeAlias, [type, stringType]) : stringType;
50684
+ return extractTypeAlias ? getTypeAliasInstantiation(extractTypeAlias, [type, stringType]) : stringType;
50705
50685
  }
50706
50686
  function getIndexTypeOrString(type) {
50707
50687
  var indexType = getExtractStringType(getIndexType(type));
@@ -50831,14 +50811,13 @@ var ts;
50831
50811
  result.type = type;
50832
50812
  return result;
50833
50813
  }
50834
- function createIndexedAccessType(objectType, indexType, accessFlags, aliasSymbol, aliasTypeArguments, aliasMapper) {
50814
+ function createIndexedAccessType(objectType, indexType, accessFlags, aliasSymbol, aliasTypeArguments) {
50835
50815
  var type = createType(8388608);
50836
50816
  type.objectType = objectType;
50837
50817
  type.indexType = indexType;
50838
50818
  type.accessFlags = accessFlags;
50839
50819
  type.aliasSymbol = aliasSymbol;
50840
50820
  type.aliasTypeArguments = aliasTypeArguments;
50841
- type.aliasMapper = aliasMapper;
50842
50821
  return type;
50843
50822
  }
50844
50823
  function isJSLiteralType(type) {
@@ -51156,9 +51135,9 @@ var ts;
51156
51135
  var templateMapper = combineTypeMappers(objectType.mapper, mapper);
51157
51136
  return instantiateType(getTemplateTypeFromMappedType(objectType), templateMapper);
51158
51137
  }
51159
- function getIndexedAccessType(objectType, indexType, accessFlags, accessNode, aliasSymbol, aliasTypeArguments, aliasMapper) {
51138
+ function getIndexedAccessType(objectType, indexType, accessFlags, accessNode, aliasSymbol, aliasTypeArguments) {
51160
51139
  if (accessFlags === void 0) { accessFlags = 0; }
51161
- return getIndexedAccessTypeOrUndefined(objectType, indexType, accessFlags, accessNode, aliasSymbol, aliasTypeArguments, aliasMapper) || (accessNode ? errorType : unknownType);
51140
+ return getIndexedAccessTypeOrUndefined(objectType, indexType, accessFlags, accessNode, aliasSymbol, aliasTypeArguments) || (accessNode ? errorType : unknownType);
51162
51141
  }
51163
51142
  function indexTypeLessThan(indexType, limit) {
51164
51143
  return everyType(indexType, function (t) {
@@ -51172,7 +51151,7 @@ var ts;
51172
51151
  return false;
51173
51152
  });
51174
51153
  }
51175
- function getIndexedAccessTypeOrUndefined(objectType, indexType, accessFlags, accessNode, aliasSymbol, aliasTypeArguments, aliasMapper) {
51154
+ function getIndexedAccessTypeOrUndefined(objectType, indexType, accessFlags, accessNode, aliasSymbol, aliasTypeArguments) {
51176
51155
  if (accessFlags === void 0) { accessFlags = 0; }
51177
51156
  if (objectType === wildcardType || indexType === wildcardType) {
51178
51157
  return wildcardType;
@@ -51192,7 +51171,7 @@ var ts;
51192
51171
  var id = objectType.id + "," + indexType.id + "," + persistentAccessFlags + getAliasId(aliasSymbol, aliasTypeArguments);
51193
51172
  var type = indexedAccessTypes.get(id);
51194
51173
  if (!type) {
51195
- indexedAccessTypes.set(id, type = createIndexedAccessType(objectType, indexType, persistentAccessFlags, aliasSymbol, aliasTypeArguments, aliasMapper));
51174
+ indexedAccessTypes.set(id, type = createIndexedAccessType(objectType, indexType, persistentAccessFlags, aliasSymbol, aliasTypeArguments));
51196
51175
  }
51197
51176
  return type;
51198
51177
  }
@@ -51217,8 +51196,8 @@ var ts;
51217
51196
  return undefined;
51218
51197
  }
51219
51198
  return accessFlags & 4
51220
- ? getIntersectionType(propTypes, aliasSymbol, aliasTypeArguments, aliasMapper)
51221
- : getUnionType(propTypes, 1, aliasSymbol, aliasTypeArguments, aliasMapper);
51199
+ ? getIntersectionType(propTypes, aliasSymbol, aliasTypeArguments)
51200
+ : getUnionType(propTypes, 1, aliasSymbol, aliasTypeArguments);
51222
51201
  }
51223
51202
  return getPropertyTypeForIndexType(objectType, apparentObjectType, indexType, indexType, accessNode, accessFlags | 8 | 64);
51224
51203
  }
@@ -51228,7 +51207,7 @@ var ts;
51228
51207
  var objectType = getTypeFromTypeNode(node.objectType);
51229
51208
  var indexType = getTypeFromTypeNode(node.indexType);
51230
51209
  var potentialAlias = getAliasSymbolForTypeNode(node);
51231
- var resolved = getIndexedAccessType(objectType, indexType, 0, node, potentialAlias, getTypeArgumentsForAliasSymbol(potentialAlias), undefined);
51210
+ var resolved = getIndexedAccessType(objectType, indexType, 0, node, potentialAlias, getTypeArgumentsForAliasSymbol(potentialAlias));
51232
51211
  links.resolvedType = resolved.flags & 8388608 &&
51233
51212
  resolved.objectType === objectType &&
51234
51213
  resolved.indexType === indexType ?
@@ -51346,7 +51325,6 @@ var ts;
51346
51325
  result.combinedMapper = combinedMapper;
51347
51326
  result.aliasSymbol = aliasSymbol || root.aliasSymbol;
51348
51327
  result.aliasTypeArguments = aliasSymbol ? aliasTypeArguments : instantiateTypes(root.aliasTypeArguments, mapper);
51349
- result.aliasMapper = result.aliasSymbol ? mapper : undefined;
51350
51328
  return "break";
51351
51329
  };
51352
51330
  while (true) {
@@ -52082,7 +52060,7 @@ var ts;
52082
52060
  var result = target.instantiations.get(id);
52083
52061
  if (!result) {
52084
52062
  var newMapper = createTypeMapper(typeParameters, typeArguments);
52085
- result = target.objectFlags & 4 ? createDeferredTypeReference(type.target, type.node, newMapper, newAliasSymbol, newAliasTypeArguments, mapper) :
52063
+ result = target.objectFlags & 4 ? createDeferredTypeReference(type.target, type.node, newMapper, newAliasSymbol, newAliasTypeArguments) :
52086
52064
  target.objectFlags & 32 ? instantiateMappedType(target, newMapper, newAliasSymbol, newAliasTypeArguments) :
52087
52065
  instantiateAnonymousType(target, newMapper, newAliasSymbol, newAliasTypeArguments);
52088
52066
  target.instantiations.set(id, result);
@@ -52158,7 +52136,7 @@ var ts;
52158
52136
  return instantiateAnonymousType(type, prependTypeMapping(typeVariable, t, mapper));
52159
52137
  }
52160
52138
  return t;
52161
- }, aliasSymbol, aliasTypeArguments, mapper);
52139
+ }, aliasSymbol, aliasTypeArguments);
52162
52140
  }
52163
52141
  }
52164
52142
  return instantiateType(getConstraintTypeFromMappedType(type), mapper) === wildcardType ? wildcardType : instantiateAnonymousType(type, mapper, aliasSymbol, aliasTypeArguments);
@@ -52220,7 +52198,6 @@ var ts;
52220
52198
  result.mapper = mapper;
52221
52199
  result.aliasSymbol = aliasSymbol || type.aliasSymbol;
52222
52200
  result.aliasTypeArguments = aliasSymbol ? aliasTypeArguments : instantiateTypes(type.aliasTypeArguments, mapper);
52223
- result.aliasMapper = mapper;
52224
52201
  return result;
52225
52202
  }
52226
52203
  function getConditionalTypeInstantiation(type, mapper, aliasSymbol, aliasTypeArguments) {
@@ -52234,7 +52211,7 @@ var ts;
52234
52211
  var checkType_1 = root.checkType;
52235
52212
  var distributionType = root.isDistributive ? getMappedType(checkType_1, newMapper_1) : undefined;
52236
52213
  result = distributionType && checkType_1 !== distributionType && distributionType.flags & (1048576 | 131072) ?
52237
- mapTypeWithAlias(getReducedType(distributionType), function (t) { return getConditionalType(root, prependTypeMapping(checkType_1, t, newMapper_1)); }, aliasSymbol, aliasTypeArguments, mapper) :
52214
+ mapTypeWithAlias(getReducedType(distributionType), function (t) { return getConditionalType(root, prependTypeMapping(checkType_1, t, newMapper_1)); }, aliasSymbol, aliasTypeArguments) :
52238
52215
  getConditionalType(root, newMapper_1, aliasSymbol, aliasTypeArguments);
52239
52216
  root.instantiations.set(id, result);
52240
52217
  }
@@ -52291,8 +52268,8 @@ var ts;
52291
52268
  var newAliasSymbol = aliasSymbol || type.aliasSymbol;
52292
52269
  var newAliasTypeArguments = aliasSymbol ? aliasTypeArguments : instantiateTypes(type.aliasTypeArguments, mapper);
52293
52270
  return flags & 2097152 || origin && origin.flags & 2097152 ?
52294
- getIntersectionType(newTypes, newAliasSymbol, newAliasTypeArguments, mapper) :
52295
- getUnionType(newTypes, 1, newAliasSymbol, newAliasTypeArguments, mapper);
52271
+ getIntersectionType(newTypes, newAliasSymbol, newAliasTypeArguments) :
52272
+ getUnionType(newTypes, 1, newAliasSymbol, newAliasTypeArguments);
52296
52273
  }
52297
52274
  if (flags & 4194304) {
52298
52275
  return getIndexType(instantiateType(type.type, mapper));
@@ -52306,7 +52283,7 @@ var ts;
52306
52283
  if (flags & 8388608) {
52307
52284
  var newAliasSymbol = aliasSymbol || type.aliasSymbol;
52308
52285
  var newAliasTypeArguments = aliasSymbol ? aliasTypeArguments : instantiateTypes(type.aliasTypeArguments, mapper);
52309
- return getIndexedAccessType(instantiateType(type.objectType, mapper), instantiateType(type.indexType, mapper), type.accessFlags, undefined, newAliasSymbol, newAliasTypeArguments, mapper);
52286
+ return getIndexedAccessType(instantiateType(type.objectType, mapper), instantiateType(type.indexType, mapper), type.accessFlags, undefined, newAliasSymbol, newAliasTypeArguments);
52310
52287
  }
52311
52288
  if (flags & 16777216) {
52312
52289
  return getConditionalTypeInstantiation(type, combineTypeMappers(type.mapper, mapper), aliasSymbol, aliasTypeArguments);
@@ -54050,10 +54027,7 @@ var ts;
54050
54027
  if (variances === ts.emptyArray) {
54051
54028
  return 1;
54052
54029
  }
54053
- var outerTypeParameters = getOuterTypeParametersOfAlias(source.aliasSymbol);
54054
- var sourceArgs = outerTypeParameters && source.aliasMapper ? ts.concatenate(source.aliasTypeArguments, instantiateTypes(outerTypeParameters, source.aliasMapper)) : source.aliasTypeArguments;
54055
- var targetArgs = outerTypeParameters && target.aliasMapper ? ts.concatenate(target.aliasTypeArguments, instantiateTypes(outerTypeParameters, target.aliasMapper)) : target.aliasTypeArguments;
54056
- var varianceResult = relateVariances(sourceArgs, targetArgs, variances, intersectionState);
54030
+ var varianceResult = relateVariances(source.aliasTypeArguments, target.aliasTypeArguments, variances, intersectionState);
54057
54031
  if (varianceResult !== undefined) {
54058
54032
  return varianceResult;
54059
54033
  }
@@ -55143,10 +55117,8 @@ var ts;
55143
55117
  }
55144
55118
  function getAliasVariances(symbol) {
55145
55119
  var links = getSymbolLinks(symbol);
55146
- var params = ts.concatenate(links.typeParameters, getOuterTypeParametersOfAlias(symbol));
55147
- return getVariancesWorker(params, links, function (_links, param, marker) {
55148
- var mapper = makeUnaryTypeMapper(param, marker);
55149
- var type = getLocalTypeAliasInstantiation(symbol, instantiateTypes(links.typeParameters, mapper), mapper);
55120
+ return getVariancesWorker(links.typeParameters, links, function (_links, param, marker) {
55121
+ var type = getTypeAliasInstantiation(symbol, instantiateTypes(links.typeParameters, makeUnaryTypeMapper(param, marker)));
55150
55122
  type.aliasTypeArgumentsContainsMarker = true;
55151
55123
  return type;
55152
55124
  });
@@ -55703,7 +55675,7 @@ var ts;
55703
55675
  deferredGlobalNonNullableTypeAlias = getGlobalSymbol("NonNullable", 524288, undefined) || unknownSymbol;
55704
55676
  }
55705
55677
  return deferredGlobalNonNullableTypeAlias !== unknownSymbol ?
55706
- getGlobalTypeAliasInstantiation(deferredGlobalNonNullableTypeAlias, [reducedType]) :
55678
+ getTypeAliasInstantiation(deferredGlobalNonNullableTypeAlias, [reducedType]) :
55707
55679
  reducedType;
55708
55680
  }
55709
55681
  function getNonNullableType(type) {
@@ -55999,11 +55971,13 @@ var ts;
55999
55971
  errorOrSuggestion(noImplicitAny, declaration, diagnostic, ts.declarationNameToString(ts.getNameOfDeclaration(declaration)), typeAsString);
56000
55972
  }
56001
55973
  function reportErrorsFromWidening(declaration, type, wideningKind) {
56002
- if (produceDiagnostics && noImplicitAny && ts.getObjectFlags(type) & 131072 && (!wideningKind || !getContextualSignatureForFunctionLikeDeclaration(declaration))) {
56003
- if (!reportWideningErrorsInType(type)) {
56004
- reportImplicitAny(declaration, type, wideningKind);
55974
+ addLazyDiagnostic(function () {
55975
+ if (noImplicitAny && ts.getObjectFlags(type) & 131072 && (!wideningKind || !getContextualSignatureForFunctionLikeDeclaration(declaration))) {
55976
+ if (!reportWideningErrorsInType(type)) {
55977
+ reportImplicitAny(declaration, type, wideningKind);
55978
+ }
56005
55979
  }
56006
- }
55980
+ });
56007
55981
  }
56008
55982
  function applyToParameterTypes(source, target, callback) {
56009
55983
  var sourceCount = getParameterCount(source);
@@ -57668,7 +57642,7 @@ var ts;
57668
57642
  newOrigin = createOriginUnionOrIntersectionType(1048576, originFiltered);
57669
57643
  }
57670
57644
  }
57671
- return getUnionTypeFromSortedList(filtered, type.objectFlags, undefined, undefined, undefined, newOrigin);
57645
+ return getUnionTypeFromSortedList(filtered, type.objectFlags, undefined, undefined, newOrigin);
57672
57646
  }
57673
57647
  return type.flags & 131072 || f(type) ? type : neverType;
57674
57648
  }
@@ -57704,9 +57678,9 @@ var ts;
57704
57678
  }
57705
57679
  return changed ? mappedTypes && getUnionType(mappedTypes, noReductions ? 0 : 1) : type;
57706
57680
  }
57707
- function mapTypeWithAlias(type, mapper, aliasSymbol, aliasTypeArguments, aliasMapper) {
57681
+ function mapTypeWithAlias(type, mapper, aliasSymbol, aliasTypeArguments) {
57708
57682
  return type.flags & 1048576 && aliasSymbol ?
57709
- getUnionType(ts.map(type.types, mapper), 1, aliasSymbol, aliasTypeArguments, aliasMapper) :
57683
+ getUnionType(ts.map(type.types, mapper), 1, aliasSymbol, aliasTypeArguments) :
57710
57684
  mapType(type, mapper);
57711
57685
  }
57712
57686
  function extractTypesOfKind(type, kind) {
@@ -60360,7 +60334,7 @@ var ts;
60360
60334
  var params = getSymbolLinks(managedSym).typeParameters;
60361
60335
  if (ts.length(params) >= 2) {
60362
60336
  var args = fillMissingTypeArguments([ctorType, attributesType], params, 2, ts.isInJSFile(context));
60363
- return getGlobalTypeAliasInstantiation(managedSym, args);
60337
+ return getTypeAliasInstantiation(managedSym, args);
60364
60338
  }
60365
60339
  }
60366
60340
  if (ts.length(declaredManagedType.typeParameters) >= 2) {
@@ -62838,7 +62812,7 @@ var ts;
62838
62812
  var isTaggedTemplate = node.kind === 209;
62839
62813
  var isDecorator = node.kind === 164;
62840
62814
  var isJsxOpeningOrSelfClosingElement = ts.isJsxOpeningLikeElement(node);
62841
- var reportErrors = !candidatesOutArray && produceDiagnostics;
62815
+ var reportErrors = !candidatesOutArray;
62842
62816
  var typeArguments;
62843
62817
  if (!isDecorator) {
62844
62818
  typeArguments = node.typeArguments;
@@ -63918,11 +63892,13 @@ var ts;
63918
63892
  checkSourceElement(type);
63919
63893
  exprType = getRegularTypeOfObjectLiteral(getBaseTypeOfLiteralType(exprType));
63920
63894
  var targetType = getTypeFromTypeNode(type);
63921
- if (produceDiagnostics && !isErrorType(targetType)) {
63922
- var widenedType = getWidenedType(exprType);
63923
- if (!isTypeComparableTo(targetType, widenedType)) {
63924
- checkTypeComparableTo(exprType, targetType, errNode, ts.Diagnostics.Conversion_of_type_0_to_type_1_may_be_a_mistake_because_neither_type_sufficiently_overlaps_with_the_other_If_this_was_intentional_convert_the_expression_to_unknown_first);
63925
- }
63895
+ if (!isErrorType(targetType)) {
63896
+ addLazyDiagnostic(function () {
63897
+ var widenedType = getWidenedType(exprType);
63898
+ if (!isTypeComparableTo(targetType, widenedType)) {
63899
+ checkTypeComparableTo(exprType, targetType, errNode, ts.Diagnostics.Conversion_of_type_0_to_type_1_may_be_a_mistake_because_neither_type_sufficiently_overlaps_with_the_other_If_this_was_intentional_convert_the_expression_to_unknown_first);
63900
+ }
63901
+ });
63926
63902
  }
63927
63903
  return targetType;
63928
63904
  }
@@ -64606,39 +64582,40 @@ var ts;
64606
64582
  }
64607
64583
  }
64608
64584
  function checkAllCodePathsInNonVoidFunctionReturnOrThrow(func, returnType) {
64609
- if (!produceDiagnostics) {
64610
- return;
64611
- }
64612
- var functionFlags = ts.getFunctionFlags(func);
64613
- var type = returnType && unwrapReturnType(returnType, functionFlags);
64614
- if (type && maybeTypeOfKind(type, 1 | 16384)) {
64615
- return;
64616
- }
64617
- if (func.kind === 167 || ts.nodeIsMissing(func.body) || func.body.kind !== 234 || !functionHasImplicitReturn(func)) {
64618
- return;
64619
- }
64620
- var hasExplicitReturn = func.flags & 512;
64621
- var errorNode = ts.getEffectiveReturnTypeNode(func) || func;
64622
- if (type && type.flags & 131072) {
64623
- error(errorNode, ts.Diagnostics.A_function_returning_never_cannot_have_a_reachable_end_point);
64624
- }
64625
- else if (type && !hasExplicitReturn) {
64626
- error(errorNode, ts.Diagnostics.A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value);
64627
- }
64628
- else if (type && strictNullChecks && !isTypeAssignableTo(undefinedType, type)) {
64629
- error(errorNode, ts.Diagnostics.Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined);
64630
- }
64631
- else if (compilerOptions.noImplicitReturns) {
64632
- if (!type) {
64633
- if (!hasExplicitReturn) {
64634
- return;
64635
- }
64636
- var inferredReturnType = getReturnTypeOfSignature(getSignatureFromDeclaration(func));
64637
- if (isUnwrappedReturnTypeVoidOrAny(func, inferredReturnType)) {
64638
- return;
64585
+ addLazyDiagnostic(checkAllCodePathsInNonVoidFunctionReturnOrThrowDiagnostics);
64586
+ return;
64587
+ function checkAllCodePathsInNonVoidFunctionReturnOrThrowDiagnostics() {
64588
+ var functionFlags = ts.getFunctionFlags(func);
64589
+ var type = returnType && unwrapReturnType(returnType, functionFlags);
64590
+ if (type && maybeTypeOfKind(type, 1 | 16384)) {
64591
+ return;
64592
+ }
64593
+ if (func.kind === 167 || ts.nodeIsMissing(func.body) || func.body.kind !== 234 || !functionHasImplicitReturn(func)) {
64594
+ return;
64595
+ }
64596
+ var hasExplicitReturn = func.flags & 512;
64597
+ var errorNode = ts.getEffectiveReturnTypeNode(func) || func;
64598
+ if (type && type.flags & 131072) {
64599
+ error(errorNode, ts.Diagnostics.A_function_returning_never_cannot_have_a_reachable_end_point);
64600
+ }
64601
+ else if (type && !hasExplicitReturn) {
64602
+ error(errorNode, ts.Diagnostics.A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value);
64603
+ }
64604
+ else if (type && strictNullChecks && !isTypeAssignableTo(undefinedType, type)) {
64605
+ error(errorNode, ts.Diagnostics.Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined);
64606
+ }
64607
+ else if (compilerOptions.noImplicitReturns) {
64608
+ if (!type) {
64609
+ if (!hasExplicitReturn) {
64610
+ return;
64611
+ }
64612
+ var inferredReturnType = getReturnTypeOfSignature(getSignatureFromDeclaration(func));
64613
+ if (isUnwrappedReturnTypeVoidOrAny(func, inferredReturnType)) {
64614
+ return;
64615
+ }
64639
64616
  }
64617
+ error(errorNode, ts.Diagnostics.Not_all_code_paths_return_a_value);
64640
64618
  }
64641
- error(errorNode, ts.Diagnostics.Not_all_code_paths_return_a_value);
64642
64619
  }
64643
64620
  }
64644
64621
  function checkFunctionExpressionOrObjectLiteralMethod(node, checkMode) {
@@ -64864,47 +64841,48 @@ var ts;
64864
64841
  checkExpression(node.expression);
64865
64842
  return undefinedWideningType;
64866
64843
  }
64867
- function checkAwaitExpression(node) {
64868
- if (produceDiagnostics) {
64869
- var container = ts.getContainingFunctionOrClassStaticBlock(node);
64870
- if (container && ts.isClassStaticBlockDeclaration(container)) {
64871
- error(node, ts.Diagnostics.Await_expression_cannot_be_used_inside_a_class_static_block);
64872
- }
64873
- else if (!(node.flags & 32768)) {
64874
- if (ts.isInTopLevelContext(node)) {
64875
- var sourceFile = ts.getSourceFileOfNode(node);
64876
- if (!hasParseDiagnostics(sourceFile)) {
64877
- var span = void 0;
64878
- if (!ts.isEffectiveExternalModule(sourceFile, compilerOptions)) {
64879
- if (!span)
64880
- span = ts.getSpanOfTokenAtPosition(sourceFile, node.pos);
64881
- var diagnostic = ts.createFileDiagnostic(sourceFile, span.start, span.length, ts.Diagnostics.await_expressions_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module);
64882
- diagnostics.add(diagnostic);
64883
- }
64884
- if ((moduleKind !== ts.ModuleKind.ES2022 && moduleKind !== ts.ModuleKind.ESNext && moduleKind !== ts.ModuleKind.System && !(moduleKind === ts.ModuleKind.NodeNext && ts.getSourceFileOfNode(node).impliedNodeFormat === ts.ModuleKind.ESNext)) || languageVersion < 4) {
64844
+ function checkAwaitExpressionGrammar(node) {
64845
+ var container = ts.getContainingFunctionOrClassStaticBlock(node);
64846
+ if (container && ts.isClassStaticBlockDeclaration(container)) {
64847
+ error(node, ts.Diagnostics.Await_expression_cannot_be_used_inside_a_class_static_block);
64848
+ }
64849
+ else if (!(node.flags & 32768)) {
64850
+ if (ts.isInTopLevelContext(node)) {
64851
+ var sourceFile = ts.getSourceFileOfNode(node);
64852
+ if (!hasParseDiagnostics(sourceFile)) {
64853
+ var span = void 0;
64854
+ if (!ts.isEffectiveExternalModule(sourceFile, compilerOptions)) {
64855
+ if (!span)
64885
64856
  span = ts.getSpanOfTokenAtPosition(sourceFile, node.pos);
64886
- var diagnostic = ts.createFileDiagnostic(sourceFile, span.start, span.length, ts.Diagnostics.Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher);
64887
- diagnostics.add(diagnostic);
64888
- }
64857
+ var diagnostic = ts.createFileDiagnostic(sourceFile, span.start, span.length, ts.Diagnostics.await_expressions_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module);
64858
+ diagnostics.add(diagnostic);
64889
64859
  }
64890
- }
64891
- else {
64892
- var sourceFile = ts.getSourceFileOfNode(node);
64893
- if (!hasParseDiagnostics(sourceFile)) {
64894
- var span = ts.getSpanOfTokenAtPosition(sourceFile, node.pos);
64895
- var diagnostic = ts.createFileDiagnostic(sourceFile, span.start, span.length, ts.Diagnostics.await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules);
64896
- if (container && container.kind !== 170 && (ts.getFunctionFlags(container) & 2) === 0) {
64897
- var relatedInfo = ts.createDiagnosticForNode(container, ts.Diagnostics.Did_you_mean_to_mark_this_function_as_async);
64898
- ts.addRelatedInfo(diagnostic, relatedInfo);
64899
- }
64860
+ if ((moduleKind !== ts.ModuleKind.ES2022 && moduleKind !== ts.ModuleKind.ESNext && moduleKind !== ts.ModuleKind.System && !(moduleKind === ts.ModuleKind.NodeNext && ts.getSourceFileOfNode(node).impliedNodeFormat === ts.ModuleKind.ESNext)) || languageVersion < 4) {
64861
+ span = ts.getSpanOfTokenAtPosition(sourceFile, node.pos);
64862
+ var diagnostic = ts.createFileDiagnostic(sourceFile, span.start, span.length, ts.Diagnostics.Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher);
64900
64863
  diagnostics.add(diagnostic);
64901
64864
  }
64902
64865
  }
64903
64866
  }
64904
- if (isInParameterInitializerBeforeContainingFunction(node)) {
64905
- error(node, ts.Diagnostics.await_expressions_cannot_be_used_in_a_parameter_initializer);
64867
+ else {
64868
+ var sourceFile = ts.getSourceFileOfNode(node);
64869
+ if (!hasParseDiagnostics(sourceFile)) {
64870
+ var span = ts.getSpanOfTokenAtPosition(sourceFile, node.pos);
64871
+ var diagnostic = ts.createFileDiagnostic(sourceFile, span.start, span.length, ts.Diagnostics.await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules);
64872
+ if (container && container.kind !== 170 && (ts.getFunctionFlags(container) & 2) === 0) {
64873
+ var relatedInfo = ts.createDiagnosticForNode(container, ts.Diagnostics.Did_you_mean_to_mark_this_function_as_async);
64874
+ ts.addRelatedInfo(diagnostic, relatedInfo);
64875
+ }
64876
+ diagnostics.add(diagnostic);
64877
+ }
64906
64878
  }
64907
64879
  }
64880
+ if (isInParameterInitializerBeforeContainingFunction(node)) {
64881
+ error(node, ts.Diagnostics.await_expressions_cannot_be_used_in_a_parameter_initializer);
64882
+ }
64883
+ }
64884
+ function checkAwaitExpression(node) {
64885
+ addLazyDiagnostic(function () { return checkAwaitExpressionGrammar(node); });
64908
64886
  var operandType = checkExpression(node.expression);
64909
64887
  var awaitedType = checkAwaitedType(operandType, true, node, ts.Diagnostics.Type_of_await_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member);
64910
64888
  if (awaitedType === operandType && !isErrorType(awaitedType) && !(operandType.flags & 3)) {
@@ -65649,7 +65627,10 @@ var ts;
65649
65627
  }
65650
65628
  }
65651
65629
  function checkAssignmentOperator(valueType) {
65652
- if (produceDiagnostics && ts.isAssignmentOperator(operator)) {
65630
+ if (ts.isAssignmentOperator(operator)) {
65631
+ addLazyDiagnostic(checkAssignmentOperatorWorker);
65632
+ }
65633
+ function checkAssignmentOperatorWorker() {
65653
65634
  if (checkReferenceExpression(left, ts.Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access, ts.Diagnostics.The_left_hand_side_of_an_assignment_expression_may_not_be_an_optional_property_access)
65654
65635
  && (!ts.isIdentifier(left) || ts.unescapeLeadingUnderscores(left.escapedText) !== "exports")) {
65655
65636
  var headMessage = void 0;
@@ -65738,14 +65719,7 @@ var ts;
65738
65719
  return [effectiveLeft, effectiveRight];
65739
65720
  }
65740
65721
  function checkYieldExpression(node) {
65741
- if (produceDiagnostics) {
65742
- if (!(node.flags & 8192)) {
65743
- grammarErrorOnFirstToken(node, ts.Diagnostics.A_yield_expression_is_only_allowed_in_a_generator_body);
65744
- }
65745
- if (isInParameterInitializerBeforeContainingFunction(node)) {
65746
- error(node, ts.Diagnostics.yield_expressions_cannot_be_used_in_a_parameter_initializer);
65747
- }
65748
- }
65722
+ addLazyDiagnostic(checkYieldExpressionGrammar);
65749
65723
  var func = ts.getContainingFunction(node);
65750
65724
  if (!func)
65751
65725
  return anyType;
@@ -65784,14 +65758,24 @@ var ts;
65784
65758
  var type = getContextualIterationType(2, func);
65785
65759
  if (!type) {
65786
65760
  type = anyType;
65787
- if (produceDiagnostics && noImplicitAny && !ts.expressionResultIsUnused(node)) {
65788
- var contextualType = getContextualType(node);
65789
- if (!contextualType || isTypeAny(contextualType)) {
65790
- error(node, ts.Diagnostics.yield_expression_implicitly_results_in_an_any_type_because_its_containing_generator_lacks_a_return_type_annotation);
65761
+ addLazyDiagnostic(function () {
65762
+ if (noImplicitAny && !ts.expressionResultIsUnused(node)) {
65763
+ var contextualType = getContextualType(node);
65764
+ if (!contextualType || isTypeAny(contextualType)) {
65765
+ error(node, ts.Diagnostics.yield_expression_implicitly_results_in_an_any_type_because_its_containing_generator_lacks_a_return_type_annotation);
65766
+ }
65791
65767
  }
65792
- }
65768
+ });
65793
65769
  }
65794
65770
  return type;
65771
+ function checkYieldExpressionGrammar() {
65772
+ if (!(node.flags & 8192)) {
65773
+ grammarErrorOnFirstToken(node, ts.Diagnostics.A_yield_expression_is_only_allowed_in_a_generator_body);
65774
+ }
65775
+ if (isInParameterInitializerBeforeContainingFunction(node)) {
65776
+ error(node, ts.Diagnostics.yield_expressions_cannot_be_used_in_a_parameter_initializer);
65777
+ }
65778
+ }
65795
65779
  }
65796
65780
  function checkConditionalExpression(node, checkMode) {
65797
65781
  checkTruthinessExpression(node.condition);
@@ -66307,9 +66291,7 @@ var ts;
66307
66291
  if (constraintType && defaultType) {
66308
66292
  checkTypeAssignableTo(defaultType, getTypeWithThisArgument(instantiateType(constraintType, makeUnaryTypeMapper(typeParameter, defaultType)), defaultType), node.default, ts.Diagnostics.Type_0_does_not_satisfy_the_constraint_1);
66309
66293
  }
66310
- if (produceDiagnostics) {
66311
- checkTypeNameIsReserved(node.name, ts.Diagnostics.Type_parameter_name_cannot_be_0);
66312
- }
66294
+ addLazyDiagnostic(function () { return checkTypeNameIsReserved(node.name, ts.Diagnostics.Type_parameter_name_cannot_be_0); });
66313
66295
  }
66314
66296
  function checkParameter(node) {
66315
66297
  checkGrammarDecoratorsAndModifiers(node);
@@ -66448,7 +66430,8 @@ var ts;
66448
66430
  if (node.type) {
66449
66431
  checkSourceElement(node.type);
66450
66432
  }
66451
- if (produceDiagnostics) {
66433
+ addLazyDiagnostic(checkSignatureDeclarationDiagnostics);
66434
+ function checkSignatureDeclarationDiagnostics() {
66452
66435
  checkCollisionWithArgumentsInGeneratedCode(node);
66453
66436
  var returnTypeNode = ts.getEffectiveReturnTypeNode(node);
66454
66437
  if (noImplicitAny && !returnTypeNode) {
@@ -66700,9 +66683,8 @@ var ts;
66700
66683
  if (ts.nodeIsMissing(node.body)) {
66701
66684
  return;
66702
66685
  }
66703
- if (!produceDiagnostics) {
66704
- return;
66705
- }
66686
+ addLazyDiagnostic(checkConstructorDeclarationDiagnostics);
66687
+ return;
66706
66688
  function isInstancePropertyWithInitializerOrPrivateIdentifierProperty(n) {
66707
66689
  if (ts.isPrivateIdentifierClassElementDeclaration(n)) {
66708
66690
  return true;
@@ -66711,42 +66693,44 @@ var ts;
66711
66693
  !ts.isStatic(n) &&
66712
66694
  !!n.initializer;
66713
66695
  }
66714
- var containingClassDecl = node.parent;
66715
- if (ts.getClassExtendsHeritageElement(containingClassDecl)) {
66716
- captureLexicalThis(node.parent, containingClassDecl);
66717
- var classExtendsNull = classDeclarationExtendsNull(containingClassDecl);
66718
- var superCall = findFirstSuperCall(node.body);
66719
- if (superCall) {
66720
- if (classExtendsNull) {
66721
- error(superCall, ts.Diagnostics.A_constructor_cannot_contain_a_super_call_when_its_class_extends_null);
66722
- }
66723
- var superCallShouldBeRootLevel = (ts.getEmitScriptTarget(compilerOptions) !== 99 || !useDefineForClassFields) &&
66724
- (ts.some(node.parent.members, isInstancePropertyWithInitializerOrPrivateIdentifierProperty) ||
66725
- ts.some(node.parameters, function (p) { return ts.hasSyntacticModifier(p, 16476); }));
66726
- if (superCallShouldBeRootLevel) {
66727
- if (!superCallIsRootLevelInConstructor(superCall, node.body)) {
66728
- error(superCall, ts.Diagnostics.A_super_call_must_be_a_root_level_statement_within_a_constructor_of_a_derived_class_that_contains_initialized_properties_parameter_properties_or_private_identifiers);
66729
- }
66730
- else {
66731
- var superCallStatement = void 0;
66732
- for (var _i = 0, _a = node.body.statements; _i < _a.length; _i++) {
66733
- var statement = _a[_i];
66734
- if (ts.isExpressionStatement(statement) && ts.isSuperCall(ts.skipOuterExpressions(statement.expression))) {
66735
- superCallStatement = statement;
66736
- break;
66696
+ function checkConstructorDeclarationDiagnostics() {
66697
+ var containingClassDecl = node.parent;
66698
+ if (ts.getClassExtendsHeritageElement(containingClassDecl)) {
66699
+ captureLexicalThis(node.parent, containingClassDecl);
66700
+ var classExtendsNull = classDeclarationExtendsNull(containingClassDecl);
66701
+ var superCall = findFirstSuperCall(node.body);
66702
+ if (superCall) {
66703
+ if (classExtendsNull) {
66704
+ error(superCall, ts.Diagnostics.A_constructor_cannot_contain_a_super_call_when_its_class_extends_null);
66705
+ }
66706
+ var superCallShouldBeRootLevel = (ts.getEmitScriptTarget(compilerOptions) !== 99 || !useDefineForClassFields) &&
66707
+ (ts.some(node.parent.members, isInstancePropertyWithInitializerOrPrivateIdentifierProperty) ||
66708
+ ts.some(node.parameters, function (p) { return ts.hasSyntacticModifier(p, 16476); }));
66709
+ if (superCallShouldBeRootLevel) {
66710
+ if (!superCallIsRootLevelInConstructor(superCall, node.body)) {
66711
+ error(superCall, ts.Diagnostics.A_super_call_must_be_a_root_level_statement_within_a_constructor_of_a_derived_class_that_contains_initialized_properties_parameter_properties_or_private_identifiers);
66712
+ }
66713
+ else {
66714
+ var superCallStatement = void 0;
66715
+ for (var _i = 0, _a = node.body.statements; _i < _a.length; _i++) {
66716
+ var statement = _a[_i];
66717
+ if (ts.isExpressionStatement(statement) && ts.isSuperCall(ts.skipOuterExpressions(statement.expression))) {
66718
+ superCallStatement = statement;
66719
+ break;
66720
+ }
66721
+ if (!ts.isPrologueDirective(statement) && nodeImmediatelyReferencesSuperOrThis(statement)) {
66722
+ break;
66723
+ }
66737
66724
  }
66738
- if (!ts.isPrologueDirective(statement) && nodeImmediatelyReferencesSuperOrThis(statement)) {
66739
- break;
66725
+ if (superCallStatement === undefined) {
66726
+ error(node, ts.Diagnostics.A_super_call_must_be_the_first_statement_in_the_constructor_to_refer_to_super_or_this_when_a_derived_class_contains_initialized_properties_parameter_properties_or_private_identifiers);
66740
66727
  }
66741
66728
  }
66742
- if (superCallStatement === undefined) {
66743
- error(node, ts.Diagnostics.A_super_call_must_be_the_first_statement_in_the_constructor_to_refer_to_super_or_this_when_a_derived_class_contains_initialized_properties_parameter_properties_or_private_identifiers);
66744
- }
66745
66729
  }
66746
66730
  }
66747
- }
66748
- else if (!classExtendsNull) {
66749
- error(node, ts.Diagnostics.Constructors_for_derived_classes_must_contain_a_super_call);
66731
+ else if (!classExtendsNull) {
66732
+ error(node, ts.Diagnostics.Constructors_for_derived_classes_must_contain_a_super_call);
66733
+ }
66750
66734
  }
66751
66735
  }
66752
66736
  }
@@ -66764,7 +66748,10 @@ var ts;
66764
66748
  return !!ts.forEachChild(node, nodeImmediatelyReferencesSuperOrThis);
66765
66749
  }
66766
66750
  function checkAccessorDeclaration(node) {
66767
- if (produceDiagnostics) {
66751
+ addLazyDiagnostic(checkAccessorDeclarationDiagnostics);
66752
+ checkSourceElement(node.body);
66753
+ setNodeLinksForPrivateIdentifierScope(node);
66754
+ function checkAccessorDeclarationDiagnostics() {
66768
66755
  if (!checkGrammarFunctionLikeDeclaration(node) && !checkGrammarAccessor(node))
66769
66756
  checkGrammarComputedPropertyName(node.name);
66770
66757
  checkDecorators(node);
@@ -66808,8 +66795,6 @@ var ts;
66808
66795
  checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, returnType);
66809
66796
  }
66810
66797
  }
66811
- checkSourceElement(node.body);
66812
- setNodeLinksForPrivateIdentifierScope(node);
66813
66798
  }
66814
66799
  function checkMissingDeclaration(node) {
66815
66800
  checkDecorators(node);
@@ -66852,11 +66837,13 @@ var ts;
66852
66837
  ts.forEach(node.typeArguments, checkSourceElement);
66853
66838
  var type = getTypeFromTypeReference(node);
66854
66839
  if (!isErrorType(type)) {
66855
- if (node.typeArguments && produceDiagnostics) {
66856
- var typeParameters = getTypeParametersForTypeReference(node);
66857
- if (typeParameters) {
66858
- checkTypeArgumentConstraints(node, typeParameters);
66859
- }
66840
+ if (node.typeArguments) {
66841
+ addLazyDiagnostic(function () {
66842
+ var typeParameters = getTypeParametersForTypeReference(node);
66843
+ if (typeParameters) {
66844
+ checkTypeArgumentConstraints(node, typeParameters);
66845
+ }
66846
+ });
66860
66847
  }
66861
66848
  var symbol = getNodeLinks(node).resolvedSymbol;
66862
66849
  if (symbol) {
@@ -66884,7 +66871,8 @@ var ts;
66884
66871
  }
66885
66872
  function checkTypeLiteral(node) {
66886
66873
  ts.forEach(node.members, checkSourceElement);
66887
- if (produceDiagnostics) {
66874
+ addLazyDiagnostic(checkTypeLiteralDiagnostics);
66875
+ function checkTypeLiteralDiagnostics() {
66888
66876
  var type = getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node);
66889
66877
  checkIndexConstraints(type, type.symbol);
66890
66878
  checkTypeForDuplicateIndexSignatures(node);
@@ -67069,9 +67057,9 @@ var ts;
67069
67057
  return flags & flagsToCheck;
67070
67058
  }
67071
67059
  function checkFunctionOrConstructorSymbol(symbol) {
67072
- if (!produceDiagnostics) {
67073
- return;
67074
- }
67060
+ addLazyDiagnostic(function () { return checkFunctionOrConstructorSymbolWorker(symbol); });
67061
+ }
67062
+ function checkFunctionOrConstructorSymbolWorker(symbol) {
67075
67063
  function getCanonicalOverload(overloads, implementation) {
67076
67064
  var implementationSharesContainerWithFirstOverload = implementation !== undefined && implementation.parent === overloads[0].parent;
67077
67065
  return implementationSharesContainerWithFirstOverload ? implementation : overloads[0];
@@ -67264,9 +67252,9 @@ var ts;
67264
67252
  }
67265
67253
  }
67266
67254
  function checkExportsOnMergedDeclarations(node) {
67267
- if (!produceDiagnostics) {
67268
- return;
67269
- }
67255
+ addLazyDiagnostic(function () { return checkExportsOnMergedDeclarationsWorker(node); });
67256
+ }
67257
+ function checkExportsOnMergedDeclarationsWorker(node) {
67270
67258
  var symbol = node.localSymbol;
67271
67259
  if (!symbol) {
67272
67260
  symbol = getSymbolOfNode(node);
@@ -67439,7 +67427,7 @@ var ts;
67439
67427
  if (!baseConstraint || (baseConstraint.flags & 3) || isEmptyObjectType(baseConstraint) || isThenableType(baseConstraint)) {
67440
67428
  var awaitedSymbol = getGlobalAwaitedSymbol(true);
67441
67429
  if (awaitedSymbol) {
67442
- return getGlobalTypeAliasInstantiation(awaitedSymbol, [unwrapAwaitedType(type)]);
67430
+ return getTypeAliasInstantiation(awaitedSymbol, [unwrapAwaitedType(type)]);
67443
67431
  }
67444
67432
  }
67445
67433
  }
@@ -67575,26 +67563,37 @@ var ts;
67575
67563
  checkTypeAssignableTo(returnType, expectedReturnType, node, headMessage);
67576
67564
  }
67577
67565
  function markTypeNodeAsReferenced(node) {
67578
- markEntityNameOrEntityExpressionAsReference(node && ts.getEntityNameFromTypeNode(node));
67566
+ markEntityNameOrEntityExpressionAsReference(node && ts.getEntityNameFromTypeNode(node), false);
67579
67567
  }
67580
- function markEntityNameOrEntityExpressionAsReference(typeName) {
67568
+ function markEntityNameOrEntityExpressionAsReference(typeName, forDecoratorMetadata) {
67581
67569
  if (!typeName)
67582
67570
  return;
67583
67571
  var rootName = ts.getFirstIdentifier(typeName);
67584
67572
  var meaning = (typeName.kind === 79 ? 788968 : 1920) | 2097152;
67585
67573
  var rootSymbol = resolveName(rootName, rootName.escapedText, meaning, undefined, undefined, true);
67586
- if (rootSymbol
67587
- && rootSymbol.flags & 2097152
67588
- && symbolIsValue(rootSymbol)
67589
- && !isConstEnumOrConstEnumOnlyModule(resolveAlias(rootSymbol))
67590
- && !getTypeOnlyAliasDeclaration(rootSymbol)) {
67591
- markAliasSymbolAsReferenced(rootSymbol);
67574
+ if (rootSymbol && rootSymbol.flags & 2097152) {
67575
+ if (symbolIsValue(rootSymbol)
67576
+ && !isConstEnumOrConstEnumOnlyModule(resolveAlias(rootSymbol))
67577
+ && !getTypeOnlyAliasDeclaration(rootSymbol)) {
67578
+ markAliasSymbolAsReferenced(rootSymbol);
67579
+ }
67580
+ else if (forDecoratorMetadata
67581
+ && compilerOptions.isolatedModules
67582
+ && ts.getEmitModuleKind(compilerOptions) >= ts.ModuleKind.ES2015
67583
+ && !symbolIsValue(rootSymbol)
67584
+ && !ts.some(rootSymbol.declarations, ts.isTypeOnlyImportOrExportDeclaration)) {
67585
+ 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);
67586
+ var aliasDeclaration = ts.find(rootSymbol.declarations || ts.emptyArray, isAliasSymbolDeclaration);
67587
+ if (aliasDeclaration) {
67588
+ ts.addRelatedInfo(diag, ts.createDiagnosticForNode(aliasDeclaration, ts.Diagnostics._0_was_imported_here, ts.idText(rootName)));
67589
+ }
67590
+ }
67592
67591
  }
67593
67592
  }
67594
67593
  function markDecoratorMedataDataTypeNodeAsReferenced(node) {
67595
67594
  var entityName = getEntityNameForDecoratorMetadata(node);
67596
67595
  if (entityName && ts.isEntityName(entityName)) {
67597
- markEntityNameOrEntityExpressionAsReference(entityName);
67596
+ markEntityNameOrEntityExpressionAsReference(entityName, true);
67598
67597
  }
67599
67598
  }
67600
67599
  function getEntityNameForDecoratorMetadata(node) {
@@ -67703,7 +67702,8 @@ var ts;
67703
67702
  ts.forEach(node.decorators, checkDecorator);
67704
67703
  }
67705
67704
  function checkFunctionDeclaration(node) {
67706
- if (produceDiagnostics) {
67705
+ addLazyDiagnostic(checkFunctionDeclarationDiagnostics);
67706
+ function checkFunctionDeclarationDiagnostics() {
67707
67707
  checkFunctionOrMethodDeclaration(node);
67708
67708
  checkGrammarForGenerator(node);
67709
67709
  checkCollisionsForDeclarationName(node, node.name);
@@ -67736,10 +67736,13 @@ var ts;
67736
67736
  checkSourceElement(node.typeExpression);
67737
67737
  }
67738
67738
  function checkJSDocFunctionType(node) {
67739
- if (produceDiagnostics && !node.type && !ts.isJSDocConstructSignature(node)) {
67740
- reportImplicitAny(node, anyType);
67741
- }
67739
+ addLazyDiagnostic(checkJSDocFunctionTypeImplicitAny);
67742
67740
  checkSignatureDeclaration(node);
67741
+ function checkJSDocFunctionTypeImplicitAny() {
67742
+ if (!node.type && !ts.isJSDocConstructSignature(node)) {
67743
+ reportImplicitAny(node, anyType);
67744
+ }
67745
+ }
67743
67746
  }
67744
67747
  function checkJSDocImplementsTag(node) {
67745
67748
  var classLike = ts.getEffectiveJSDocHost(node);
@@ -67805,23 +67808,27 @@ var ts;
67805
67808
  var body = node.kind === 167 ? undefined : node.body;
67806
67809
  checkSourceElement(body);
67807
67810
  checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, getReturnTypeFromAnnotation(node));
67808
- if (produceDiagnostics && !ts.getEffectiveReturnTypeNode(node)) {
67809
- if (ts.nodeIsMissing(body) && !isPrivateWithinAmbient(node)) {
67810
- reportImplicitAny(node, anyType);
67811
- }
67812
- if (functionFlags & 1 && ts.nodeIsPresent(body)) {
67813
- getReturnTypeOfSignature(getSignatureFromDeclaration(node));
67814
- }
67815
- }
67811
+ addLazyDiagnostic(checkFunctionOrMethodDeclarationDiagnostics);
67816
67812
  if (ts.isInJSFile(node)) {
67817
67813
  var typeTag = ts.getJSDocTypeTag(node);
67818
67814
  if (typeTag && typeTag.typeExpression && !getContextualCallSignature(getTypeFromTypeNode(typeTag.typeExpression), node)) {
67819
67815
  error(typeTag.typeExpression.type, ts.Diagnostics.The_type_of_a_function_declaration_must_match_the_function_s_signature);
67820
67816
  }
67821
67817
  }
67818
+ function checkFunctionOrMethodDeclarationDiagnostics() {
67819
+ if (!ts.getEffectiveReturnTypeNode(node)) {
67820
+ if (ts.nodeIsMissing(body) && !isPrivateWithinAmbient(node)) {
67821
+ reportImplicitAny(node, anyType);
67822
+ }
67823
+ if (functionFlags & 1 && ts.nodeIsPresent(body)) {
67824
+ getReturnTypeOfSignature(getSignatureFromDeclaration(node));
67825
+ }
67826
+ }
67827
+ }
67822
67828
  }
67823
67829
  function registerForUnusedIdentifiersCheck(node) {
67824
- if (produceDiagnostics) {
67830
+ addLazyDiagnostic(registerForUnusedIdentifiersCheckDiagnostics);
67831
+ function registerForUnusedIdentifiersCheckDiagnostics() {
67825
67832
  var sourceFile = ts.getSourceFileOfNode(node);
67826
67833
  var potentiallyUnusedIdentifiers = allPotentiallyUnusedIdentifiers.get(sourceFile.path);
67827
67834
  if (!potentiallyUnusedIdentifiers) {
@@ -69250,22 +69257,27 @@ var ts;
69250
69257
  hasDuplicateDefaultClause = true;
69251
69258
  }
69252
69259
  }
69253
- if (produceDiagnostics && clause.kind === 288) {
69254
- var caseType = checkExpression(clause.expression);
69255
- var caseIsLiteral = isLiteralType(caseType);
69256
- var comparedExpressionType = expressionType;
69257
- if (!caseIsLiteral || !expressionIsLiteral) {
69258
- caseType = caseIsLiteral ? getBaseTypeOfLiteralType(caseType) : caseType;
69259
- comparedExpressionType = getBaseTypeOfLiteralType(expressionType);
69260
- }
69261
- if (!isTypeEqualityComparableTo(comparedExpressionType, caseType)) {
69262
- checkTypeComparableTo(caseType, comparedExpressionType, clause.expression, undefined);
69263
- }
69260
+ if (clause.kind === 288) {
69261
+ addLazyDiagnostic(createLazyCaseClauseDiagnostics(clause));
69264
69262
  }
69265
69263
  ts.forEach(clause.statements, checkSourceElement);
69266
69264
  if (compilerOptions.noFallthroughCasesInSwitch && clause.fallthroughFlowNode && isReachableFlowNode(clause.fallthroughFlowNode)) {
69267
69265
  error(clause, ts.Diagnostics.Fallthrough_case_in_switch);
69268
69266
  }
69267
+ function createLazyCaseClauseDiagnostics(clause) {
69268
+ return function () {
69269
+ var caseType = checkExpression(clause.expression);
69270
+ var caseIsLiteral = isLiteralType(caseType);
69271
+ var comparedExpressionType = expressionType;
69272
+ if (!caseIsLiteral || !expressionIsLiteral) {
69273
+ caseType = caseIsLiteral ? getBaseTypeOfLiteralType(caseType) : caseType;
69274
+ comparedExpressionType = getBaseTypeOfLiteralType(expressionType);
69275
+ }
69276
+ if (!isTypeEqualityComparableTo(comparedExpressionType, caseType)) {
69277
+ checkTypeComparableTo(caseType, comparedExpressionType, clause.expression, undefined);
69278
+ }
69279
+ };
69280
+ }
69269
69281
  });
69270
69282
  if (node.caseBlock.locals) {
69271
69283
  registerForUnusedIdentifiersCheck(node.caseBlock);
@@ -69465,26 +69477,29 @@ var ts;
69465
69477
  }
69466
69478
  }
69467
69479
  function checkTypeParameters(typeParameterDeclarations) {
69480
+ var seenDefault = false;
69468
69481
  if (typeParameterDeclarations) {
69469
- var seenDefault = false;
69470
69482
  for (var i = 0; i < typeParameterDeclarations.length; i++) {
69471
69483
  var node = typeParameterDeclarations[i];
69472
69484
  checkTypeParameter(node);
69473
- if (produceDiagnostics) {
69474
- if (node.default) {
69475
- seenDefault = true;
69476
- checkTypeParametersNotReferenced(node.default, typeParameterDeclarations, i);
69477
- }
69478
- else if (seenDefault) {
69479
- error(node, ts.Diagnostics.Required_type_parameters_may_not_follow_optional_type_parameters);
69480
- }
69481
- for (var j = 0; j < i; j++) {
69482
- if (typeParameterDeclarations[j].symbol === node.symbol) {
69483
- error(node.name, ts.Diagnostics.Duplicate_identifier_0, ts.declarationNameToString(node.name));
69484
- }
69485
+ addLazyDiagnostic(createCheckTypeParameterDiagnostic(node, i));
69486
+ }
69487
+ }
69488
+ function createCheckTypeParameterDiagnostic(node, i) {
69489
+ return function () {
69490
+ if (node.default) {
69491
+ seenDefault = true;
69492
+ checkTypeParametersNotReferenced(node.default, typeParameterDeclarations, i);
69493
+ }
69494
+ else if (seenDefault) {
69495
+ error(node, ts.Diagnostics.Required_type_parameters_may_not_follow_optional_type_parameters);
69496
+ }
69497
+ for (var j = 0; j < i; j++) {
69498
+ if (typeParameterDeclarations[j].symbol === node.symbol) {
69499
+ error(node.name, ts.Diagnostics.Duplicate_identifier_0, ts.declarationNameToString(node.name));
69485
69500
  }
69486
69501
  }
69487
- }
69502
+ };
69488
69503
  }
69489
69504
  }
69490
69505
  function checkTypeParametersNotReferenced(root, typeParameters, index) {
@@ -69602,82 +69617,87 @@ var ts;
69602
69617
  if (extendsNode && extendsNode !== baseTypeNode) {
69603
69618
  checkExpression(extendsNode.expression);
69604
69619
  }
69605
- var baseTypes = getBaseTypes(type);
69606
- if (baseTypes.length && produceDiagnostics) {
69607
- var baseType_1 = baseTypes[0];
69608
- var baseConstructorType = getBaseConstructorTypeOfClass(type);
69609
- var staticBaseType = getApparentType(baseConstructorType);
69610
- checkBaseTypeAccessibility(staticBaseType, baseTypeNode);
69611
- checkSourceElement(baseTypeNode.expression);
69612
- if (ts.some(baseTypeNode.typeArguments)) {
69613
- ts.forEach(baseTypeNode.typeArguments, checkSourceElement);
69614
- for (var _i = 0, _a = getConstructorsForTypeArguments(staticBaseType, baseTypeNode.typeArguments, baseTypeNode); _i < _a.length; _i++) {
69615
- var constructor = _a[_i];
69616
- if (!checkTypeArgumentConstraints(baseTypeNode, constructor.typeParameters)) {
69617
- break;
69620
+ var baseTypes_2 = getBaseTypes(type);
69621
+ if (baseTypes_2.length) {
69622
+ addLazyDiagnostic(function () {
69623
+ var baseType = baseTypes_2[0];
69624
+ var baseConstructorType = getBaseConstructorTypeOfClass(type);
69625
+ var staticBaseType = getApparentType(baseConstructorType);
69626
+ checkBaseTypeAccessibility(staticBaseType, baseTypeNode);
69627
+ checkSourceElement(baseTypeNode.expression);
69628
+ if (ts.some(baseTypeNode.typeArguments)) {
69629
+ ts.forEach(baseTypeNode.typeArguments, checkSourceElement);
69630
+ for (var _i = 0, _a = getConstructorsForTypeArguments(staticBaseType, baseTypeNode.typeArguments, baseTypeNode); _i < _a.length; _i++) {
69631
+ var constructor = _a[_i];
69632
+ if (!checkTypeArgumentConstraints(baseTypeNode, constructor.typeParameters)) {
69633
+ break;
69634
+ }
69618
69635
  }
69619
69636
  }
69620
- }
69621
- var baseWithThis = getTypeWithThisArgument(baseType_1, type.thisType);
69622
- if (!checkTypeAssignableTo(typeWithThis, baseWithThis, undefined)) {
69623
- issueMemberSpecificError(node, typeWithThis, baseWithThis, ts.Diagnostics.Class_0_incorrectly_extends_base_class_1);
69624
- }
69625
- else {
69626
- checkTypeAssignableTo(staticType, getTypeWithoutSignatures(staticBaseType), node.name || node, ts.Diagnostics.Class_static_side_0_incorrectly_extends_base_class_static_side_1);
69627
- }
69628
- if (baseConstructorType.flags & 8650752) {
69629
- if (!isMixinConstructorType(staticType)) {
69630
- error(node.name || node, ts.Diagnostics.A_mixin_class_must_have_a_constructor_with_a_single_rest_parameter_of_type_any);
69637
+ var baseWithThis = getTypeWithThisArgument(baseType, type.thisType);
69638
+ if (!checkTypeAssignableTo(typeWithThis, baseWithThis, undefined)) {
69639
+ issueMemberSpecificError(node, typeWithThis, baseWithThis, ts.Diagnostics.Class_0_incorrectly_extends_base_class_1);
69631
69640
  }
69632
69641
  else {
69633
- var constructSignatures = getSignaturesOfType(baseConstructorType, 1);
69634
- if (constructSignatures.some(function (signature) { return signature.flags & 4; }) && !ts.hasSyntacticModifier(node, 128)) {
69635
- error(node.name || node, ts.Diagnostics.A_mixin_class_that_extends_from_a_type_variable_containing_an_abstract_construct_signature_must_also_be_declared_abstract);
69642
+ checkTypeAssignableTo(staticType, getTypeWithoutSignatures(staticBaseType), node.name || node, ts.Diagnostics.Class_static_side_0_incorrectly_extends_base_class_static_side_1);
69643
+ }
69644
+ if (baseConstructorType.flags & 8650752) {
69645
+ if (!isMixinConstructorType(staticType)) {
69646
+ error(node.name || node, ts.Diagnostics.A_mixin_class_must_have_a_constructor_with_a_single_rest_parameter_of_type_any);
69647
+ }
69648
+ else {
69649
+ var constructSignatures = getSignaturesOfType(baseConstructorType, 1);
69650
+ if (constructSignatures.some(function (signature) { return signature.flags & 4; }) && !ts.hasSyntacticModifier(node, 128)) {
69651
+ error(node.name || node, ts.Diagnostics.A_mixin_class_that_extends_from_a_type_variable_containing_an_abstract_construct_signature_must_also_be_declared_abstract);
69652
+ }
69636
69653
  }
69637
69654
  }
69638
- }
69639
- if (!(staticBaseType.symbol && staticBaseType.symbol.flags & 32) && !(baseConstructorType.flags & 8650752)) {
69640
- var constructors = getInstantiatedConstructorsForTypeArguments(staticBaseType, baseTypeNode.typeArguments, baseTypeNode);
69641
- if (ts.forEach(constructors, function (sig) { return !isJSConstructor(sig.declaration) && !isTypeIdenticalTo(getReturnTypeOfSignature(sig), baseType_1); })) {
69642
- error(baseTypeNode.expression, ts.Diagnostics.Base_constructors_must_all_have_the_same_return_type);
69655
+ if (!(staticBaseType.symbol && staticBaseType.symbol.flags & 32) && !(baseConstructorType.flags & 8650752)) {
69656
+ var constructors = getInstantiatedConstructorsForTypeArguments(staticBaseType, baseTypeNode.typeArguments, baseTypeNode);
69657
+ if (ts.forEach(constructors, function (sig) { return !isJSConstructor(sig.declaration) && !isTypeIdenticalTo(getReturnTypeOfSignature(sig), baseType); })) {
69658
+ error(baseTypeNode.expression, ts.Diagnostics.Base_constructors_must_all_have_the_same_return_type);
69659
+ }
69643
69660
  }
69644
- }
69645
- checkKindsOfPropertyMemberOverrides(type, baseType_1);
69661
+ checkKindsOfPropertyMemberOverrides(type, baseType);
69662
+ });
69646
69663
  }
69647
69664
  }
69648
69665
  checkMembersForOverrideModifier(node, type, typeWithThis, staticType);
69649
69666
  var implementedTypeNodes = ts.getEffectiveImplementsTypeNodes(node);
69650
69667
  if (implementedTypeNodes) {
69651
- for (var _b = 0, implementedTypeNodes_1 = implementedTypeNodes; _b < implementedTypeNodes_1.length; _b++) {
69652
- var typeRefNode = implementedTypeNodes_1[_b];
69668
+ for (var _i = 0, implementedTypeNodes_1 = implementedTypeNodes; _i < implementedTypeNodes_1.length; _i++) {
69669
+ var typeRefNode = implementedTypeNodes_1[_i];
69653
69670
  if (!ts.isEntityNameExpression(typeRefNode.expression) || ts.isOptionalChain(typeRefNode.expression)) {
69654
69671
  error(typeRefNode.expression, ts.Diagnostics.A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments);
69655
69672
  }
69656
69673
  checkTypeReferenceNode(typeRefNode);
69657
- if (produceDiagnostics) {
69658
- var t = getReducedType(getTypeFromTypeNode(typeRefNode));
69659
- if (!isErrorType(t)) {
69660
- if (isValidBaseType(t)) {
69661
- var genericDiag = t.symbol && t.symbol.flags & 32 ?
69662
- ts.Diagnostics.Class_0_incorrectly_implements_class_1_Did_you_mean_to_extend_1_and_inherit_its_members_as_a_subclass :
69663
- ts.Diagnostics.Class_0_incorrectly_implements_interface_1;
69664
- var baseWithThis = getTypeWithThisArgument(t, type.thisType);
69665
- if (!checkTypeAssignableTo(typeWithThis, baseWithThis, undefined)) {
69666
- issueMemberSpecificError(node, typeWithThis, baseWithThis, genericDiag);
69667
- }
69668
- }
69669
- else {
69670
- error(typeRefNode, ts.Diagnostics.A_class_can_only_implement_an_object_type_or_intersection_of_object_types_with_statically_known_members);
69671
- }
69672
- }
69673
- }
69674
+ addLazyDiagnostic(createImplementsDiagnostics(typeRefNode));
69674
69675
  }
69675
69676
  }
69676
- if (produceDiagnostics) {
69677
+ addLazyDiagnostic(function () {
69677
69678
  checkIndexConstraints(type, symbol);
69678
69679
  checkIndexConstraints(staticType, symbol, true);
69679
69680
  checkTypeForDuplicateIndexSignatures(node);
69680
69681
  checkPropertyInitialization(node);
69682
+ });
69683
+ function createImplementsDiagnostics(typeRefNode) {
69684
+ return function () {
69685
+ var t = getReducedType(getTypeFromTypeNode(typeRefNode));
69686
+ if (!isErrorType(t)) {
69687
+ if (isValidBaseType(t)) {
69688
+ var genericDiag = t.symbol && t.symbol.flags & 32 ?
69689
+ ts.Diagnostics.Class_0_incorrectly_implements_class_1_Did_you_mean_to_extend_1_and_inherit_its_members_as_a_subclass :
69690
+ ts.Diagnostics.Class_0_incorrectly_implements_interface_1;
69691
+ var baseWithThis = getTypeWithThisArgument(t, type.thisType);
69692
+ if (!checkTypeAssignableTo(typeWithThis, baseWithThis, undefined)) {
69693
+ issueMemberSpecificError(node, typeWithThis, baseWithThis, genericDiag);
69694
+ }
69695
+ }
69696
+ else {
69697
+ error(typeRefNode, ts.Diagnostics.A_class_can_only_implement_an_object_type_or_intersection_of_object_types_with_statically_known_members);
69698
+ }
69699
+ }
69700
+ };
69681
69701
  }
69682
69702
  }
69683
69703
  function checkMembersForOverrideModifier(node, type, typeWithThis, staticType) {
@@ -69944,8 +69964,8 @@ var ts;
69944
69964
  ts.forEach(properties, function (p) {
69945
69965
  seen.set(p.escapedName, p);
69946
69966
  });
69947
- for (var _i = 0, baseTypes_2 = baseTypes; _i < baseTypes_2.length; _i++) {
69948
- var base = baseTypes_2[_i];
69967
+ for (var _i = 0, baseTypes_3 = baseTypes; _i < baseTypes_3.length; _i++) {
69968
+ var base = baseTypes_3[_i];
69949
69969
  var properties_5 = getPropertiesOfType(getTypeWithThisArgument(base, type.thisType));
69950
69970
  for (var _a = 0, properties_4 = properties_5; _a < properties_4.length; _a++) {
69951
69971
  var prop = properties_4[_a];
@@ -69967,8 +69987,8 @@ var ts;
69967
69987
  seen.set(p.escapedName, { prop: p, containingType: type });
69968
69988
  });
69969
69989
  var ok = true;
69970
- for (var _i = 0, baseTypes_3 = baseTypes; _i < baseTypes_3.length; _i++) {
69971
- var base = baseTypes_3[_i];
69990
+ for (var _i = 0, baseTypes_4 = baseTypes; _i < baseTypes_4.length; _i++) {
69991
+ var base = baseTypes_4[_i];
69972
69992
  var properties = getPropertiesOfType(getTypeWithThisArgument(base, type.thisType));
69973
69993
  for (var _a = 0, properties_6 = properties; _a < properties_6.length; _a++) {
69974
69994
  var prop = properties_6[_a];
@@ -70050,7 +70070,7 @@ var ts;
70050
70070
  if (!checkGrammarDecoratorsAndModifiers(node))
70051
70071
  checkGrammarInterfaceDeclaration(node);
70052
70072
  checkTypeParameters(node.typeParameters);
70053
- if (produceDiagnostics) {
70073
+ addLazyDiagnostic(function () {
70054
70074
  checkTypeNameIsReserved(node.name, ts.Diagnostics.Interface_name_cannot_be_0);
70055
70075
  checkExportsOnMergedDeclarations(node);
70056
70076
  var symbol = getSymbolOfNode(node);
@@ -70068,7 +70088,7 @@ var ts;
70068
70088
  }
70069
70089
  }
70070
70090
  checkObjectTypeForDuplicateDeclarations(node);
70071
- }
70091
+ });
70072
70092
  ts.forEach(ts.getInterfaceBaseTypeNodes(node), function (heritageElement) {
70073
70093
  if (!ts.isEntityNameExpression(heritageElement.expression) || ts.isOptionalChain(heritageElement.expression)) {
70074
70094
  error(heritageElement.expression, ts.Diagnostics.An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments);
@@ -70076,10 +70096,10 @@ var ts;
70076
70096
  checkTypeReferenceNode(heritageElement);
70077
70097
  });
70078
70098
  ts.forEach(node.members, checkSourceElement);
70079
- if (produceDiagnostics) {
70099
+ addLazyDiagnostic(function () {
70080
70100
  checkTypeForDuplicateIndexSignatures(node);
70081
70101
  registerForUnusedIdentifiersCheck(node);
70082
- }
70102
+ });
70083
70103
  }
70084
70104
  function checkTypeAliasDeclaration(node) {
70085
70105
  checkGrammarDecoratorsAndModifiers(node);
@@ -70260,9 +70280,9 @@ var ts;
70260
70280
  ts.isStringLiteralLike(node.argumentExpression);
70261
70281
  }
70262
70282
  function checkEnumDeclaration(node) {
70263
- if (!produceDiagnostics) {
70264
- return;
70265
- }
70283
+ addLazyDiagnostic(function () { return checkEnumDeclarationWorker(node); });
70284
+ }
70285
+ function checkEnumDeclarationWorker(node) {
70266
70286
  checkGrammarDecoratorsAndModifiers(node);
70267
70287
  checkCollisionsForDeclarationName(node, node.name);
70268
70288
  checkExportsOnMergedDeclarations(node);
@@ -70333,7 +70353,14 @@ var ts;
70333
70353
  }
70334
70354
  }
70335
70355
  function checkModuleDeclaration(node) {
70336
- if (produceDiagnostics) {
70356
+ if (node.body) {
70357
+ checkSourceElement(node.body);
70358
+ if (!ts.isGlobalScopeAugmentation(node)) {
70359
+ registerForUnusedIdentifiersCheck(node);
70360
+ }
70361
+ }
70362
+ addLazyDiagnostic(checkModuleDeclarationDiagnostics);
70363
+ function checkModuleDeclarationDiagnostics() {
70337
70364
  var isGlobalAugmentation = ts.isGlobalScopeAugmentation(node);
70338
70365
  var inAmbientContext = node.flags & 8388608;
70339
70366
  if (isGlobalAugmentation && !inAmbientContext) {
@@ -70404,12 +70431,6 @@ var ts;
70404
70431
  }
70405
70432
  }
70406
70433
  }
70407
- if (node.body) {
70408
- checkSourceElement(node.body);
70409
- if (!ts.isGlobalScopeAugmentation(node)) {
70410
- registerForUnusedIdentifiersCheck(node);
70411
- }
70412
- }
70413
70434
  }
70414
70435
  function checkModuleAugmentationElement(node, isGlobalAugmentation) {
70415
70436
  var _a;
@@ -70705,7 +70726,7 @@ var ts;
70705
70726
  if (checkGrammarModuleElementContext(node, ts.isInJSFile(node) ? ts.Diagnostics.An_export_declaration_can_only_be_used_at_the_top_level_of_a_module : ts.Diagnostics.An_export_declaration_can_only_be_used_at_the_top_level_of_a_namespace_or_module)) {
70706
70727
  return;
70707
70728
  }
70708
- if (!checkGrammarDecoratorsAndModifiers(node) && ts.hasEffectiveModifiers(node)) {
70729
+ if (!checkGrammarDecoratorsAndModifiers(node) && ts.hasSyntacticModifiers(node)) {
70709
70730
  grammarErrorOnFirstToken(node, ts.Diagnostics.An_export_declaration_cannot_have_modifiers);
70710
70731
  }
70711
70732
  if (node.moduleSpecifier && node.exportClause && ts.isNamedExports(node.exportClause) && ts.length(node.exportClause.elements) && languageVersion === 0) {
@@ -71268,13 +71289,15 @@ var ts;
71268
71289
  if (ts.isExternalOrCommonJsModule(node)) {
71269
71290
  registerForUnusedIdentifiersCheck(node);
71270
71291
  }
71271
- if (!node.isDeclarationFile && (compilerOptions.noUnusedLocals || compilerOptions.noUnusedParameters)) {
71272
- checkUnusedIdentifiers(getPotentiallyUnusedIdentifiers(node), function (containingNode, kind, diag) {
71273
- if (!ts.containsParseError(containingNode) && unusedIsError(kind, !!(containingNode.flags & 8388608))) {
71274
- diagnostics.add(diag);
71275
- }
71276
- });
71277
- }
71292
+ addLazyDiagnostic(function () {
71293
+ if (!node.isDeclarationFile && (compilerOptions.noUnusedLocals || compilerOptions.noUnusedParameters)) {
71294
+ checkUnusedIdentifiers(getPotentiallyUnusedIdentifiers(node), function (containingNode, kind, diag) {
71295
+ if (!ts.containsParseError(containingNode) && unusedIsError(kind, !!(containingNode.flags & 8388608))) {
71296
+ diagnostics.add(diag);
71297
+ }
71298
+ });
71299
+ }
71300
+ });
71278
71301
  if (compilerOptions.importsNotUsedAsValues === 2 &&
71279
71302
  !node.isDeclarationFile &&
71280
71303
  ts.isExternalModule(node)) {
@@ -71311,12 +71334,26 @@ var ts;
71311
71334
  cancellationToken = undefined;
71312
71335
  }
71313
71336
  }
71337
+ function ensurePendingDiagnosticWorkComplete() {
71338
+ for (var _i = 0, deferredDiagnosticsCallbacks_1 = deferredDiagnosticsCallbacks; _i < deferredDiagnosticsCallbacks_1.length; _i++) {
71339
+ var cb = deferredDiagnosticsCallbacks_1[_i];
71340
+ cb();
71341
+ }
71342
+ deferredDiagnosticsCallbacks = [];
71343
+ }
71344
+ function checkSourceFileWithEagerDiagnostics(sourceFile) {
71345
+ ensurePendingDiagnosticWorkComplete();
71346
+ var oldAddLazyDiagnostics = addLazyDiagnostic;
71347
+ addLazyDiagnostic = function (cb) { return cb(); };
71348
+ checkSourceFile(sourceFile);
71349
+ addLazyDiagnostic = oldAddLazyDiagnostics;
71350
+ }
71314
71351
  function getDiagnosticsWorker(sourceFile) {
71315
- throwIfNonDiagnosticsProducing();
71316
71352
  if (sourceFile) {
71353
+ ensurePendingDiagnosticWorkComplete();
71317
71354
  var previousGlobalDiagnostics = diagnostics.getGlobalDiagnostics();
71318
71355
  var previousGlobalDiagnosticsSize = previousGlobalDiagnostics.length;
71319
- checkSourceFile(sourceFile);
71356
+ checkSourceFileWithEagerDiagnostics(sourceFile);
71320
71357
  var semanticDiagnostics = diagnostics.getDiagnostics(sourceFile.fileName);
71321
71358
  var currentGlobalDiagnostics = diagnostics.getGlobalDiagnostics();
71322
71359
  if (currentGlobalDiagnostics !== previousGlobalDiagnostics) {
@@ -71328,18 +71365,13 @@ var ts;
71328
71365
  }
71329
71366
  return semanticDiagnostics;
71330
71367
  }
71331
- ts.forEach(host.getSourceFiles(), checkSourceFile);
71368
+ ts.forEach(host.getSourceFiles(), checkSourceFileWithEagerDiagnostics);
71332
71369
  return diagnostics.getDiagnostics();
71333
71370
  }
71334
71371
  function getGlobalDiagnostics() {
71335
- throwIfNonDiagnosticsProducing();
71372
+ ensurePendingDiagnosticWorkComplete();
71336
71373
  return diagnostics.getGlobalDiagnostics();
71337
71374
  }
71338
- function throwIfNonDiagnosticsProducing() {
71339
- if (!produceDiagnostics) {
71340
- throw new Error("Trying to get diagnostics from a type checker that does not produce them.");
71341
- }
71342
- }
71343
71375
  function getSymbolsInScope(location, meaning) {
71344
71376
  if (location.flags & 16777216) {
71345
71377
  return [];
@@ -73594,9 +73626,9 @@ var ts;
73594
73626
  }
73595
73627
  var parent = ts.walkUpParenthesizedTypes(node.parent);
73596
73628
  if (ts.isInJSFile(parent) && ts.isJSDocTypeExpression(parent)) {
73597
- parent = parent.parent;
73598
- if (ts.isJSDocTypeTag(parent)) {
73599
- parent = parent.parent.parent;
73629
+ var host_2 = ts.getJSDocHost(parent);
73630
+ if (host_2) {
73631
+ parent = ts.getSingleVariableOfVariableStatement(host_2) || host_2;
73600
73632
  }
73601
73633
  }
73602
73634
  switch (parent.kind) {
@@ -95308,8 +95340,7 @@ var ts;
95308
95340
  var files;
95309
95341
  var symlinks;
95310
95342
  var commonSourceDirectory;
95311
- var diagnosticsProducingTypeChecker;
95312
- var noDiagnosticsTypeChecker;
95343
+ var typeChecker;
95313
95344
  var classifiableNames;
95314
95345
  var ambientModuleNameToUnmodifiedFileName = new ts.Map();
95315
95346
  var fileReasons = ts.createMultiMap();
@@ -95513,21 +95544,19 @@ var ts;
95513
95544
  getProgramDiagnostics: getProgramDiagnostics,
95514
95545
  getTypeChecker: getTypeChecker,
95515
95546
  getClassifiableNames: getClassifiableNames,
95516
- getDiagnosticsProducingTypeChecker: getDiagnosticsProducingTypeChecker,
95517
95547
  getCommonSourceDirectory: getCommonSourceDirectory,
95518
95548
  emit: emit,
95519
95549
  getCurrentDirectory: function () { return currentDirectory; },
95520
- getNodeCount: function () { return getDiagnosticsProducingTypeChecker().getNodeCount(); },
95521
- getIdentifierCount: function () { return getDiagnosticsProducingTypeChecker().getIdentifierCount(); },
95522
- getSymbolCount: function () { return getDiagnosticsProducingTypeChecker().getSymbolCount(); },
95523
- getTypeCount: function () { return getDiagnosticsProducingTypeChecker().getTypeCount(); },
95524
- getInstantiationCount: function () { return getDiagnosticsProducingTypeChecker().getInstantiationCount(); },
95525
- getRelationCacheSizes: function () { return getDiagnosticsProducingTypeChecker().getRelationCacheSizes(); },
95550
+ getNodeCount: function () { return getTypeChecker().getNodeCount(); },
95551
+ getIdentifierCount: function () { return getTypeChecker().getIdentifierCount(); },
95552
+ getSymbolCount: function () { return getTypeChecker().getSymbolCount(); },
95553
+ getTypeCount: function () { return getTypeChecker().getTypeCount(); },
95554
+ getInstantiationCount: function () { return getTypeChecker().getInstantiationCount(); },
95555
+ getRelationCacheSizes: function () { return getTypeChecker().getRelationCacheSizes(); },
95526
95556
  getFileProcessingDiagnostics: function () { return fileProcessingDiagnostics; },
95527
95557
  getResolvedTypeReferenceDirectives: function () { return resolvedTypeReferenceDirectives; },
95528
95558
  isSourceFileFromExternalLibrary: isSourceFileFromExternalLibrary,
95529
95559
  isSourceFileDefaultLibrary: isSourceFileDefaultLibrary,
95530
- dropDiagnosticsProducingTypeChecker: dropDiagnosticsProducingTypeChecker,
95531
95560
  getSourceFileFromReference: getSourceFileFromReference,
95532
95561
  getLibFileFromReference: getLibFileFromReference,
95533
95562
  sourceFileToPackageName: sourceFileToPackageName,
@@ -96014,14 +96043,8 @@ var ts;
96014
96043
  return ts.some(options.lib, function (libFileName) { return equalityComparer(file.fileName, pathForLibFile(libFileName)); });
96015
96044
  }
96016
96045
  }
96017
- function getDiagnosticsProducingTypeChecker() {
96018
- return diagnosticsProducingTypeChecker || (diagnosticsProducingTypeChecker = ts.createTypeChecker(program, true));
96019
- }
96020
- function dropDiagnosticsProducingTypeChecker() {
96021
- diagnosticsProducingTypeChecker = undefined;
96022
- }
96023
96046
  function getTypeChecker() {
96024
- return noDiagnosticsTypeChecker || (noDiagnosticsTypeChecker = ts.createTypeChecker(program, false));
96047
+ return typeChecker || (typeChecker = ts.createTypeChecker(program));
96025
96048
  }
96026
96049
  function emit(sourceFile, writeFileCallback, cancellationToken, emitOnlyDtsFiles, transformers, forceDtsEmit) {
96027
96050
  ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("emit", "emit", { path: sourceFile === null || sourceFile === void 0 ? void 0 : sourceFile.path }, true);
@@ -96038,7 +96061,7 @@ var ts;
96038
96061
  if (result)
96039
96062
  return result;
96040
96063
  }
96041
- var emitResolver = getDiagnosticsProducingTypeChecker().getEmitResolver(ts.outFile(options) ? undefined : sourceFile, cancellationToken);
96064
+ var emitResolver = getTypeChecker().getEmitResolver(ts.outFile(options) ? undefined : sourceFile, cancellationToken);
96042
96065
  ts.performance.mark("beforeEmit");
96043
96066
  var emitResult = ts.emitFiles(emitResolver, getEmitHost(writeFileCallback), sourceFile, ts.getTransformers(options, customTransformers, emitOnlyDtsFiles), emitOnlyDtsFiles, false, forceDtsEmit);
96044
96067
  ts.performance.mark("afterEmit");
@@ -96112,8 +96135,7 @@ var ts;
96112
96135
  }
96113
96136
  catch (e) {
96114
96137
  if (e instanceof ts.OperationCanceledException) {
96115
- noDiagnosticsTypeChecker = undefined;
96116
- diagnosticsProducingTypeChecker = undefined;
96138
+ typeChecker = undefined;
96117
96139
  }
96118
96140
  throw e;
96119
96141
  }
@@ -96129,7 +96151,7 @@ var ts;
96129
96151
  if (ts.skipTypeChecking(sourceFile, options, program)) {
96130
96152
  return ts.emptyArray;
96131
96153
  }
96132
- var typeChecker = getDiagnosticsProducingTypeChecker();
96154
+ var typeChecker = getTypeChecker();
96133
96155
  ts.Debug.assert(!!sourceFile.bindDiagnostics);
96134
96156
  var isJs = sourceFile.scriptKind === 1 || sourceFile.scriptKind === 2;
96135
96157
  var isCheckJs = isJs && ts.isCheckJsEnabledForFile(sourceFile, options);
@@ -96170,7 +96192,7 @@ var ts;
96170
96192
  }
96171
96193
  function getSuggestionDiagnostics(sourceFile, cancellationToken) {
96172
96194
  return runWithCancellationToken(function () {
96173
- return getDiagnosticsProducingTypeChecker().getSuggestionDiagnostics(sourceFile, cancellationToken);
96195
+ return getTypeChecker().getSuggestionDiagnostics(sourceFile, cancellationToken);
96174
96196
  });
96175
96197
  }
96176
96198
  function markPrecedingCommentDirectiveLine(diagnostic, directives) {
@@ -96367,7 +96389,7 @@ var ts;
96367
96389
  }
96368
96390
  function getDeclarationDiagnosticsForFileNoCache(sourceFile, cancellationToken) {
96369
96391
  return runWithCancellationToken(function () {
96370
- var resolver = getDiagnosticsProducingTypeChecker().getEmitResolver(sourceFile, cancellationToken);
96392
+ var resolver = getTypeChecker().getEmitResolver(sourceFile, cancellationToken);
96371
96393
  return ts.getDeclarationDiagnostics(getEmitHost(ts.noop), resolver, sourceFile) || ts.emptyArray;
96372
96394
  });
96373
96395
  }
@@ -96404,7 +96426,7 @@ var ts;
96404
96426
  return diagnostics;
96405
96427
  }
96406
96428
  function getGlobalDiagnostics() {
96407
- return rootNames.length ? ts.sortAndDeduplicateDiagnostics(getDiagnosticsProducingTypeChecker().getGlobalDiagnostics().slice()) : ts.emptyArray;
96429
+ return rootNames.length ? ts.sortAndDeduplicateDiagnostics(getTypeChecker().getGlobalDiagnostics().slice()) : ts.emptyArray;
96408
96430
  }
96409
96431
  function getConfigFileParsingDiagnostics() {
96410
96432
  return configFileParsingDiagnostics || ts.emptyArray;