typescript 4.8.0-dev.20220614 → 4.8.0-dev.20220617

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.
@@ -0,0 +1,25 @@
1
+ /*! *****************************************************************************
2
+ Copyright (c) Microsoft Corporation. All rights reserved.
3
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use
4
+ this file except in compliance with the License. You may obtain a copy of the
5
+ License at http://www.apache.org/licenses/LICENSE-2.0
6
+
7
+ THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
8
+ KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
9
+ WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10
+ MERCHANTABLITY OR NON-INFRINGEMENT.
11
+
12
+ See the Apache Version 2.0 License for specific language governing permissions
13
+ and limitations under the License.
14
+ ***************************************************************************** */
15
+
16
+
17
+ "use strict";
18
+ var ts;
19
+ (function (ts) {
20
+ var server;
21
+ (function (server) {
22
+ server.dynamicImport = (id) => import(id);
23
+ })(server = ts.server || (ts.server = {}));
24
+ })(ts || (ts = {}));
25
+ //# sourceMappingURL=dynamicImportCompat.js.map
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.8";
72
- ts.version = ts.versionMajorMinor + ".0-dev.20220614";
72
+ ts.version = ts.versionMajorMinor + ".0-dev.20220617";
73
73
  var NativeCollections;
74
74
  (function (NativeCollections) {
75
75
  var globals = typeof globalThis !== "undefined" ? globalThis :
@@ -5642,9 +5642,11 @@ var ts;
5642
5642
  Construct_signatures_with_no_arguments_have_incompatible_return_types_0_and_1: diag(2205, ts.DiagnosticCategory.Error, "Construct_signatures_with_no_arguments_have_incompatible_return_types_0_and_1_2205", "Construct signatures with no arguments have incompatible return types '{0}' and '{1}'.", undefined, true),
5643
5643
  The_type_modifier_cannot_be_used_on_a_named_import_when_import_type_is_used_on_its_import_statement: diag(2206, ts.DiagnosticCategory.Error, "The_type_modifier_cannot_be_used_on_a_named_import_when_import_type_is_used_on_its_import_statement_2206", "The 'type' modifier cannot be used on a named import when 'import type' is used on its import statement."),
5644
5644
  The_type_modifier_cannot_be_used_on_a_named_export_when_export_type_is_used_on_its_export_statement: diag(2207, ts.DiagnosticCategory.Error, "The_type_modifier_cannot_be_used_on_a_named_export_when_export_type_is_used_on_its_export_statement_2207", "The 'type' modifier cannot be used on a named export when 'export type' is used on its export statement."),
5645
- This_type_parameter_probably_needs_an_extends_object_constraint: diag(2208, ts.DiagnosticCategory.Error, "This_type_parameter_probably_needs_an_extends_object_constraint_2208", "This type parameter probably needs an `extends object` constraint."),
5645
+ This_type_parameter_might_need_an_extends_0_constraint: diag(2208, ts.DiagnosticCategory.Error, "This_type_parameter_might_need_an_extends_0_constraint_2208", "This type parameter might need an `extends {0}` constraint."),
5646
5646
  The_project_root_is_ambiguous_but_is_required_to_resolve_export_map_entry_0_in_file_1_Supply_the_rootDir_compiler_option_to_disambiguate: diag(2209, ts.DiagnosticCategory.Error, "The_project_root_is_ambiguous_but_is_required_to_resolve_export_map_entry_0_in_file_1_Supply_the_roo_2209", "The project root is ambiguous, but is required to resolve export map entry '{0}' in file '{1}'. Supply the `rootDir` compiler option to disambiguate."),
5647
5647
  The_project_root_is_ambiguous_but_is_required_to_resolve_import_map_entry_0_in_file_1_Supply_the_rootDir_compiler_option_to_disambiguate: diag(2210, ts.DiagnosticCategory.Error, "The_project_root_is_ambiguous_but_is_required_to_resolve_import_map_entry_0_in_file_1_Supply_the_roo_2210", "The project root is ambiguous, but is required to resolve import map entry '{0}' in file '{1}'. Supply the `rootDir` compiler option to disambiguate."),
5648
+ Add_extends_constraint: diag(2211, ts.DiagnosticCategory.Message, "Add_extends_constraint_2211", "Add `extends` constraint."),
5649
+ Add_extends_constraint_to_all_type_parameters: diag(2212, ts.DiagnosticCategory.Message, "Add_extends_constraint_to_all_type_parameters_2212", "Add `extends` constraint to all type parameters"),
5648
5650
  Duplicate_identifier_0: diag(2300, ts.DiagnosticCategory.Error, "Duplicate_identifier_0_2300", "Duplicate identifier '{0}'."),
5649
5651
  Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: diag(2301, ts.DiagnosticCategory.Error, "Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2301", "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor."),
5650
5652
  Static_members_cannot_reference_class_type_parameters: diag(2302, ts.DiagnosticCategory.Error, "Static_members_cannot_reference_class_type_parameters_2302", "Static members cannot reference class type parameters."),
@@ -6130,6 +6132,8 @@ var ts;
6130
6132
  This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value: diag(2839, ts.DiagnosticCategory.Error, "This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value_2839", "This condition will always return '{0}' since JavaScript compares objects by reference, not value."),
6131
6133
  An_interface_cannot_extend_a_primitive_type_like_0_an_interface_can_only_extend_named_types_and_classes: diag(2840, ts.DiagnosticCategory.Error, "An_interface_cannot_extend_a_primitive_type_like_0_an_interface_can_only_extend_named_types_and_clas_2840", "An interface cannot extend a primitive type like '{0}'; an interface can only extend named types and classes"),
6132
6134
  The_type_of_this_expression_cannot_be_named_without_a_resolution_mode_assertion_which_is_an_unstable_feature_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next: diag(2841, ts.DiagnosticCategory.Error, "The_type_of_this_expression_cannot_be_named_without_a_resolution_mode_assertion_which_is_an_unstable_2841", "The type of this expression cannot be named without a 'resolution-mode' assertion, which is an unstable feature. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'."),
6135
+ _0_is_an_unused_renaming_of_1_Did_you_intend_to_use_it_as_a_type_annotation: diag(2842, ts.DiagnosticCategory.Error, "_0_is_an_unused_renaming_of_1_Did_you_intend_to_use_it_as_a_type_annotation_2842", "'{0}' is an unused renaming of '{1}'. Did you intend to use it as a type annotation?"),
6136
+ We_can_only_write_a_type_for_0_by_adding_a_type_for_the_entire_parameter_here: diag(2843, ts.DiagnosticCategory.Error, "We_can_only_write_a_type_for_0_by_adding_a_type_for_the_entire_parameter_here_2843", "We can only write a type for '{0}' by adding a type for the entire parameter here."),
6133
6137
  Import_declaration_0_is_using_private_name_1: diag(4000, ts.DiagnosticCategory.Error, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."),
6134
6138
  Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", "Type parameter '{0}' of exported class has or is using private name '{1}'."),
6135
6139
  Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", "Type parameter '{0}' of exported interface has or is using private name '{1}'."),
@@ -6827,6 +6831,8 @@ var ts;
6827
6831
  Qualified_name_0_is_not_allowed_without_a_leading_param_object_1: diag(8032, ts.DiagnosticCategory.Error, "Qualified_name_0_is_not_allowed_without_a_leading_param_object_1_8032", "Qualified name '{0}' is not allowed without a leading '@param {object} {1}'."),
6828
6832
  A_JSDoc_typedef_comment_may_not_contain_multiple_type_tags: diag(8033, ts.DiagnosticCategory.Error, "A_JSDoc_typedef_comment_may_not_contain_multiple_type_tags_8033", "A JSDoc '@typedef' comment may not contain multiple '@type' tags."),
6829
6833
  The_tag_was_first_specified_here: diag(8034, ts.DiagnosticCategory.Error, "The_tag_was_first_specified_here_8034", "The tag was first specified here."),
6834
+ You_cannot_rename_elements_that_are_defined_in_a_node_modules_folder: diag(8035, ts.DiagnosticCategory.Error, "You_cannot_rename_elements_that_are_defined_in_a_node_modules_folder_8035", "You cannot rename elements that are defined in a 'node_modules' folder."),
6835
+ You_cannot_rename_elements_that_are_defined_in_another_node_modules_folder: diag(8036, ts.DiagnosticCategory.Error, "You_cannot_rename_elements_that_are_defined_in_another_node_modules_folder_8036", "You cannot rename elements that are defined in another 'node_modules' folder."),
6830
6836
  Declaration_emit_for_this_file_requires_using_private_name_0_An_explicit_type_annotation_may_unblock_declaration_emit: diag(9005, ts.DiagnosticCategory.Error, "Declaration_emit_for_this_file_requires_using_private_name_0_An_explicit_type_annotation_may_unblock_9005", "Declaration emit for this file requires using private name '{0}'. An explicit type annotation may unblock declaration emit."),
6831
6837
  Declaration_emit_for_this_file_requires_using_private_name_0_from_module_1_An_explicit_type_annotation_may_unblock_declaration_emit: diag(9006, ts.DiagnosticCategory.Error, "Declaration_emit_for_this_file_requires_using_private_name_0_from_module_1_An_explicit_type_annotati_9006", "Declaration emit for this file requires using private name '{0}' from module '{1}'. An explicit type annotation may unblock declaration emit."),
6832
6838
  JSX_attributes_must_only_be_assigned_a_non_empty_expression: diag(17000, ts.DiagnosticCategory.Error, "JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000", "JSX attributes must only be assigned a non-empty 'expression'."),
@@ -28776,9 +28782,10 @@ var ts;
28776
28782
  }
28777
28783
  nextToken();
28778
28784
  var typeArguments = parseDelimitedList(20, parseType);
28779
- if (!parseExpected(31)) {
28785
+ if (reScanGreaterToken() !== 31) {
28780
28786
  return undefined;
28781
28787
  }
28788
+ nextToken();
28782
28789
  return typeArguments && canFollowTypeArgumentsInExpression() ? typeArguments : undefined;
28783
28790
  }
28784
28791
  function canFollowTypeArgumentsInExpression() {
@@ -40060,9 +40067,9 @@ var ts;
40060
40067
  return moduleSpecifier && resolveExternalModuleName(moduleSpecifier, moduleSpecifier, true);
40061
40068
  },
40062
40069
  resolveExternalModuleSymbol: resolveExternalModuleSymbol,
40063
- tryGetThisTypeAt: function (nodeIn, includeGlobalThis) {
40070
+ tryGetThisTypeAt: function (nodeIn, includeGlobalThis, container) {
40064
40071
  var node = ts.getParseTreeNode(nodeIn);
40065
- return node && tryGetThisTypeAt(node, includeGlobalThis);
40072
+ return node && tryGetThisTypeAt(node, includeGlobalThis, container);
40066
40073
  },
40067
40074
  getTypeArgumentConstraint: function (nodeIn) {
40068
40075
  var node = ts.getParseTreeNode(nodeIn, ts.isTypeNode);
@@ -40342,6 +40349,7 @@ var ts;
40342
40349
  var potentialNewTargetCollisions = [];
40343
40350
  var potentialWeakMapSetCollisions = [];
40344
40351
  var potentialReflectCollisions = [];
40352
+ var potentialUnusedRenamedBindingElementsInTypes = [];
40345
40353
  var awaitedTypeStack = [];
40346
40354
  var diagnostics = ts.createDiagnosticCollection();
40347
40355
  var suggestionDiagnostics = ts.createDiagnosticCollection();
@@ -43217,6 +43225,9 @@ var ts;
43217
43225
  if (symbol && symbol.flags & 262144 && meaning & 788968) {
43218
43226
  return { accessibility: 0 };
43219
43227
  }
43228
+ if (!symbol && ts.isThisIdentifier(firstIdentifier) && isSymbolAccessible(getSymbolOfNode(ts.getThisContainer(firstIdentifier, false)), firstIdentifier, meaning, false).accessibility === 0) {
43229
+ return { accessibility: 0 };
43230
+ }
43220
43231
  return (symbol && hasVisibleDeclarations(symbol, true)) || {
43221
43232
  accessibility: 1,
43222
43233
  errorSymbolName: ts.getTextOfNode(firstIdentifier),
@@ -44315,14 +44326,19 @@ var ts;
44315
44326
  context.approximateLength += ts.symbolName(parameterSymbol).length + 3;
44316
44327
  return parameterNode;
44317
44328
  function cloneBindingName(node) {
44318
- return elideInitializerAndSetEmitFlags(node);
44319
- function elideInitializerAndSetEmitFlags(node) {
44329
+ return elideInitializerAndPropertyRenamingAndSetEmitFlags(node);
44330
+ function elideInitializerAndPropertyRenamingAndSetEmitFlags(node) {
44320
44331
  if (context.tracker.trackSymbol && ts.isComputedPropertyName(node) && isLateBindableName(node)) {
44321
44332
  trackComputedName(node.expression, context.enclosingDeclaration, context);
44322
44333
  }
44323
- var visited = ts.visitEachChild(node, elideInitializerAndSetEmitFlags, ts.nullTransformationContext, undefined, elideInitializerAndSetEmitFlags);
44334
+ var visited = ts.visitEachChild(node, elideInitializerAndPropertyRenamingAndSetEmitFlags, ts.nullTransformationContext, undefined, elideInitializerAndPropertyRenamingAndSetEmitFlags);
44324
44335
  if (ts.isBindingElement(visited)) {
44325
- visited = ts.factory.updateBindingElement(visited, visited.dotDotDotToken, visited.propertyName, visited.name, undefined);
44336
+ if (visited.propertyName && ts.isIdentifier(visited.propertyName) && ts.isIdentifier(visited.name)) {
44337
+ visited = ts.factory.updateBindingElement(visited, visited.dotDotDotToken, undefined, visited.propertyName, undefined);
44338
+ }
44339
+ else {
44340
+ visited = ts.factory.updateBindingElement(visited, visited.dotDotDotToken, visited.propertyName, visited.name, undefined);
44341
+ }
44326
44342
  }
44327
44343
  if (!ts.nodeIsSynthesized(visited)) {
44328
44344
  visited = ts.factory.cloneNode(visited);
@@ -49153,7 +49169,7 @@ var ts;
49153
49169
  }
49154
49170
  if (t.flags & 268435456) {
49155
49171
  var constraint = getBaseConstraint(t.type);
49156
- return constraint ? getStringMappingType(t.symbol, constraint) : stringType;
49172
+ return constraint && constraint !== t.type ? getStringMappingType(t.symbol, constraint) : stringType;
49157
49173
  }
49158
49174
  if (t.flags & 8388608) {
49159
49175
  if (isMappedTypeGenericIndexedAccess(t)) {
@@ -51784,9 +51800,11 @@ var ts;
51784
51800
  }
51785
51801
  function getStringMappingType(symbol, type) {
51786
51802
  return type.flags & (1048576 | 131072) ? mapType(type, function (t) { return getStringMappingType(symbol, t); }) :
51787
- isGenericIndexType(type) ? getStringMappingTypeForGenericType(symbol, type) :
51788
- type.flags & 128 ? getStringLiteralType(applyStringMapping(symbol, type.value)) :
51789
- type;
51803
+ type.flags & 268435456 && symbol === type.symbol ? type :
51804
+ isGenericIndexType(type) || isPatternLiteralPlaceholderType(type) ? getStringMappingTypeForGenericType(symbol, isPatternLiteralPlaceholderType(type) && !(type.flags & 268435456) ? getTemplateLiteralType(["", ""], [type]) : type) :
51805
+ type.flags & 128 ? getStringLiteralType(applyStringMapping(symbol, type.value)) :
51806
+ type.flags & 134217728 ? getTemplateLiteralType.apply(void 0, applyTemplateStringMapping(symbol, type.texts, type.types)) :
51807
+ type;
51790
51808
  }
51791
51809
  function applyStringMapping(symbol, str) {
51792
51810
  switch (intrinsicTypeKinds.get(symbol.escapedName)) {
@@ -51797,6 +51815,15 @@ var ts;
51797
51815
  }
51798
51816
  return str;
51799
51817
  }
51818
+ function applyTemplateStringMapping(symbol, texts, types) {
51819
+ switch (intrinsicTypeKinds.get(symbol.escapedName)) {
51820
+ case 0: return [texts.map(function (t) { return t.toUpperCase(); }), types.map(function (t) { return getStringMappingType(symbol, t); })];
51821
+ case 1: return [texts.map(function (t) { return t.toLowerCase(); }), types.map(function (t) { return getStringMappingType(symbol, t); })];
51822
+ case 2: return [texts[0] === "" ? texts : __spreadArray([texts[0].charAt(0).toUpperCase() + texts[0].slice(1)], texts.slice(1), true), texts[0] === "" ? __spreadArray([getStringMappingType(symbol, types[0])], types.slice(1), true) : types];
51823
+ case 3: return [texts[0] === "" ? texts : __spreadArray([texts[0].charAt(0).toLowerCase() + texts[0].slice(1)], texts.slice(1), true), texts[0] === "" ? __spreadArray([getStringMappingType(symbol, types[0])], types.slice(1), true) : types];
51824
+ }
51825
+ return [texts, types];
51826
+ }
51800
51827
  function getStringMappingTypeForGenericType(symbol, type) {
51801
51828
  var id = getSymbolId(symbol) + "," + getTypeId(type);
51802
51829
  var result = stringMappingTypes.get(id);
@@ -52026,7 +52053,7 @@ var ts;
52026
52053
  accessNode;
52027
52054
  }
52028
52055
  function isPatternLiteralPlaceholderType(type) {
52029
- return !!(type.flags & (1 | 4 | 8 | 64));
52056
+ return !!(type.flags & (1 | 4 | 8 | 64)) || !!(type.flags & 268435456 && isPatternLiteralPlaceholderType(type.type));
52030
52057
  }
52031
52058
  function isPatternLiteralType(type) {
52032
52059
  return !!(type.flags & 134217728) && ts.every(type.types, isPatternLiteralPlaceholderType);
@@ -54602,8 +54629,13 @@ var ts;
54602
54629
  return;
54603
54630
  }
54604
54631
  reportRelationError(headMessage, source, target);
54605
- if (strictNullChecks && source.flags & 8650752 && ((_b = (_a = source.symbol) === null || _a === void 0 ? void 0 : _a.declarations) === null || _b === void 0 ? void 0 : _b[0]) && !getConstraintOfType(source) && isRelatedTo(emptyObjectType, extractTypesOfKind(target, ~67108864))) {
54606
- associateRelatedInfo(ts.createDiagnosticForNode(source.symbol.declarations[0], ts.Diagnostics.This_type_parameter_probably_needs_an_extends_object_constraint));
54632
+ if (source.flags & 262144 && ((_b = (_a = source.symbol) === null || _a === void 0 ? void 0 : _a.declarations) === null || _b === void 0 ? void 0 : _b[0]) && !getConstraintOfType(source)) {
54633
+ var syntheticParam = cloneTypeParameter(source);
54634
+ syntheticParam.constraint = instantiateType(target, makeUnaryTypeMapper(source, syntheticParam));
54635
+ if (hasNonCircularBaseConstraint(syntheticParam)) {
54636
+ var targetConstraintString = typeToString(target, source.symbol.declarations[0]);
54637
+ associateRelatedInfo(ts.createDiagnosticForNode(source.symbol.declarations[0], ts.Diagnostics.This_type_parameter_might_need_an_extends_0_constraint, targetConstraintString));
54638
+ }
54607
54639
  }
54608
54640
  }
54609
54641
  function traceUnionsOrIntersectionsTooLarge(source, target) {
@@ -55243,6 +55275,13 @@ var ts;
55243
55275
  return -1;
55244
55276
  }
55245
55277
  }
55278
+ else if (target.flags & 268435456) {
55279
+ if (!(source.flags & 268435456)) {
55280
+ if (isMemberOfStringMapping(source, target)) {
55281
+ return -1;
55282
+ }
55283
+ }
55284
+ }
55246
55285
  if (sourceFlags & 8650752) {
55247
55286
  if (!(sourceFlags & 8388608 && targetFlags & 8388608)) {
55248
55287
  var constraint = getConstraintOfType(source) || unknownType;
@@ -55281,7 +55320,10 @@ var ts;
55281
55320
  }
55282
55321
  }
55283
55322
  else if (sourceFlags & 268435456) {
55284
- if (targetFlags & 268435456 && source.symbol === target.symbol) {
55323
+ if (targetFlags & 268435456) {
55324
+ if (source.symbol !== target.symbol) {
55325
+ return 0;
55326
+ }
55285
55327
  if (result = isRelatedTo(source.type, target.type, 3, reportErrors)) {
55286
55328
  resetErrorInfo(saveErrorInfo);
55287
55329
  return result;
@@ -56077,7 +56119,7 @@ var ts;
56077
56119
  return typeCouldHaveTopLevelSingletonTypes(constraint);
56078
56120
  }
56079
56121
  }
56080
- return isUnitType(type) || !!(type.flags & 134217728);
56122
+ return isUnitType(type) || !!(type.flags & 134217728) || !!(type.flags & 268435456);
56081
56123
  }
56082
56124
  function getExactOptionalUnassignableProperties(source, target) {
56083
56125
  if (isTupleType(source) && isTupleType(target))
@@ -56752,12 +56794,13 @@ var ts;
56752
56794
  && ((target.flags & (8 | 4 | 16)) !== 0);
56753
56795
  }
56754
56796
  function isObjectTypeWithInferableIndex(type) {
56797
+ var objectFlags = ts.getObjectFlags(type);
56755
56798
  return type.flags & 2097152
56756
56799
  ? ts.every(type.types, isObjectTypeWithInferableIndex)
56757
56800
  : !!(type.symbol
56758
56801
  && (type.symbol.flags & (4096 | 2048 | 384 | 512)) !== 0
56759
56802
  && !(type.symbol.flags & 32)
56760
- && !typeHasCallOrConstructSignatures(type)) || !!(ts.getObjectFlags(type) & 1024 && isObjectTypeWithInferableIndex(type.source));
56803
+ && !typeHasCallOrConstructSignatures(type)) || !!(objectFlags & 4194304) || !!(objectFlags & 1024 && isObjectTypeWithInferableIndex(type.source));
56761
56804
  }
56762
56805
  function createSymbolWithType(source, type) {
56763
56806
  var symbol = createSymbol(source.flags, source.escapedName, ts.getCheckFlags(source) & 8);
@@ -57343,6 +57386,24 @@ var ts;
57343
57386
  return success && result === 9 && scanner.getTextPos() === (s.length + 1) && !(flags & 512)
57344
57387
  && (!roundTripOnly || s === ts.pseudoBigIntToString({ negative: negative, base10Value: ts.parsePseudoBigInt(scanner.getTokenValue()) }));
57345
57388
  }
57389
+ function isMemberOfStringMapping(source, target) {
57390
+ if (target.flags & (4 | 3)) {
57391
+ return true;
57392
+ }
57393
+ if (target.flags & 134217728) {
57394
+ return isTypeAssignableTo(source, target);
57395
+ }
57396
+ if (target.flags & 268435456) {
57397
+ var mappingStack = [];
57398
+ while (target.flags & 268435456) {
57399
+ mappingStack.unshift(target.symbol);
57400
+ target = target.type;
57401
+ }
57402
+ var mappedSource = ts.reduceLeft(mappingStack, function (memo, value) { return getStringMappingType(value, memo); }, source);
57403
+ return mappedSource === source && isMemberOfStringMapping(source, target);
57404
+ }
57405
+ return false;
57406
+ }
57346
57407
  function isValidTypeForTemplateLiteralPlaceholder(source, target) {
57347
57408
  if (source === target || target.flags & (1 | 4)) {
57348
57409
  return true;
@@ -57351,7 +57412,8 @@ var ts;
57351
57412
  var value = source.value;
57352
57413
  return !!(target.flags & 8 && isValidNumberString(value, false) ||
57353
57414
  target.flags & 64 && isValidBigIntString(value, false) ||
57354
- target.flags & (512 | 98304) && value === target.intrinsicName);
57415
+ target.flags & (512 | 98304) && value === target.intrinsicName ||
57416
+ target.flags & 268435456 && isMemberOfStringMapping(getStringLiteralType(value), target));
57355
57417
  }
57356
57418
  if (source.flags & 134217728) {
57357
57419
  var texts = source.texts;
@@ -69337,6 +69399,21 @@ var ts;
69337
69399
  }
69338
69400
  });
69339
69401
  }
69402
+ function checkPotentialUncheckedRenamedBindingElementsInTypes() {
69403
+ var _a;
69404
+ for (var _i = 0, potentialUnusedRenamedBindingElementsInTypes_1 = potentialUnusedRenamedBindingElementsInTypes; _i < potentialUnusedRenamedBindingElementsInTypes_1.length; _i++) {
69405
+ var node = potentialUnusedRenamedBindingElementsInTypes_1[_i];
69406
+ if (!((_a = getSymbolOfNode(node)) === null || _a === void 0 ? void 0 : _a.isReferenced)) {
69407
+ var wrappingDeclaration = ts.walkUpBindingElementsAndPatterns(node);
69408
+ ts.Debug.assert(ts.isParameterDeclaration(wrappingDeclaration), "Only parameter declaration should be checked here");
69409
+ var diagnostic = ts.createDiagnosticForNode(node.name, ts.Diagnostics._0_is_an_unused_renaming_of_1_Did_you_intend_to_use_it_as_a_type_annotation, ts.declarationNameToString(node.name), ts.declarationNameToString(node.propertyName));
69410
+ if (!wrappingDeclaration.type) {
69411
+ ts.addRelatedInfo(diagnostic, ts.createFileDiagnostic(ts.getSourceFileOfNode(wrappingDeclaration), wrappingDeclaration.end, 1, ts.Diagnostics.We_can_only_write_a_type_for_0_by_adding_a_type_for_the_entire_parameter_here, ts.declarationNameToString(node.propertyName)));
69412
+ }
69413
+ diagnostics.add(diagnostic);
69414
+ }
69415
+ }
69416
+ }
69340
69417
  function bindingNameText(name) {
69341
69418
  switch (name.kind) {
69342
69419
  case 79:
@@ -69579,6 +69656,13 @@ var ts;
69579
69656
  }
69580
69657
  }
69581
69658
  if (ts.isBindingElement(node)) {
69659
+ if (node.propertyName &&
69660
+ ts.isIdentifier(node.name) &&
69661
+ ts.isParameterDeclaration(node) &&
69662
+ ts.nodeIsMissing(ts.getContainingFunction(node).body)) {
69663
+ potentialUnusedRenamedBindingElementsInTypes.push(node);
69664
+ return;
69665
+ }
69582
69666
  if (ts.isObjectBindingPattern(node.parent) && node.dotDotDotToken && languageVersion < 5) {
69583
69667
  checkExternalEmitHelpers(node, 4);
69584
69668
  }
@@ -72569,6 +72653,7 @@ var ts;
72569
72653
  ts.clear(potentialNewTargetCollisions);
72570
72654
  ts.clear(potentialWeakMapSetCollisions);
72571
72655
  ts.clear(potentialReflectCollisions);
72656
+ ts.clear(potentialUnusedRenamedBindingElementsInTypes);
72572
72657
  ts.forEach(node.statements, checkSourceElement);
72573
72658
  checkSourceElement(node.endOfFileToken);
72574
72659
  checkDeferredNodes(node);
@@ -72583,6 +72668,9 @@ var ts;
72583
72668
  }
72584
72669
  });
72585
72670
  }
72671
+ if (!node.isDeclarationFile) {
72672
+ checkPotentialUncheckedRenamedBindingElementsInTypes();
72673
+ }
72586
72674
  });
