typescript 4.8.0-dev.20220612 → 4.8.0-dev.20220615
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/dynamicImportCompat.js +25 -0
- package/lib/tsc.js +53 -12
- package/lib/tsserver.js +369 -28
- package/lib/tsserverlibrary.d.ts +10 -2
- package/lib/tsserverlibrary.js +308 -27
- package/lib/typescript.js +63 -13
- package/lib/typescriptServices.js +63 -13
- package/lib/typingsInstaller.js +63 -13
- package/package.json +2 -1
|
@@ -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.
|
|
72
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220615";
|
|
73
73
|
var NativeCollections;
|
|
74
74
|
(function (NativeCollections) {
|
|
75
75
|
var globals = typeof globalThis !== "undefined" ? globalThis :
|
|
@@ -6130,6 +6130,8 @@ var ts;
|
|
|
6130
6130
|
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
6131
|
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
6132
|
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'."),
|
|
6133
|
+
_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?"),
|
|
6134
|
+
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
6135
|
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
6136
|
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
6137
|
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}'."),
|
|
@@ -40342,6 +40344,7 @@ var ts;
|
|
|
40342
40344
|
var potentialNewTargetCollisions = [];
|
|
40343
40345
|
var potentialWeakMapSetCollisions = [];
|
|
40344
40346
|
var potentialReflectCollisions = [];
|
|
40347
|
+
var potentialUnusedRenamedBindingElementsInTypes = [];
|
|
40345
40348
|
var awaitedTypeStack = [];
|
|
40346
40349
|
var diagnostics = ts.createDiagnosticCollection();
|
|
40347
40350
|
var suggestionDiagnostics = ts.createDiagnosticCollection();
|
|
@@ -44315,14 +44318,19 @@ var ts;
|
|
|
44315
44318
|
context.approximateLength += ts.symbolName(parameterSymbol).length + 3;
|
|
44316
44319
|
return parameterNode;
|
|
44317
44320
|
function cloneBindingName(node) {
|
|
44318
|
-
return
|
|
44319
|
-
function
|
|
44321
|
+
return elideInitializerAndPropertyRenamingAndSetEmitFlags(node);
|
|
44322
|
+
function elideInitializerAndPropertyRenamingAndSetEmitFlags(node) {
|
|
44320
44323
|
if (context.tracker.trackSymbol && ts.isComputedPropertyName(node) && isLateBindableName(node)) {
|
|
44321
44324
|
trackComputedName(node.expression, context.enclosingDeclaration, context);
|
|
44322
44325
|
}
|
|
44323
|
-
var visited = ts.visitEachChild(node,
|
|
44326
|
+
var visited = ts.visitEachChild(node, elideInitializerAndPropertyRenamingAndSetEmitFlags, ts.nullTransformationContext, undefined, elideInitializerAndPropertyRenamingAndSetEmitFlags);
|
|
44324
44327
|
if (ts.isBindingElement(visited)) {
|
|
44325
|
-
visited
|
|
44328
|
+
if (visited.propertyName && ts.isIdentifier(visited.propertyName) && ts.isIdentifier(visited.name)) {
|
|
44329
|
+
visited = ts.factory.updateBindingElement(visited, visited.dotDotDotToken, undefined, visited.propertyName, undefined);
|
|
44330
|
+
}
|
|
44331
|
+
else {
|
|
44332
|
+
visited = ts.factory.updateBindingElement(visited, visited.dotDotDotToken, visited.propertyName, visited.name, undefined);
|
|
44333
|
+
}
|
|
44326
44334
|
}
|
|
44327
44335
|
if (!ts.nodeIsSynthesized(visited)) {
|
|
44328
44336
|
visited = ts.factory.cloneNode(visited);
|
|
@@ -54118,7 +54126,7 @@ var ts;
|
|
|
54118
54126
|
return true;
|
|
54119
54127
|
if (s & 65536 && (!strictNullChecks && !(t & 3145728) || t & 65536))
|
|
54120
54128
|
return true;
|
|
54121
|
-
if (s & 524288 && t & 67108864 && !(relation === strictSubtypeRelation && isEmptyAnonymousObjectType(source)))
|
|
54129
|
+
if (s & 524288 && t & 67108864 && !(relation === strictSubtypeRelation && isEmptyAnonymousObjectType(source) && !(ts.getObjectFlags(source) & 8192)))
|
|
54122
54130
|
return true;
|
|
54123
54131
|
if (relation === assignableRelation || relation === comparableRelation) {
|
|
54124
54132
|
if (s & 1)
|
|
@@ -54728,7 +54736,7 @@ var ts;
|
|
|
54728
54736
|
return typeRelatedToSomeType(getRegularTypeOfObjectLiteral(source), target, reportErrors && !(source.flags & 131068) && !(target.flags & 131068));
|
|
54729
54737
|
}
|
|
54730
54738
|
if (target.flags & 2097152) {
|
|
54731
|
-
return typeRelatedToEachType(
|
|
54739
|
+
return typeRelatedToEachType(source, target, reportErrors, 2);
|
|
54732
54740
|
}
|
|
54733
54741
|
if (relation === comparableRelation && target.flags & 131068) {
|
|
54734
54742
|
var constraints = ts.sameMap(source.types, getBaseConstraintOrType);
|
|
@@ -56752,12 +56760,13 @@ var ts;
|
|
|
56752
56760
|
&& ((target.flags & (8 | 4 | 16)) !== 0);
|
|
56753
56761
|
}
|
|
56754
56762
|
function isObjectTypeWithInferableIndex(type) {
|
|
56763
|
+
var objectFlags = ts.getObjectFlags(type);
|
|
56755
56764
|
return type.flags & 2097152
|
|
56756
56765
|
? ts.every(type.types, isObjectTypeWithInferableIndex)
|
|
56757
56766
|
: !!(type.symbol
|
|
56758
56767
|
&& (type.symbol.flags & (4096 | 2048 | 384 | 512)) !== 0
|
|
56759
56768
|
&& !(type.symbol.flags & 32)
|
|
56760
|
-
&& !typeHasCallOrConstructSignatures(type)) || !!(
|
|
56769
|
+
&& !typeHasCallOrConstructSignatures(type)) || !!(objectFlags & 4194304) || !!(objectFlags & 1024 && isObjectTypeWithInferableIndex(type.source));
|
|
56761
56770
|
}
|
|
56762
56771
|
function createSymbolWithType(source, type) {
|
|
56763
56772
|
var symbol = createSymbol(source.flags, source.escapedName, ts.getCheckFlags(source) & 8);
|
|
@@ -69337,6 +69346,21 @@ var ts;
|
|
|
69337
69346
|
}
|
|
69338
69347
|
});
|
|
69339
69348
|
}
|
|
69349
|
+
function checkPotentialUncheckedRenamedBindingElementsInTypes() {
|
|
69350
|
+
var _a;
|
|
69351
|
+
for (var _i = 0, potentialUnusedRenamedBindingElementsInTypes_1 = potentialUnusedRenamedBindingElementsInTypes; _i < potentialUnusedRenamedBindingElementsInTypes_1.length; _i++) {
|
|
69352
|
+
var node = potentialUnusedRenamedBindingElementsInTypes_1[_i];
|
|
69353
|
+
if (!((_a = getSymbolOfNode(node)) === null || _a === void 0 ? void 0 : _a.isReferenced)) {
|
|
69354
|
+
var wrappingDeclaration = ts.walkUpBindingElementsAndPatterns(node);
|
|
69355
|
+
ts.Debug.assert(ts.isParameterDeclaration(wrappingDeclaration), "Only parameter declaration should be checked here");
|
|
69356
|
+
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));
|
|
69357
|
+
if (!wrappingDeclaration.type) {
|
|
69358
|
+
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)));
|
|
69359
|
+
}
|
|
69360
|
+
diagnostics.add(diagnostic);
|
|
69361
|
+
}
|
|
69362
|
+
}
|
|
69363
|
+
}
|
|
69340
69364
|
function bindingNameText(name) {
|
|
69341
69365
|
switch (name.kind) {
|
|
69342
69366
|
case 79:
|
|
@@ -69579,6 +69603,13 @@ var ts;
|
|
|
69579
69603
|
}
|
|
69580
69604
|
}
|
|
69581
69605
|
if (ts.isBindingElement(node)) {
|
|
69606
|
+
if (node.propertyName &&
|
|
69607
|
+
ts.isIdentifier(node.name) &&
|
|
69608
|
+
ts.isParameterDeclaration(node) &&
|
|
69609
|
+
ts.nodeIsMissing(ts.getContainingFunction(node).body)) {
|
|
69610
|
+
potentialUnusedRenamedBindingElementsInTypes.push(node);
|
|
69611
|
+
return;
|
|
69612
|
+
}
|
|
69582
69613
|
if (ts.isObjectBindingPattern(node.parent) && node.dotDotDotToken && languageVersion < 5) {
|
|
69583
69614
|
checkExternalEmitHelpers(node, 4);
|
|
69584
69615
|
}
|
|
@@ -72569,6 +72600,7 @@ var ts;
|
|
|
72569
72600
|
ts.clear(potentialNewTargetCollisions);
|
|
72570
72601
|
ts.clear(potentialWeakMapSetCollisions);
|
|
72571
72602
|
ts.clear(potentialReflectCollisions);
|
|
72603
|
+
ts.clear(potentialUnusedRenamedBindingElementsInTypes);
|
|
72572
72604
|
ts.forEach(node.statements, checkSourceElement);
|
|
72573
72605
|
checkSourceElement(node.endOfFileToken);
|
|
72574
72606
|
checkDeferredNodes(node);
|
|
@@ -72583,6 +72615,9 @@ var ts;
|
|
|
72583
72615
|
}
|
|
72584
72616
|
});
|
|
72585
72617
|
}
|
|
72618
|
+
if (!node.isDeclarationFile) {
|
|
72619
|
+
checkPotentialUncheckedRenamedBindingElementsInTypes();
|
|
72620
|
+
}
|
|
72586
72621
|
});
|
|
72587
72622
|
if (compilerOptions.importsNotUsedAsValues === 2 &&
|
|
72588
72623
|
!node.isDeclarationFile &&
|
|
@@ -89662,7 +89697,7 @@ var ts;
|
|
|
89662
89697
|
});
|
|
89663
89698
|
return ret;
|
|
89664
89699
|
}
|
|
89665
|
-
function
|
|
89700
|
+
function filterBindingPatternInitializersAndRenamings(name) {
|
|
89666
89701
|
if (name.kind === 79) {
|
|
89667
89702
|
return name;
|
|
89668
89703
|
}
|
|
@@ -89678,7 +89713,10 @@ var ts;
|
|
|
89678
89713
|
if (elem.kind === 227) {
|
|
89679
89714
|
return elem;
|
|
89680
89715
|
}
|
|
89681
|
-
|
|
89716
|
+
if (elem.propertyName && ts.isIdentifier(elem.propertyName) && ts.isIdentifier(elem.name) && !elem.symbol.isReferenced) {
|
|
89717
|
+
return factory.updateBindingElement(elem, elem.dotDotDotToken, undefined, elem.propertyName, shouldPrintWithInitializer(elem) ? elem.initializer : undefined);
|
|
89718
|
+
}
|
|
89719
|
+
return factory.updateBindingElement(elem, elem.dotDotDotToken, elem.propertyName, filterBindingPatternInitializersAndRenamings(elem.name), shouldPrintWithInitializer(elem) ? elem.initializer : undefined);
|
|
89682
89720
|
}
|
|
89683
89721
|
}
|
|
89684
89722
|
function ensureParameter(p, modifierMask, type) {
|
|
@@ -89687,7 +89725,7 @@ var ts;
|
|
|
89687
89725
|
oldDiag = getSymbolAccessibilityDiagnostic;
|
|
89688
89726
|
getSymbolAccessibilityDiagnostic = ts.createGetSymbolAccessibilityDiagnosticForNode(p);
|
|
89689
89727
|
}
|
|
89690
|
-
var newParam = factory.updateParameterDeclaration(p, maskModifiers(p, modifierMask), p.dotDotDotToken,
|
|
89728
|
+
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
89729
|
if (!suppressNewDiagnosticContexts) {
|
|
89692
89730
|
getSymbolAccessibilityDiagnostic = oldDiag;
|
|
89693
89731
|
}
|
|
@@ -97010,6 +97048,7 @@ var ts;
|
|
|
97010
97048
|
ts.Diagnostics.let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations.code,
|
|
97011
97049
|
ts.Diagnostics.Class_constructor_may_not_be_a_generator.code,
|
|
97012
97050
|
ts.Diagnostics.Class_constructor_may_not_be_an_accessor.code,
|
|
97051
|
+
ts.Diagnostics.await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules.code,
|
|
97013
97052
|
]);
|
|
97014
97053
|
function shouldProgramCreateNewSourceFiles(program, newOptions) {
|
|
97015
97054
|
if (!program)
|
|
@@ -101452,9 +101491,11 @@ var ts;
|
|
|
101452
101491
|
}
|
|
101453
101492
|
function watchAffectingLocationsOfResolution(resolution, addToResolutionsWithOnlyAffectingLocations) {
|
|
101454
101493
|
ts.Debug.assert(!!resolution.refCount);
|
|
101494
|
+
var affectingLocations = resolution.affectingLocations;
|
|
101495
|
+
if (!affectingLocations.length)
|
|
101496
|
+
return;
|
|
101455
101497
|
if (addToResolutionsWithOnlyAffectingLocations)
|
|
101456
101498
|
resolutionsWithOnlyAffectingLocations.push(resolution);
|
|
101457
|
-
var affectingLocations = resolution.affectingLocations;
|
|
101458
101499
|
for (var _i = 0, affectingLocations_1 = affectingLocations; _i < affectingLocations_1.length; _i++) {
|
|
101459
101500
|
var affectingLocation = affectingLocations_1[_i];
|
|
101460
101501
|
createFileWatcherOfAffectingLocation(affectingLocation);
|