typescript 4.6.0-dev.20220202 → 4.6.0-dev.20220206
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 +63 -46
- package/lib/tsserver.js +259 -145
- package/lib/tsserverlibrary.js +259 -145
- package/lib/typescript.js +259 -145
- package/lib/typescriptServices.js +259 -145
- package/lib/typingsInstaller.js +75 -50
- package/package.json +1 -1
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.6";
|
|
72
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
72
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220206";
|
|
73
73
|
var NativeCollections;
|
|
74
74
|
(function (NativeCollections) {
|
|
75
75
|
var globals = typeof globalThis !== "undefined" ? globalThis :
|
|
@@ -1087,11 +1087,11 @@ var ts;
|
|
|
1087
1087
|
return result;
|
|
1088
1088
|
}
|
|
1089
1089
|
ts.getAllKeys = getAllKeys;
|
|
1090
|
-
function getOwnValues(
|
|
1090
|
+
function getOwnValues(collection) {
|
|
1091
1091
|
var values = [];
|
|
1092
|
-
for (var key in
|
|
1093
|
-
if (hasOwnProperty.call(
|
|
1094
|
-
values.push(
|
|
1092
|
+
for (var key in collection) {
|
|
1093
|
+
if (hasOwnProperty.call(collection, key)) {
|
|
1094
|
+
values.push(collection[key]);
|
|
1095
1095
|
}
|
|
1096
1096
|
}
|
|
1097
1097
|
return values;
|
|
@@ -5895,12 +5895,10 @@ var ts;
|
|
|
5895
5895
|
Type_0_can_only_be_iterated_through_when_using_the_downlevelIteration_flag_or_with_a_target_of_es2015_or_higher: diag(2802, ts.DiagnosticCategory.Error, "Type_0_can_only_be_iterated_through_when_using_the_downlevelIteration_flag_or_with_a_target_of_es201_2802", "Type '{0}' can only be iterated through when using the '--downlevelIteration' flag or with a '--target' of 'es2015' or higher."),
|
|
5896
5896
|
Cannot_assign_to_private_method_0_Private_methods_are_not_writable: diag(2803, ts.DiagnosticCategory.Error, "Cannot_assign_to_private_method_0_Private_methods_are_not_writable_2803", "Cannot assign to private method '{0}'. Private methods are not writable."),
|
|
5897
5897
|
Duplicate_identifier_0_Static_and_instance_elements_cannot_share_the_same_private_name: diag(2804, ts.DiagnosticCategory.Error, "Duplicate_identifier_0_Static_and_instance_elements_cannot_share_the_same_private_name_2804", "Duplicate identifier '{0}'. Static and instance elements cannot share the same private name."),
|
|
5898
|
-
Static_fields_with_private_names_can_t_have_initializers_when_the_useDefineForClassFields_flag_is_not_specified_with_a_target_of_esnext_Consider_adding_the_useDefineForClassFields_flag: diag(2805, ts.DiagnosticCategory.Error, "Static_fields_with_private_names_can_t_have_initializers_when_the_useDefineForClassFields_flag_is_no_2805", "Static fields with private names can't have initializers when the '--useDefineForClassFields' flag is not specified with a '--target' of 'esnext'. Consider adding the '--useDefineForClassFields' flag."),
|
|
5899
5898
|
Private_accessor_was_defined_without_a_getter: diag(2806, ts.DiagnosticCategory.Error, "Private_accessor_was_defined_without_a_getter_2806", "Private accessor was defined without a getter."),
|
|
5900
5899
|
This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_one_in_0_Consider_upgrading_your_version_of_0: diag(2807, ts.DiagnosticCategory.Error, "This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_o_2807", "This syntax requires an imported helper named '{1}' with {2} parameters, which is not compatible with the one in '{0}'. Consider upgrading your version of '{0}'."),
|
|
5901
5900
|
A_get_accessor_must_be_at_least_as_accessible_as_the_setter: diag(2808, ts.DiagnosticCategory.Error, "A_get_accessor_must_be_at_least_as_accessible_as_the_setter_2808", "A get accessor must be at least as accessible as the setter"),
|
|
5902
5901
|
Declaration_or_statement_expected_This_follows_a_block_of_statements_so_if_you_intended_to_write_a_destructuring_assignment_you_might_need_to_wrap_the_the_whole_assignment_in_parentheses: diag(2809, ts.DiagnosticCategory.Error, "Declaration_or_statement_expected_This_follows_a_block_of_statements_so_if_you_intended_to_write_a_d_2809", "Declaration or statement expected. This '=' follows a block of statements, so if you intended to write a destructuring assignment, you might need to wrap the the whole assignment in parentheses."),
|
|
5903
|
-
Property_0_may_not_be_used_in_a_static_property_s_initializer_in_the_same_class_when_target_is_esnext_and_useDefineForClassFields_is_false: diag(2810, ts.DiagnosticCategory.Error, "Property_0_may_not_be_used_in_a_static_property_s_initializer_in_the_same_class_when_target_is_esnex_2810", "Property '{0}' may not be used in a static property's initializer in the same class when 'target' is 'esnext' and 'useDefineForClassFields' is 'false'."),
|
|
5904
5902
|
Initializer_for_property_0: diag(2811, ts.DiagnosticCategory.Error, "Initializer_for_property_0_2811", "Initializer for property '{0}'"),
|
|
5905
5903
|
Property_0_does_not_exist_on_type_1_Try_changing_the_lib_compiler_option_to_include_dom: diag(2812, ts.DiagnosticCategory.Error, "Property_0_does_not_exist_on_type_1_Try_changing_the_lib_compiler_option_to_include_dom_2812", "Property '{0}' does not exist on type '{1}'. Try changing the 'lib' compiler option to include 'dom'."),
|
|
5906
5904
|
Class_declaration_cannot_implement_overload_list_for_0: diag(2813, ts.DiagnosticCategory.Error, "Class_declaration_cannot_implement_overload_list_for_0_2813", "Class declaration cannot implement overload list for '{0}'."),
|
|
@@ -6851,6 +6849,7 @@ var ts;
|
|
|
6851
6849
|
Add_missing_attributes: diag(95167, ts.DiagnosticCategory.Message, "Add_missing_attributes_95167", "Add missing attributes"),
|
|
6852
6850
|
Add_all_missing_attributes: diag(95168, ts.DiagnosticCategory.Message, "Add_all_missing_attributes_95168", "Add all missing attributes"),
|
|
6853
6851
|
Add_undefined_to_optional_property_type: diag(95169, ts.DiagnosticCategory.Message, "Add_undefined_to_optional_property_type_95169", "Add 'undefined' to optional property type"),
|
|
6852
|
+
Convert_named_imports_to_default_import: diag(95170, ts.DiagnosticCategory.Message, "Convert_named_imports_to_default_import_95170", "Convert named imports to default import"),
|
|
6854
6853
|
No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer: diag(18004, ts.DiagnosticCategory.Error, "No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer_18004", "No value exists in scope for the shorthand property '{0}'. Either declare one or provide an initializer."),
|
|
6855
6854
|
Classes_may_not_have_a_field_named_constructor: diag(18006, ts.DiagnosticCategory.Error, "Classes_may_not_have_a_field_named_constructor_18006", "Classes may not have a field named 'constructor'."),
|
|
6856
6855
|
JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array: diag(18007, ts.DiagnosticCategory.Error, "JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array_18007", "JSX expressions may not use the comma operator. Did you mean to write an array?"),
|
|
@@ -9583,11 +9582,17 @@ var ts;
|
|
|
9583
9582
|
ts.getAllJSDocTagsOfKind = getAllJSDocTagsOfKind;
|
|
9584
9583
|
function getTextOfJSDocComment(comment) {
|
|
9585
9584
|
return typeof comment === "string" ? comment
|
|
9586
|
-
: comment === null || comment === void 0 ? void 0 : comment.map(function (c) {
|
|
9587
|
-
return c.kind === 319 ? c.text : "{@link " + (c.name ? ts.entityNameToString(c.name) + " " : "") + c.text + "}";
|
|
9588
|
-
}).join("");
|
|
9585
|
+
: comment === null || comment === void 0 ? void 0 : comment.map(function (c) { return c.kind === 319 ? c.text : formatJSDocLink(c); }).join("");
|
|
9589
9586
|
}
|
|
9590
9587
|
ts.getTextOfJSDocComment = getTextOfJSDocComment;
|
|
9588
|
+
function formatJSDocLink(link) {
|
|
9589
|
+
var kind = link.kind === 322 ? "link"
|
|
9590
|
+
: link.kind === 323 ? "linkcode"
|
|
9591
|
+
: "linkplain";
|
|
9592
|
+
var name = link.name ? ts.entityNameToString(link.name) : "";
|
|
9593
|
+
var space = link.name && link.text.startsWith("://") ? "" : " ";
|
|
9594
|
+
return "{@" + kind + " " + name + space + link.text + "}";
|
|
9595
|
+
}
|
|
9591
9596
|
function getEffectiveTypeParameterDeclarations(node) {
|
|
9592
9597
|
if (ts.isJSDocSignature(node)) {
|
|
9593
9598
|
return ts.emptyArray;
|
|
@@ -60932,23 +60937,6 @@ var ts;
|
|
|
60932
60937
|
if (assignmentKind && lexicallyScopedSymbol && lexicallyScopedSymbol.valueDeclaration && ts.isMethodDeclaration(lexicallyScopedSymbol.valueDeclaration)) {
|
|
60933
60938
|
grammarErrorOnNode(right, ts.Diagnostics.Cannot_assign_to_private_method_0_Private_methods_are_not_writable, ts.idText(right));
|
|
60934
60939
|
}
|
|
60935
|
-
if ((lexicallyScopedSymbol === null || lexicallyScopedSymbol === void 0 ? void 0 : lexicallyScopedSymbol.valueDeclaration) && (ts.getEmitScriptTarget(compilerOptions) === 99 && !useDefineForClassFields)) {
|
|
60936
|
-
var lexicalClass_1 = ts.getContainingClass(lexicallyScopedSymbol.valueDeclaration);
|
|
60937
|
-
var parentStaticFieldInitializer = ts.findAncestor(node, function (n) {
|
|
60938
|
-
if (n === lexicalClass_1)
|
|
60939
|
-
return "quit";
|
|
60940
|
-
if (ts.isPropertyDeclaration(n.parent) && ts.hasStaticModifier(n.parent) && n.parent.initializer === n && n.parent.parent === lexicalClass_1) {
|
|
60941
|
-
return true;
|
|
60942
|
-
}
|
|
60943
|
-
return false;
|
|
60944
|
-
});
|
|
60945
|
-
if (parentStaticFieldInitializer) {
|
|
60946
|
-
var parentStaticFieldInitializerSymbol = getSymbolOfNode(parentStaticFieldInitializer.parent);
|
|
60947
|
-
ts.Debug.assert(parentStaticFieldInitializerSymbol, "Initializer without declaration symbol");
|
|
60948
|
-
var diagnostic = error(node, ts.Diagnostics.Property_0_may_not_be_used_in_a_static_property_s_initializer_in_the_same_class_when_target_is_esnext_and_useDefineForClassFields_is_false, ts.symbolName(lexicallyScopedSymbol));
|
|
60949
|
-
ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(parentStaticFieldInitializer.parent, ts.Diagnostics.Initializer_for_property_0, ts.symbolName(parentStaticFieldInitializerSymbol)));
|
|
60950
|
-
}
|
|
60951
|
-
}
|
|
60952
60940
|
if (isAnyLike) {
|
|
60953
60941
|
if (lexicallyScopedSymbol) {
|
|
60954
60942
|
return isErrorType(apparentType) ? errorType : apparentType;
|
|
@@ -65875,9 +65863,6 @@ var ts;
|
|
|
65875
65863
|
checkGrammarComputedPropertyName(node.name);
|
|
65876
65864
|
checkVariableLikeDeclaration(node);
|
|
65877
65865
|
setNodeLinksForPrivateIdentifierScope(node);
|
|
65878
|
-
if (ts.isPrivateIdentifier(node.name) && ts.hasStaticModifier(node) && node.initializer && languageVersion === 99 && !compilerOptions.useDefineForClassFields) {
|
|
65879
|
-
error(node.initializer, ts.Diagnostics.Static_fields_with_private_names_can_t_have_initializers_when_the_useDefineForClassFields_flag_is_not_specified_with_a_target_of_esnext_Consider_adding_the_useDefineForClassFields_flag);
|
|
65880
|
-
}
|
|
65881
65866
|
if (ts.hasSyntacticModifier(node, 128) && node.kind === 166 && node.initializer) {
|
|
65882
65867
|
error(node, ts.Diagnostics.Property_0_cannot_have_an_initializer_because_it_is_marked_abstract, ts.declarationNameToString(node.name));
|
|
65883
65868
|
}
|
|
@@ -77048,8 +77033,8 @@ var ts;
|
|
|
77048
77033
|
var languageVersion = ts.getEmitScriptTarget(compilerOptions);
|
|
77049
77034
|
var useDefineForClassFields = ts.getUseDefineForClassFields(compilerOptions);
|
|
77050
77035
|
var shouldTransformPrivateElementsOrClassStaticBlocks = languageVersion < 9;
|
|
77051
|
-
var
|
|
77052
|
-
var
|
|
77036
|
+
var shouldTransformThisInStaticInitializers = languageVersion < 9;
|
|
77037
|
+
var shouldTransformSuperInStaticInitializers = shouldTransformThisInStaticInitializers && languageVersion >= 2;
|
|
77053
77038
|
var previousOnSubstituteNode = context.onSubstituteNode;
|
|
77054
77039
|
context.onSubstituteNode = onSubstituteNode;
|
|
77055
77040
|
var previousOnEmitNode = context.onEmitNode;
|
|
@@ -77249,6 +77234,9 @@ var ts;
|
|
|
77249
77234
|
ts.Debug.assert(!ts.some(node.decorators));
|
|
77250
77235
|
if (ts.isPrivateIdentifier(node.name)) {
|
|
77251
77236
|
if (!shouldTransformPrivateElementsOrClassStaticBlocks) {
|
|
77237
|
+
if (ts.isStatic(node)) {
|
|
77238
|
+
return ts.visitEachChild(node, visitor, context);
|
|
77239
|
+
}
|
|
77252
77240
|
return factory.updatePropertyDeclaration(node, undefined, ts.visitNodes(node.modifiers, visitor, ts.isModifier), node.name, undefined, undefined, undefined);
|
|
77253
77241
|
}
|
|
77254
77242
|
var info = accessPrivateIdentifier(node.name);
|
|
@@ -77261,6 +77249,18 @@ var ts;
|
|
|
77261
77249
|
if (expr && !ts.isSimpleInlineableExpression(expr)) {
|
|
77262
77250
|
getPendingExpressions().push(expr);
|
|
77263
77251
|
}
|
|
77252
|
+
if (ts.isStatic(node) && !shouldTransformPrivateElementsOrClassStaticBlocks && !useDefineForClassFields) {
|
|
77253
|
+
var initializerStatement = transformPropertyOrClassStaticBlock(node, factory.createThis());
|
|
77254
|
+
if (initializerStatement) {
|
|
77255
|
+
var staticBlock = factory.createClassStaticBlockDeclaration(undefined, undefined, factory.createBlock([initializerStatement]));
|
|
77256
|
+
ts.setOriginalNode(staticBlock, node);
|
|
77257
|
+
ts.setCommentRange(staticBlock, node);
|
|
77258
|
+
ts.setCommentRange(initializerStatement, { pos: -1, end: -1 });
|
|
77259
|
+
ts.setSyntheticLeadingComments(initializerStatement, undefined);
|
|
77260
|
+
ts.setSyntheticTrailingComments(initializerStatement, undefined);
|
|
77261
|
+
return staticBlock;
|
|
77262
|
+
}
|
|
77263
|
+
}
|
|
77264
77264
|
return undefined;
|
|
77265
77265
|
}
|
|
77266
77266
|
function createPrivateIdentifierAccess(info, receiver) {
|
|
@@ -77619,7 +77619,6 @@ var ts;
|
|
|
77619
77619
|
if (facts & 8) {
|
|
77620
77620
|
enableSubstitutionForClassStaticThisOrSuperReference();
|
|
77621
77621
|
}
|
|
77622
|
-
var staticProperties = ts.getStaticPropertiesAndClassStaticBlock(node);
|
|
77623
77622
|
var pendingClassReferenceAssignment;
|
|
77624
77623
|
if (facts & 2) {
|
|
77625
77624
|
var temp = factory.createTempVariable(hoistVariableDeclaration, true);
|
|
@@ -77637,6 +77636,7 @@ var ts;
|
|
|
77637
77636
|
if (ts.some(pendingExpressions)) {
|
|
77638
77637
|
statements.push(factory.createExpressionStatement(factory.inlineExpressions(pendingExpressions)));
|
|
77639
77638
|
}
|
|
77639
|
+
var staticProperties = ts.getStaticPropertiesAndClassStaticBlock(node);
|
|
77640
77640
|
if (ts.some(staticProperties)) {
|
|
77641
77641
|
addPropertyOrClassStaticBlockStatements(statements, staticProperties, factory.getInternalName(node));
|
|
77642
77642
|
}
|
|
@@ -77667,7 +77667,7 @@ var ts;
|
|
|
77667
77667
|
getClassLexicalEnvironment().classConstructor = factory.cloneNode(temp);
|
|
77668
77668
|
}
|
|
77669
77669
|
var classExpression = factory.updateClassExpression(node, ts.visitNodes(node.decorators, visitor, ts.isDecorator), node.modifiers, node.name, undefined, ts.visitNodes(node.heritageClauses, heritageClauseVisitor, ts.isHeritageClause), transformClassMembers(node, isDerivedClass));
|
|
77670
|
-
var hasTransformableStatics = ts.some(staticPropertiesOrClassStaticBlocks, function (p) { return ts.isClassStaticBlockDeclaration(p) || !!p.initializer ||
|
|
77670
|
+
var hasTransformableStatics = shouldTransformPrivateElementsOrClassStaticBlocks && ts.some(staticPropertiesOrClassStaticBlocks, function (p) { return ts.isClassStaticBlockDeclaration(p) || !!p.initializer || ts.isPrivateIdentifier(p.name); });
|
|
77671
77671
|
if (hasTransformableStatics || ts.some(pendingExpressions)) {
|
|
77672
77672
|
if (isDecoratedClassDeclaration) {
|
|
77673
77673
|
ts.Debug.assertIsDefined(pendingStatements, "Decorated classes transformed by TypeScript are expected to be within a variable declaration.");
|
|
@@ -77708,6 +77708,7 @@ var ts;
|
|
|
77708
77708
|
return undefined;
|
|
77709
77709
|
}
|
|
77710
77710
|
function transformClassMembers(node, isDerivedClass) {
|
|
77711
|
+
var members = [];
|
|
77711
77712
|
if (shouldTransformPrivateElementsOrClassStaticBlocks) {
|
|
77712
77713
|
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
|
|
77713
77714
|
var member = _a[_i];
|
|
@@ -77719,12 +77720,18 @@ var ts;
|
|
|
77719
77720
|
createBrandCheckWeakSetForPrivateMethods();
|
|
77720
77721
|
}
|
|
77721
77722
|
}
|
|
77722
|
-
var members = [];
|
|
77723
77723
|
var constructor = transformConstructor(node, isDerivedClass);
|
|
77724
|
+
var visitedMembers = ts.visitNodes(node.members, classElementVisitor, ts.isClassElement);
|
|
77724
77725
|
if (constructor) {
|
|
77725
77726
|
members.push(constructor);
|
|
77726
77727
|
}
|
|
77727
|
-
|
|
77728
|
+
if (!shouldTransformPrivateElementsOrClassStaticBlocks && ts.some(pendingExpressions)) {
|
|
77729
|
+
members.push(factory.createClassStaticBlockDeclaration(undefined, undefined, factory.createBlock([
|
|
77730
|
+
factory.createExpressionStatement(factory.inlineExpressions(pendingExpressions))
|
|
77731
|
+
])));
|
|
77732
|
+
pendingExpressions = undefined;
|
|
77733
|
+
}
|
|
77734
|
+
ts.addRange(members, visitedMembers);
|
|
77728
77735
|
return ts.setTextRange(factory.createNodeArray(members), node.members);
|
|
77729
77736
|
}
|
|
77730
77737
|
function createBrandCheckWeakSetForPrivateMethods() {
|
|
@@ -77829,21 +77836,31 @@ var ts;
|
|
|
77829
77836
|
function addPropertyOrClassStaticBlockStatements(statements, properties, receiver) {
|
|
77830
77837
|
for (var _i = 0, properties_7 = properties; _i < properties_7.length; _i++) {
|
|
77831
77838
|
var property = properties_7[_i];
|
|
77832
|
-
|
|
77833
|
-
|
|
77834
|
-
|
|
77835
|
-
|
|
77839
|
+
if (ts.isStatic(property) && !shouldTransformPrivateElementsOrClassStaticBlocks && !useDefineForClassFields) {
|
|
77840
|
+
continue;
|
|
77841
|
+
}
|
|
77842
|
+
var statement = transformPropertyOrClassStaticBlock(property, receiver);
|
|
77843
|
+
if (!statement) {
|
|
77836
77844
|
continue;
|
|
77837
77845
|
}
|
|
77838
|
-
var statement = factory.createExpressionStatement(expression);
|
|
77839
|
-
ts.setSourceMapRange(statement, ts.moveRangePastModifiers(property));
|
|
77840
|
-
ts.setCommentRange(statement, property);
|
|
77841
|
-
ts.setOriginalNode(statement, property);
|
|
77842
|
-
ts.setSyntheticLeadingComments(expression, undefined);
|
|
77843
|
-
ts.setSyntheticTrailingComments(expression, undefined);
|
|
77844
77846
|
statements.push(statement);
|
|
77845
77847
|
}
|
|
77846
77848
|
}
|
|
77849
|
+
function transformPropertyOrClassStaticBlock(property, receiver) {
|
|
77850
|
+
var expression = ts.isClassStaticBlockDeclaration(property) ?
|
|
77851
|
+
transformClassStaticBlockDeclaration(property) :
|
|
77852
|
+
transformProperty(property, receiver);
|
|
77853
|
+
if (!expression) {
|
|
77854
|
+
return undefined;
|
|
77855
|
+
}
|
|
77856
|
+
var statement = factory.createExpressionStatement(expression);
|
|
77857
|
+
ts.setSourceMapRange(statement, ts.moveRangePastModifiers(property));
|
|
77858
|
+
ts.setCommentRange(statement, property);
|
|
77859
|
+
ts.setOriginalNode(statement, property);
|
|
77860
|
+
ts.setSyntheticLeadingComments(expression, undefined);
|
|
77861
|
+
ts.setSyntheticTrailingComments(expression, undefined);
|
|
77862
|
+
return statement;
|
|
77863
|
+
}
|
|
77847
77864
|
function generateInitializedPropertyExpressionsOrClassStaticBlock(propertiesOrClassStaticBlocks, receiver) {
|
|
77848
77865
|
var expressions = [];
|
|
77849
77866
|
for (var _i = 0, propertiesOrClassStaticBlocks_1 = propertiesOrClassStaticBlocks; _i < propertiesOrClassStaticBlocks_1.length; _i++) {
|