72587
72675
  if (compilerOptions.importsNotUsedAsValues === 2 &&
72588
72676
  !node.isDeclarationFile &&
@@ -89662,7 +89750,7 @@ var ts;
89662
89750
  });
89663
89751
  return ret;
89664
89752
  }
89665
- function filterBindingPatternInitializers(name) {
89753
+ function filterBindingPatternInitializersAndRenamings(name) {
89666
89754
  if (name.kind === 79) {
89667
89755
  return name;
89668
89756
  }
@@ -89678,7 +89766,10 @@ var ts;
89678
89766
  if (elem.kind === 227) {
89679
89767
  return elem;
89680
89768
  }
89681
- return factory.updateBindingElement(elem, elem.dotDotDotToken, elem.propertyName, filterBindingPatternInitializers(elem.name), shouldPrintWithInitializer(elem) ? elem.initializer : undefined);
89769
+ if (elem.propertyName && ts.isIdentifier(elem.propertyName) && ts.isIdentifier(elem.name) && !elem.symbol.isReferenced) {
89770
+ return factory.updateBindingElement(elem, elem.dotDotDotToken, undefined, elem.propertyName, shouldPrintWithInitializer(elem) ? elem.initializer : undefined);
89771
+ }
89772
+ return factory.updateBindingElement(elem, elem.dotDotDotToken, elem.propertyName, filterBindingPatternInitializersAndRenamings(elem.name), shouldPrintWithInitializer(elem) ? elem.initializer : undefined);
89682
89773
  }
89683
89774
  }
