@typescript-deploys/pr-build 4.8.0-pr-49481-2 → 4.8.0-pr-49554-2
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/cs/diagnosticMessages.generated.json +4 -2
- package/lib/de/diagnosticMessages.generated.json +4 -2
- package/lib/dynamicImportCompat.js +25 -0
- package/lib/es/diagnosticMessages.generated.json +4 -2
- package/lib/fr/diagnosticMessages.generated.json +4 -2
- package/lib/it/diagnosticMessages.generated.json +4 -2
- package/lib/ja/diagnosticMessages.generated.json +4 -2
- package/lib/ko/diagnosticMessages.generated.json +4 -2
- package/lib/pl/diagnosticMessages.generated.json +4 -2
- package/lib/pt-br/diagnosticMessages.generated.json +4 -2
- package/lib/ru/diagnosticMessages.generated.json +4 -2
- package/lib/tr/diagnosticMessages.generated.json +4 -2
- package/lib/tsc.js +82 -25
- package/lib/tsserver.js +430 -53
- package/lib/tsserverlibrary.d.ts +11 -3
- package/lib/tsserverlibrary.js +369 -52
- package/lib/typescript.d.ts +1 -1
- package/lib/typescript.js +124 -38
- package/lib/typescriptServices.d.ts +1 -1
- package/lib/typescriptServices.js +124 -38
- package/lib/typingsInstaller.js +96 -27
- package/lib/zh-cn/diagnosticMessages.generated.json +4 -2
- package/lib/zh-tw/diagnosticMessages.generated.json +4 -2
- package/package.json +2 -1
|
@@ -294,7 +294,7 @@ var ts;
|
|
|
294
294
|
// The following is baselined as a literal template type without intervention
|
|
295
295
|
/** The version of the TypeScript compiler release */
|
|
296
296
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
297
|
-
ts.version = ts.versionMajorMinor + ".0-insiders.
|
|
297
|
+
ts.version = ts.versionMajorMinor + ".0-insiders.20220615";
|
|
298
298
|
/* @internal */
|
|
299
299
|
var Comparison;
|
|
300
300
|
(function (Comparison) {
|
|
@@ -2851,7 +2851,7 @@ var ts;
|
|
|
2851
2851
|
return members.length > 0 && members[0][0] === 0 ? members[0][1] : "0";
|
|
2852
2852
|
}
|
|
2853
2853
|
if (isFlags) {
|
|
2854
|
-
var result =
|
|
2854
|
+
var result = [];
|
|
2855
2855
|
var remainingFlags = value;
|
|
2856
2856
|
for (var _i = 0, members_1 = members; _i < members_1.length; _i++) {
|
|
2857
2857
|
var _a = members_1[_i], enumValue = _a[0], enumName = _a[1];
|
|
@@ -2859,12 +2859,12 @@ var ts;
|
|
|
2859
2859
|
break;
|
|
2860
2860
|
}
|
|
2861
2861
|
if (enumValue !== 0 && enumValue & value) {
|
|
2862
|
-
result
|
|
2862
|
+
result.push(enumName);
|
|
2863
2863
|
remainingFlags &= ~enumValue;
|
|
2864
2864
|
}
|
|
2865
2865
|
}
|
|
2866
2866
|
if (remainingFlags === 0) {
|
|
2867
|
-
return result;
|
|
2867
|
+
return result.join("|");
|
|
2868
2868
|
}
|
|
2869
2869
|
}
|
|
2870
2870
|
else {
|
|
@@ -2878,7 +2878,15 @@ var ts;
|
|
|
2878
2878
|
return value.toString();
|
|
2879
2879
|
}
|
|
2880
2880
|
Debug.formatEnum = formatEnum;
|
|
2881
|
+
var enumMemberCache = new ts.Map();
|
|
2881
2882
|
function getEnumMembers(enumObject) {
|
|
2883
|
+
// Assuming enum objects do not change at runtime, we can cache the enum members list
|
|
2884
|
+
// to reuse later. This saves us from reconstructing this each and every time we call
|
|
2885
|
+
// a formatting function (which can be expensive for large enums like SyntaxKind).
|
|
2886
|
+
var existing = enumMemberCache.get(enumObject);
|
|
2887
|
+
if (existing) {
|
|
2888
|
+
return existing;
|
|
2889
|
+
}
|
|
2882
2890
|
var result = [];
|
|
2883
2891
|
for (var name in enumObject) {
|
|
2884
2892
|
var value = enumObject[name];
|
|
@@ -2886,7 +2894,9 @@ var ts;
|
|
|
2886
2894
|
result.push([value, name]);
|
|
2887
2895
|
}
|
|
2888
2896
|
}
|
|
2889
|
-
|
|
2897
|
+
var sorted = ts.stableSort(result, function (x, y) { return ts.compareValues(x[0], y[0]); });
|
|
2898
|
+
enumMemberCache.set(enumObject, sorted);
|
|
2899
|
+
return sorted;
|
|
2890
2900
|
}
|
|
2891
2901
|
function formatSyntaxKind(kind) {
|
|
2892
2902
|
return formatEnum(kind, ts.SyntaxKind, /*isFlags*/ false);
|
|
@@ -4525,6 +4535,7 @@ var ts;
|
|
|
4525
4535
|
SyntaxKind[SyntaxKind["JSDocFunctionType"] = 317] = "JSDocFunctionType";
|
|
4526
4536
|
SyntaxKind[SyntaxKind["JSDocVariadicType"] = 318] = "JSDocVariadicType";
|
|
4527
4537
|
SyntaxKind[SyntaxKind["JSDocNamepathType"] = 319] = "JSDocNamepathType";
|
|
4538
|
+
SyntaxKind[SyntaxKind["JSDoc"] = 320] = "JSDoc";
|
|
4528
4539
|
/** @deprecated Use SyntaxKind.JSDoc */
|
|
4529
4540
|
SyntaxKind[SyntaxKind["JSDocComment"] = 320] = "JSDocComment";
|
|
4530
4541
|
SyntaxKind[SyntaxKind["JSDocText"] = 321] = "JSDocText";
|
|
@@ -4599,7 +4610,6 @@ var ts;
|
|
|
4599
4610
|
SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 347] = "LastJSDocTagNode";
|
|
4600
4611
|
/* @internal */ SyntaxKind[SyntaxKind["FirstContextualKeyword"] = 126] = "FirstContextualKeyword";
|
|
4601
4612
|
/* @internal */ SyntaxKind[SyntaxKind["LastContextualKeyword"] = 160] = "LastContextualKeyword";
|
|
4602
|
-
SyntaxKind[SyntaxKind["JSDoc"] = 320] = "JSDoc";
|
|
4603
4613
|
})(SyntaxKind = ts.SyntaxKind || (ts.SyntaxKind = {}));
|
|
4604
4614
|
var NodeFlags;
|
|
4605
4615
|
(function (NodeFlags) {
|
|
@@ -8662,6 +8672,7 @@ var ts;
|
|
|
8662
8672
|
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."),
|
|
8663
8673
|
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."),
|
|
8664
8674
|
Add_extends_constraint: diag(2211, ts.DiagnosticCategory.Message, "Add_extends_constraint_2211", "Add `extends` constraint."),
|
|
8675
|
+
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"),
|
|
8665
8676
|
Duplicate_identifier_0: diag(2300, ts.DiagnosticCategory.Error, "Duplicate_identifier_0_2300", "Duplicate identifier '{0}'."),
|
|
8666
8677
|
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."),
|
|
8667
8678
|
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."),
|
|
@@ -9147,6 +9158,8 @@ var ts;
|
|
|
9147
9158
|
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."),
|
|
9148
9159
|
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"),
|
|
9149
9160
|
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'."),
|
|
9161
|
+
_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?"),
|
|
9162
|
+
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."),
|
|
9150
9163
|
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}'."),
|
|
9151
9164
|
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}'."),
|
|
9152
9165
|
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}'."),
|
|
@@ -35961,10 +35974,11 @@ var ts;
|
|
|
35961
35974
|
}
|
|
35962
35975
|
nextToken();
|
|
35963
35976
|
var typeArguments = parseDelimitedList(20 /* TypeArguments */, parseType);
|
|
35964
|
-
if (
|
|
35977
|
+
if (reScanGreaterToken() !== 31 /* GreaterThanToken */) {
|
|
35965
35978
|
// If it doesn't have the closing `>` then it's definitely not an type argument list.
|
|
35966
35979
|
return undefined;
|
|
35967
35980
|
}
|
|
35981
|
+
nextToken();
|
|
35968
35982
|
// We successfully parsed a type argument list. The next token determines whether we want to
|
|
35969
35983
|
// treat it as such. If the type argument list is followed by `(` or a template literal, as in
|
|
35970
35984
|
// `f<number>(42)`, we favor the type argument interpretation even though JavaScript would view
|
|
@@ -45390,7 +45404,7 @@ var ts;
|
|
|
45390
45404
|
case 164 /* Parameter */:
|
|
45391
45405
|
// Parameters with names are handled at the top of this function. Parameters
|
|
45392
45406
|
// without names can only come from JSDocFunctionTypes.
|
|
45393
|
-
ts.Debug.assert(node.parent.kind === 317 /* JSDocFunctionType */, "Impossible parameter parent kind", function () { return "parent is: " +
|
|
45407
|
+
ts.Debug.assert(node.parent.kind === 317 /* JSDocFunctionType */, "Impossible parameter parent kind", function () { return "parent is: " + ts.Debug.formatSyntaxKind(node.parent.kind) + ", expected JSDocFunctionType"; });
|
|
45394
45408
|
var functionType = node.parent;
|
|
45395
45409
|
var index = functionType.parameters.indexOf(node);
|
|
45396
45410
|
return "arg" + index;
|
|
@@ -49378,6 +49392,7 @@ var ts;
|
|
|
49378
49392
|
var potentialNewTargetCollisions = [];
|
|
49379
49393
|
var potentialWeakMapSetCollisions = [];
|
|
49380
49394
|
var potentialReflectCollisions = [];
|
|
49395
|
+
var potentialUnusedRenamedBindingElementsInTypes = [];
|
|
49381
49396
|
var awaitedTypeStack = [];
|
|
49382
49397
|
var diagnostics = ts.createDiagnosticCollection();
|
|
49383
49398
|
var suggestionDiagnostics = ts.createDiagnosticCollection();
|
|
@@ -52713,6 +52728,9 @@ var ts;
|
|
|
52713
52728
|
if (symbol && symbol.flags & 262144 /* TypeParameter */ && meaning & 788968 /* Type */) {
|
|
52714
52729
|
return { accessibility: 0 /* Accessible */ };
|
|
52715
52730
|
}
|
|
52731
|
+
if (!symbol && ts.isThisIdentifier(firstIdentifier) && isSymbolAccessible(getSymbolOfNode(ts.getThisContainer(firstIdentifier, /*includeArrowFunctions*/ false)), firstIdentifier, meaning, /*computeAliases*/ false).accessibility === 0 /* Accessible */) {
|
|
52732
|
+
return { accessibility: 0 /* Accessible */ };
|
|
52733
|
+
}
|
|
52716
52734
|
// Verify if the symbol is accessible
|
|
52717
52735
|
return (symbol && hasVisibleDeclarations(symbol, /*shouldComputeAliasToMakeVisible*/ true)) || {
|
|
52718
52736
|
accessibility: 1 /* NotAccessible */,
|
|
@@ -53885,15 +53903,22 @@ var ts;
|
|
|
53885
53903
|
context.approximateLength += ts.symbolName(parameterSymbol).length + 3;
|
|
53886
53904
|
return parameterNode;
|
|
53887
53905
|
function cloneBindingName(node) {
|
|
53888
|
-
return
|
|
53889
|
-
function
|
|
53906
|
+
return elideInitializerAndPropertyRenamingAndSetEmitFlags(node);
|
|
53907
|
+
function elideInitializerAndPropertyRenamingAndSetEmitFlags(node) {
|
|
53890
53908
|
if (context.tracker.trackSymbol && ts.isComputedPropertyName(node) && isLateBindableName(node)) {
|
|
53891
53909
|
trackComputedName(node.expression, context.enclosingDeclaration, context);
|
|
53892
53910
|
}
|
|
53893
|
-
var visited = ts.visitEachChild(node,
|
|
53911
|
+
var visited = ts.visitEachChild(node, elideInitializerAndPropertyRenamingAndSetEmitFlags, ts.nullTransformationContext, /*nodesVisitor*/ undefined, elideInitializerAndPropertyRenamingAndSetEmitFlags);
|
|
53894
53912
|
if (ts.isBindingElement(visited)) {
|
|
53895
|
-
visited
|
|
53896
|
-
|
|
53913
|
+
if (visited.propertyName && ts.isIdentifier(visited.propertyName) && ts.isIdentifier(visited.name)) {
|
|
53914
|
+
visited = ts.factory.updateBindingElement(visited, visited.dotDotDotToken,
|
|
53915
|
+
/* propertyName*/ undefined, visited.propertyName,
|
|
53916
|
+
/*initializer*/ undefined);
|
|
53917
|
+
}
|
|
53918
|
+
else {
|
|
53919
|
+
visited = ts.factory.updateBindingElement(visited, visited.dotDotDotToken, visited.propertyName, visited.name,
|
|
53920
|
+
/*initializer*/ undefined);
|
|
53921
|
+
}
|
|
53897
53922
|
}
|
|
53898
53923
|
if (!ts.nodeIsSynthesized(visited)) {
|
|
53899
53924
|
visited = ts.factory.cloneNode(visited);
|
|
@@ -65103,7 +65128,7 @@ var ts;
|
|
|
65103
65128
|
return true;
|
|
65104
65129
|
if (s & 65536 /* Null */ && (!strictNullChecks && !(t & 3145728 /* UnionOrIntersection */) || t & 65536 /* Null */))
|
|
65105
65130
|
return true;
|
|
65106
|
-
if (s & 524288 /* Object */ && t & 67108864 /* NonPrimitive */ && !(relation === strictSubtypeRelation && isEmptyAnonymousObjectType(source)))
|
|
65131
|
+
if (s & 524288 /* Object */ && t & 67108864 /* NonPrimitive */ && !(relation === strictSubtypeRelation && isEmptyAnonymousObjectType(source) && !(ts.getObjectFlags(source) & 8192 /* FreshLiteral */)))
|
|
65107
65132
|
return true;
|
|
65108
65133
|
if (relation === assignableRelation || relation === comparableRelation) {
|
|
65109
65134
|
if (s & 1 /* Any */)
|
|
@@ -65667,8 +65692,12 @@ var ts;
|
|
|
65667
65692
|
}
|
|
65668
65693
|
reportRelationError(headMessage, source, target);
|
|
65669
65694
|
if (source.flags & 262144 /* TypeParameter */ && ((_b = (_a = source.symbol) === null || _a === void 0 ? void 0 : _a.declarations) === null || _b === void 0 ? void 0 : _b[0]) && !getConstraintOfType(source)) {
|
|
65670
|
-
var
|
|
65671
|
-
|
|
65695
|
+
var syntheticParam = cloneTypeParameter(source);
|
|
65696
|
+
syntheticParam.constraint = instantiateType(target, makeUnaryTypeMapper(source, syntheticParam));
|
|
65697
|
+
if (hasNonCircularBaseConstraint(syntheticParam)) {
|
|
65698
|
+
var targetConstraintString = typeToString(target, source.symbol.declarations[0]);
|
|
65699
|
+
associateRelatedInfo(ts.createDiagnosticForNode(source.symbol.declarations[0], ts.Diagnostics.This_type_parameter_might_need_an_extends_0_constraint, targetConstraintString));
|
|
65700
|
+
}
|
|
65672
65701
|
}
|
|
65673
65702
|
}
|
|
65674
65703
|
function traceUnionsOrIntersectionsTooLarge(source, target) {
|
|
@@ -65807,7 +65836,7 @@ var ts;
|
|
|
65807
65836
|
return typeRelatedToSomeType(getRegularTypeOfObjectLiteral(source), target, reportErrors && !(source.flags & 131068 /* Primitive */) && !(target.flags & 131068 /* Primitive */));
|
|
65808
65837
|
}
|
|
65809
65838
|
if (target.flags & 2097152 /* Intersection */) {
|
|
65810
|
-
return typeRelatedToEachType(
|
|
65839
|
+
return typeRelatedToEachType(source, target, reportErrors, 2 /* Target */);
|
|
65811
65840
|
}
|
|
65812
65841
|
// Source is an intersection. For the comparable relation, if the target is a primitive type we hoist the
|
|
65813
65842
|
// constraints of all non-primitive types in the source into a new intersection. We do this because the
|
|
@@ -68218,12 +68247,13 @@ var ts;
|
|
|
68218
68247
|
* with no call or construct signatures.
|
|
68219
68248
|
*/
|
|
68220
68249
|
function isObjectTypeWithInferableIndex(type) {
|
|
68250
|
+
var objectFlags = ts.getObjectFlags(type);
|
|
68221
68251
|
return type.flags & 2097152 /* Intersection */
|
|
68222
68252
|
? ts.every(type.types, isObjectTypeWithInferableIndex)
|
|
68223
68253
|
: !!(type.symbol
|
|
68224
68254
|
&& (type.symbol.flags & (4096 /* ObjectLiteral */ | 2048 /* TypeLiteral */ | 384 /* Enum */ | 512 /* ValueModule */)) !== 0
|
|
68225
68255
|
&& !(type.symbol.flags & 32 /* Class */)
|
|
68226
|
-
&& !typeHasCallOrConstructSignatures(type)) || !!(
|
|
68256
|
+
&& !typeHasCallOrConstructSignatures(type)) || !!(objectFlags & 4194304 /* ObjectRestType */) || !!(objectFlags & 1024 /* ReverseMapped */ && isObjectTypeWithInferableIndex(type.source));
|
|
68227
68257
|
}
|
|
68228
68258
|
function createSymbolWithType(source, type) {
|
|
68229
68259
|
var symbol = createSymbol(source.flags, source.escapedName, ts.getCheckFlags(source) & 8 /* Readonly */);
|
|
@@ -82822,6 +82852,22 @@ var ts;
|
|
|
82822
82852
|
}
|
|
82823
82853
|
});
|
|
82824
82854
|
}
|
|
82855
|
+
function checkPotentialUncheckedRenamedBindingElementsInTypes() {
|
|
82856
|
+
var _a;
|
|
82857
|
+
for (var _i = 0, potentialUnusedRenamedBindingElementsInTypes_1 = potentialUnusedRenamedBindingElementsInTypes; _i < potentialUnusedRenamedBindingElementsInTypes_1.length; _i++) {
|
|
82858
|
+
var node = potentialUnusedRenamedBindingElementsInTypes_1[_i];
|
|
82859
|
+
if (!((_a = getSymbolOfNode(node)) === null || _a === void 0 ? void 0 : _a.isReferenced)) {
|
|
82860
|
+
var wrappingDeclaration = ts.walkUpBindingElementsAndPatterns(node);
|
|
82861
|
+
ts.Debug.assert(ts.isParameterDeclaration(wrappingDeclaration), "Only parameter declaration should be checked here");
|
|
82862
|
+
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));
|
|
82863
|
+
if (!wrappingDeclaration.type) {
|
|
82864
|
+
// entire parameter does not have type annotation, suggest adding an annotation
|
|
82865
|
+
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)));
|
|
82866
|
+
}
|
|
82867
|
+
diagnostics.add(diagnostic);
|
|
82868
|
+
}
|
|
82869
|
+
}
|
|
82870
|
+
}
|
|
82825
82871
|
function bindingNameText(name) {
|
|
82826
82872
|
switch (name.kind) {
|
|
82827
82873
|
case 79 /* Identifier */:
|
|
@@ -83123,6 +83169,17 @@ var ts;
|
|
|
83123
83169
|
}
|
|
83124
83170
|
}
|
|
83125
83171
|
if (ts.isBindingElement(node)) {
|
|
83172
|
+
if (node.propertyName &&
|
|
83173
|
+
ts.isIdentifier(node.name) &&
|
|
83174
|
+
ts.isParameterDeclaration(node) &&
|
|
83175
|
+
ts.nodeIsMissing(ts.getContainingFunction(node).body)) {
|
|
83176
|
+
// type F = ({a: string}) => void;
|
|
83177
|
+
// ^^^^^^
|
|
83178
|
+
// variable renaming in function type notation is confusing,
|
|
83179
|
+
// so we forbid it even if noUnusedLocals is not enabled
|
|
83180
|
+
potentialUnusedRenamedBindingElementsInTypes.push(node);
|
|
83181
|
+
return;
|
|
83182
|
+
}
|
|
83126
83183
|
if (ts.isObjectBindingPattern(node.parent) && node.dotDotDotToken && languageVersion < 5 /* ES2018 */) {
|
|
83127
83184
|
checkExternalEmitHelpers(node, 4 /* Rest */);
|
|
83128
83185
|
}
|
|
@@ -86586,6 +86643,7 @@ var ts;
|
|
|
86586
86643
|
ts.clear(potentialNewTargetCollisions);
|
|
86587
86644
|
ts.clear(potentialWeakMapSetCollisions);
|
|
86588
86645
|
ts.clear(potentialReflectCollisions);
|
|
86646
|
+
ts.clear(potentialUnusedRenamedBindingElementsInTypes);
|
|
86589
86647
|
ts.forEach(node.statements, checkSourceElement);
|
|
86590
86648
|
checkSourceElement(node.endOfFileToken);
|
|
86591
86649
|
checkDeferredNodes(node);
|
|
@@ -86601,6 +86659,9 @@ var ts;
|
|
|
86601
86659
|
}
|
|
86602
86660
|
});
|
|
86603
86661
|
}
|
|
86662
|
+
if (!node.isDeclarationFile) {
|
|
86663
|
+
checkPotentialUncheckedRenamedBindingElementsInTypes();
|
|
86664
|
+
}
|
|
86604
86665
|
});
|
|
86605
86666
|
if (compilerOptions.importsNotUsedAsValues === 2 /* Error */ &&
|
|
86606
86667
|
!node.isDeclarationFile &&
|
|
@@ -108651,7 +108712,7 @@ var ts;
|
|
|
108651
108712
|
return getTypeAliasDeclarationVisibilityError;
|
|
108652
108713
|
}
|
|
108653
108714
|
else {
|
|
108654
|
-
return ts.Debug.assertNever(node, "Attempted to set a declaration diagnostic context for unhandled node kind: " + ts.
|
|
108715
|
+
return ts.Debug.assertNever(node, "Attempted to set a declaration diagnostic context for unhandled node kind: " + ts.Debug.formatSyntaxKind(node.kind));
|
|
108655
108716
|
}
|
|
108656
108717
|
function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) {
|
|
108657
108718
|
if (node.kind === 254 /* VariableDeclaration */ || node.kind === 203 /* BindingElement */) {
|
|
@@ -108862,7 +108923,7 @@ var ts;
|
|
|
108862
108923
|
ts.Diagnostics.Parameter_0_of_accessor_has_or_is_using_name_1_from_private_module_2 :
|
|
108863
108924
|
ts.Diagnostics.Parameter_0_of_accessor_has_or_is_using_private_name_1;
|
|
108864
108925
|
default:
|
|
108865
|
-
return ts.Debug.fail("Unknown parent for parameter: " + ts.
|
|
108926
|
+
return ts.Debug.fail("Unknown parent for parameter: " + ts.Debug.formatSyntaxKind(node.parent.kind));
|
|
108866
108927
|
}
|
|
108867
108928
|
}
|
|
108868
108929
|
function getTypeParameterConstraintVisibilityError() {
|
|
@@ -109342,7 +109403,7 @@ var ts;
|
|
|
109342
109403
|
});
|
|
109343
109404
|
return ret;
|
|
109344
109405
|
}
|
|
109345
|
-
function
|
|
109406
|
+
function filterBindingPatternInitializersAndRenamings(name) {
|
|
109346
109407
|
if (name.kind === 79 /* Identifier */) {
|
|
109347
109408
|
return name;
|
|
109348
109409
|
}
|
|
@@ -109358,7 +109419,12 @@ var ts;
|
|
|
109358
109419
|
if (elem.kind === 227 /* OmittedExpression */) {
|
|
109359
109420
|
return elem;
|
|
109360
109421
|
}
|
|
109361
|
-
|
|
109422
|
+
if (elem.propertyName && ts.isIdentifier(elem.propertyName) && ts.isIdentifier(elem.name) && !elem.symbol.isReferenced) {
|
|
109423
|
+
// Unnecessary property renaming is forbidden in types, so remove renaming
|
|
109424
|
+
return factory.updateBindingElement(elem, elem.dotDotDotToken,
|
|
109425
|
+
/* propertyName */ undefined, elem.propertyName, shouldPrintWithInitializer(elem) ? elem.initializer : undefined);
|
|
109426
|
+
}
|
|
109427
|
+
return factory.updateBindingElement(elem, elem.dotDotDotToken, elem.propertyName, filterBindingPatternInitializersAndRenamings(elem.name), shouldPrintWithInitializer(elem) ? elem.initializer : undefined);
|
|
109362
109428
|
}
|
|
109363
109429
|
}
|
|
109364
109430
|
function ensureParameter(p, modifierMask, type) {
|
|
@@ -109367,7 +109433,7 @@ var ts;
|
|
|
109367
109433
|
oldDiag = getSymbolAccessibilityDiagnostic;
|
|
109368
109434
|
getSymbolAccessibilityDiagnostic = ts.createGetSymbolAccessibilityDiagnosticForNode(p);
|
|
109369
109435
|
}
|
|
109370
|
-
var newParam = factory.updateParameterDeclaration(p, maskModifiers(p, modifierMask), p.dotDotDotToken,
|
|
109436
|
+
var newParam = factory.updateParameterDeclaration(p, maskModifiers(p, modifierMask), p.dotDotDotToken, filterBindingPatternInitializersAndRenamings(p.name), resolver.isOptionalParameter(p) ? (p.questionToken || factory.createToken(57 /* QuestionToken */)) : undefined, ensureType(p, type || p.type, /*ignorePrivate*/ true), // Ignore private param props, since this type is going straight back into a param
|
|
109371
109437
|
ensureNoInitializer(p));
|
|
109372
109438
|
if (!suppressNewDiagnosticContexts) {
|
|
109373
109439
|
getSymbolAccessibilityDiagnostic = oldDiag;
|
|
@@ -109628,7 +109694,7 @@ var ts;
|
|
|
109628
109694
|
while (ts.length(lateMarkedStatements)) {
|
|
109629
109695
|
var i = lateMarkedStatements.shift();
|
|
109630
109696
|
if (!ts.isLateVisibilityPaintedStatement(i)) {
|
|
109631
|
-
return ts.Debug.fail("Late replaced statement was found which is not handled by the declaration transformer!: " +
|
|
109697
|
+
return ts.Debug.fail("Late replaced statement was found which is not handled by the declaration transformer!: " + ts.Debug.formatSyntaxKind(i.kind));
|
|
109632
109698
|
}
|
|
109633
109699
|
var priorNeedsDeclare = needsDeclare;
|
|
109634
109700
|
needsDeclare = i.parent && ts.isSourceFile(i.parent) && !(ts.isExternalModule(i.parent) && isBundledEmit);
|
|
@@ -109811,7 +109877,7 @@ var ts;
|
|
|
109811
109877
|
return cleanup(input);
|
|
109812
109878
|
return cleanup(factory.updateImportTypeNode(input, factory.updateLiteralTypeNode(input.argument, rewriteModuleSpecifier(input, input.argument.literal)), input.assertions, input.qualifier, ts.visitNodes(input.typeArguments, visitDeclarationSubtree, ts.isTypeNode), input.isTypeOf));
|
|
109813
109879
|
}
|
|
109814
|
-
default: ts.Debug.assertNever(input, "Attempted to process unhandled node kind: " + ts.
|
|
109880
|
+
default: ts.Debug.assertNever(input, "Attempted to process unhandled node kind: " + ts.Debug.formatSyntaxKind(input.kind));
|
|
109815
109881
|
}
|
|
109816
109882
|
}
|
|
109817
109883
|
if (ts.isTupleTypeNode(input) && (ts.getLineAndCharacterOfPosition(currentSourceFile, input.pos).line === ts.getLineAndCharacterOfPosition(currentSourceFile, input.end).line)) {
|
|
@@ -110133,7 +110199,7 @@ var ts;
|
|
|
110133
110199
|
}
|
|
110134
110200
|
}
|
|
110135
110201
|
// Anything left unhandled is an error, so this should be unreachable
|
|
110136
|
-
return ts.Debug.assertNever(input, "Unhandled top-level node in declaration emit: " + ts.
|
|
110202
|
+
return ts.Debug.assertNever(input, "Unhandled top-level node in declaration emit: " + ts.Debug.formatSyntaxKind(input.kind));
|
|
110137
110203
|
function cleanup(node) {
|
|
110138
110204
|
if (isEnclosingDeclaration(input)) {
|
|
110139
110205
|
enclosingDeclaration = previousEnclosingDeclaration;
|
|
@@ -117510,6 +117576,7 @@ var ts;
|
|
|
117510
117576
|
ts.Diagnostics.let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations.code,
|
|
117511
117577
|
ts.Diagnostics.Class_constructor_may_not_be_a_generator.code,
|
|
117512
117578
|
ts.Diagnostics.Class_constructor_may_not_be_an_accessor.code,
|
|
117579
|
+
ts.Diagnostics.await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules.code,
|
|
117513
117580
|
]);
|
|
117514
117581
|
/**
|
|
117515
117582
|
* Determine if source file needs to be re-created even if its text hasn't changed
|
|
@@ -122644,9 +122711,11 @@ var ts;
|
|
|
122644
122711
|
}
|
|
122645
122712
|
function watchAffectingLocationsOfResolution(resolution, addToResolutionsWithOnlyAffectingLocations) {
|
|
122646
122713
|
ts.Debug.assert(!!resolution.refCount);
|
|
122714
|
+
var affectingLocations = resolution.affectingLocations;
|
|
122715
|
+
if (!affectingLocations.length)
|
|
122716
|
+
return;
|
|
122647
122717
|
if (addToResolutionsWithOnlyAffectingLocations)
|
|
122648
122718
|
resolutionsWithOnlyAffectingLocations.push(resolution);
|
|
122649
|
-
var affectingLocations = resolution.affectingLocations;
|
|
122650
122719
|
// Watch package json
|
|
122651
122720
|
for (var _i = 0, affectingLocations_1 = affectingLocations; _i < affectingLocations_1.length; _i++) {
|
|
122652
122721
|
var affectingLocation = affectingLocations_1[_i];
|
|
@@ -145762,7 +145831,7 @@ var ts;
|
|
|
145762
145831
|
return type.symbol && (type.symbol.flags & 1536 /* Module */);
|
|
145763
145832
|
}
|
|
145764
145833
|
function visitVariableLikeDeclaration(decl) {
|
|
145765
|
-
if (!decl.initializer || ts.isBindingPattern(decl.name)) {
|
|
145834
|
+
if (!decl.initializer || ts.isBindingPattern(decl.name) || ts.isVariableDeclaration(decl) && !isHintableDeclaration(decl)) {
|
|
145766
145835
|
return;
|
|
145767
145836
|
}
|
|
145768
145837
|
var effectiveTypeAnnotation = ts.getEffectiveTypeAnnotationNode(decl);
|
|
@@ -145890,6 +145959,9 @@ var ts;
|
|
|
145890
145959
|
}
|
|
145891
145960
|
for (var i = 0; i < node.parameters.length && i < signature.parameters.length; ++i) {
|
|
145892
145961
|
var param = node.parameters[i];
|
|
145962
|
+
if (!isHintableDeclaration(param)) {
|
|
145963
|
+
continue;
|
|
145964
|
+
}
|
|
145893
145965
|
var effectiveTypeAnnotation = ts.getEffectiveTypeAnnotationNode(param);
|
|
145894
145966
|
if (effectiveTypeAnnotation) {
|
|
145895
145967
|
continue;
|
|
@@ -145931,6 +146003,13 @@ var ts;
|
|
|
145931
146003
|
function isUndefined(name) {
|
|
145932
146004
|
return name === "undefined";
|
|
145933
146005
|
}
|
|
146006
|
+
function isHintableDeclaration(node) {
|
|
146007
|
+
if ((ts.isParameterDeclaration(node) || ts.isVariableDeclaration(node) && ts.isVarConst(node)) && node.initializer) {
|
|
146008
|
+
var initializer = ts.skipParentheses(node.initializer);
|
|
146009
|
+
return !(isHintableLiteral(initializer) || ts.isNewExpression(initializer) || ts.isObjectLiteralExpression(initializer) || ts.isAssertionExpression(initializer));
|
|
146010
|
+
}
|
|
146011
|
+
return true;
|
|
146012
|
+
}
|
|
145934
146013
|
}
|
|
145935
146014
|
InlayHints.provideInlayHints = provideInlayHints;
|
|
145936
146015
|
})(InlayHints = ts.InlayHints || (ts.InlayHints = {}));
|
|
@@ -150681,7 +150760,7 @@ var ts;
|
|
|
150681
150760
|
return {
|
|
150682
150761
|
indentation: indentation,
|
|
150683
150762
|
prefix: (insertLeadingComma ? "," : "") + this.newLineCharacter,
|
|
150684
|
-
suffix: insertTrailingComma ? "," : ""
|
|
150763
|
+
suffix: insertTrailingComma ? "," : ts.isInterfaceDeclaration(node) && isEmpty ? ";" : ""
|
|
150685
150764
|
};
|
|
150686
150765
|
};
|
|
150687
150766
|
ChangeTracker.prototype.insertNodeAfterComma = function (sourceFile, after, newNode) {
|
|
@@ -155383,6 +155462,7 @@ var ts;
|
|
|
155383
155462
|
ts.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefined_to_the_types_of_the_target_s_properties.code,
|
|
155384
155463
|
ts.Diagnostics.Property_0_is_incompatible_with_index_signature.code,
|
|
155385
155464
|
ts.Diagnostics.Property_0_in_type_1_is_not_assignable_to_type_2.code,
|
|
155465
|
+
ts.Diagnostics.Type_0_does_not_satisfy_the_constraint_1.code,
|
|
155386
155466
|
];
|
|
155387
155467
|
codefix.registerCodeFix({
|
|
155388
155468
|
errorCodes: errorCodes,
|
|
@@ -155393,7 +155473,7 @@ var ts;
|
|
|
155393
155473
|
return;
|
|
155394
155474
|
}
|
|
155395
155475
|
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return addMissingConstraint(t, related); });
|
|
155396
|
-
return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Add_extends_constraint, fixId, ts.Diagnostics.
|
|
155476
|
+
return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Add_extends_constraint, fixId, ts.Diagnostics.Add_extends_constraint_to_all_type_parameters)];
|
|
155397
155477
|
},
|
|
155398
155478
|
fixIds: [fixId],
|
|
155399
155479
|
getAllCodeActions: function (context) { return codefix.codeFixAll(context, errorCodes, function (changes, diag) {
|
|
@@ -155404,13 +155484,10 @@ var ts;
|
|
|
155404
155484
|
}); },
|
|
155405
155485
|
});
|
|
155406
155486
|
function getDiagnosticRelatedInfo(program, sourceFile, span) {
|
|
155407
|
-
var
|
|
155408
|
-
if (!
|
|
155487
|
+
var diag = ts.find(program.getSemanticDiagnostics(sourceFile), function (diag) { return diag.start === span.start && diag.length === span.length; });
|
|
155488
|
+
if (!diag || !diag.relatedInformation)
|
|
155409
155489
|
return;
|
|
155410
|
-
var
|
|
155411
|
-
if (!diag.relatedInformation)
|
|
155412
|
-
return;
|
|
155413
|
-
var related = ts.filter(diag.relatedInformation, function (related) { return related.code === ts.Diagnostics.This_type_parameter_might_need_an_extends_0_constraint.code; })[0];
|
|
155490
|
+
var related = ts.find(diag.relatedInformation, function (related) { return related.code === ts.Diagnostics.This_type_parameter_might_need_an_extends_0_constraint.code; });
|
|
155414
155491
|
if (!related)
|
|
155415
155492
|
return;
|
|
155416
155493
|
return related;
|
|
@@ -156505,7 +156582,7 @@ var ts;
|
|
|
156505
156582
|
var checker = context.program.getTypeChecker();
|
|
156506
156583
|
var props = ts.map(info.properties, function (prop) {
|
|
156507
156584
|
var initializer = tryGetValueFromType(context, checker, importAdder, quotePreference, checker.getTypeOfSymbol(prop), info.parentDeclaration);
|
|
156508
|
-
return ts.factory.createPropertyAssignment(
|
|
156585
|
+
return ts.factory.createPropertyAssignment(createPropertyNameFromSymbol(prop, target, quotePreference, checker), initializer);
|
|
156509
156586
|
});
|
|
156510
156587
|
var options = {
|
|
156511
156588
|
leadingTriviaOption: ts.textChanges.LeadingTriviaOption.Exclude,
|
|
@@ -156625,6 +156702,15 @@ var ts;
|
|
|
156625
156702
|
var declaration = ts.findAncestor(callExpression, function (n) { return ts.isMethodDeclaration(n) || ts.isConstructorDeclaration(n); });
|
|
156626
156703
|
return declaration && declaration.parent === node ? declaration : undefined;
|
|
156627
156704
|
}
|
|
156705
|
+
function createPropertyNameFromSymbol(symbol, target, quotePreference, checker) {
|
|
156706
|
+
if (ts.isTransientSymbol(symbol) && symbol.nameType && symbol.nameType.flags & 8192 /* UniqueESSymbol */) {
|
|
156707
|
+
var expression = checker.symbolToExpression(symbol.nameType.symbol, 111551 /* Value */, symbol.valueDeclaration, 1048576 /* AllowUniqueESSymbolType */);
|
|
156708
|
+
if (expression) {
|
|
156709
|
+
return ts.factory.createComputedPropertyName(expression);
|
|
156710
|
+
}
|
|
156711
|
+
}
|
|
156712
|
+
return ts.createPropertyNameNodeForIdentifierOrLiteral(symbol.name, target, quotePreference === 0 /* Single */);
|
|
156713
|
+
}
|
|
156628
156714
|
})(codefix = ts.codefix || (ts.codefix = {}));
|
|
156629
156715
|
})(ts || (ts = {}));
|
|
156630
156716
|
/* @internal */
|
|
@@ -159352,7 +159438,7 @@ var ts;
|
|
|
159352
159438
|
/*questionToken*/ undefined, typeParameters, parameters, type, createStubbedMethodBody(quotePreference));
|
|
159353
159439
|
case 168 /* MethodSignature */:
|
|
159354
159440
|
return ts.factory.createMethodSignature(modifiers, name,
|
|
159355
|
-
/*questionToken*/ undefined, typeParameters, parameters, type);
|
|
159441
|
+
/*questionToken*/ undefined, typeParameters, parameters, type === undefined ? ts.factory.createKeywordTypeNode(155 /* UnknownKeyword */) : type);
|
|
159356
159442
|
case 256 /* FunctionDeclaration */:
|
|
159357
159443
|
return ts.factory.createFunctionDeclaration(modifiers, asteriskToken, name, typeParameters, parameters, type, createStubbedBody(ts.Diagnostics.Function_not_implemented.message, quotePreference));
|
|
159358
159444
|
default:
|