89684
89775
  function ensureParameter(p, modifierMask, type) {
@@ -89687,7 +89778,7 @@ var ts;
89687
89778
  oldDiag = getSymbolAccessibilityDiagnostic;
89688
89779
  getSymbolAccessibilityDiagnostic = ts.createGetSymbolAccessibilityDiagnosticForNode(p);
89689
89780
  }
89690
- var newParam = factory.updateParameterDeclaration(p, maskModifiers(p, modifierMask), p.dotDotDotToken, filterBindingPatternInitializers(p.name), resolver.isOptionalParameter(p) ? (p.questionToken || factory.createToken(57)) : undefined, ensureType(p, type || p.type, true), ensureNoInitializer(p));
89781
+ var newParam = factory.updateParameterDeclaration(p, maskModifiers(p, modifierMask), p.dotDotDotToken, filterBindingPatternInitializersAndRenamings(p.name), resolver.isOptionalParameter(p) ? (p.questionToken || factory.createToken(57)) : undefined, ensureType(p, type || p.type, true), ensureNoInitializer(p));
89691
89782
  if (!suppressNewDiagnosticContexts) {
89692
89783
  getSymbolAccessibilityDiagnostic = oldDiag;
89693
89784
  }
@@ -97010,6 +97101,7 @@ var ts;
97010
97101
  ts.Diagnostics.let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations.code,
97011
97102
  ts.Diagnostics.Class_constructor_may_not_be_a_generator.code,
97012
97103
  ts.Diagnostics.Class_constructor_may_not_be_an_accessor.code,
97104
+ ts.Diagnostics.await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules.code,
97013
97105
  ]);
97014
97106
  function shouldProgramCreateNewSourceFiles(program, newOptions) {
97015
97107
  if (!program)