typescript 4.6.0-dev.20220203 → 4.6.0-dev.20220207
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 +54 -43
- package/lib/tsserver.js +233 -139
- package/lib/tsserverlibrary.js +233 -139
- package/lib/typescript.js +233 -139
- package/lib/typescriptServices.js +233 -139
- package/lib/typingsInstaller.js +66 -46
- 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.20220207";
|
|
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?"),
|
|
@@ -60938,23 +60937,6 @@ var ts;
|
|
|
60938
60937
|
if (assignmentKind && lexicallyScopedSymbol && lexicallyScopedSymbol.valueDeclaration && ts.isMethodDeclaration(lexicallyScopedSymbol.valueDeclaration)) {
|
|
60939
60938
|
grammarErrorOnNode(right, ts.Diagnostics.Cannot_assign_to_private_method_0_Private_methods_are_not_writable, ts.idText(right));
|
|
60940
60939
|
}
|
|
60941
|
-
if ((lexicallyScopedSymbol === null || lexicallyScopedSymbol === void 0 ? void 0 : lexicallyScopedSymbol.valueDeclaration) && (ts.getEmitScriptTarget(compilerOptions) === 99 && !useDefineForClassFields)) {
|
|
60942
|
-
var lexicalClass_1 = ts.getContainingClass(lexicallyScopedSymbol.valueDeclaration);
|
|
60943
|
-
var parentStaticFieldInitializer = ts.findAncestor(node, function (n) {
|
|
60944
|
-
if (n === lexicalClass_1)
|
|
60945
|
-
return "quit";
|
|
60946
|
-
if (ts.isPropertyDeclaration(n.parent) && ts.hasStaticModifier(n.parent) && n.parent.initializer === n && n.parent.parent === lexicalClass_1) {
|
|
60947
|
-
return true;
|
|
60948
|
-
}
|
|
60949
|
-
return false;
|
|
60950
|
-
});
|
|
60951
|
-
if (parentStaticFieldInitializer) {
|
|
60952
|
-
var parentStaticFieldInitializerSymbol = getSymbolOfNode(parentStaticFieldInitializer.parent);
|
|
60953
|
-
ts.Debug.assert(parentStaticFieldInitializerSymbol, "Initializer without declaration symbol");
|
|
60954
|
-
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));
|
|
60955
|
-
ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(parentStaticFieldInitializer.parent, ts.Diagnostics.Initializer_for_property_0, ts.symbolName(parentStaticFieldInitializerSymbol)));
|
|
60956
|
-
}
|
|
60957
|
-
}
|
|
60958
60940
|
if (isAnyLike) {
|
|
60959
60941
|
if (lexicallyScopedSymbol) {
|
|
60960
60942
|
return isErrorType(apparentType) ? errorType : apparentType;
|
|
@@ -65881,9 +65863,6 @@ var ts;
|
|
|
65881
65863
|
checkGrammarComputedPropertyName(node.name);
|
|
65882
65864
|
checkVariableLikeDeclaration(node);
|
|
65883
65865
|
setNodeLinksForPrivateIdentifierScope(node);
|
|
65884
|
-
if (ts.isPrivateIdentifier(node.name) && ts.hasStaticModifier(node) && node.initializer && languageVersion === 99 && !compilerOptions.useDefineForClassFields) {
|
|
65885
|
-
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);
|
|
65886
|
-
}
|
|
65887
65866
|
if (ts.hasSyntacticModifier(node, 128) && node.kind === 166 && node.initializer) {
|
|
65888
65867
|
error(node, ts.Diagnostics.Property_0_cannot_have_an_initializer_because_it_is_marked_abstract, ts.declarationNameToString(node.name));
|
|
65889
65868
|
}
|
|
@@ -77054,8 +77033,8 @@ var ts;
|
|
|
77054
77033
|
var languageVersion = ts.getEmitScriptTarget(compilerOptions);
|
|
77055
77034
|
var useDefineForClassFields = ts.getUseDefineForClassFields(compilerOptions);
|
|
77056
77035
|
var shouldTransformPrivateElementsOrClassStaticBlocks = languageVersion < 9;
|
|
77057
|
-
var
|
|
77058
|
-
var
|
|
77036
|
+
var shouldTransformThisInStaticInitializers = languageVersion < 9;
|
|
77037
|
+
var shouldTransformSuperInStaticInitializers = shouldTransformThisInStaticInitializers && languageVersion >= 2;
|
|
77059
77038
|
var previousOnSubstituteNode = context.onSubstituteNode;
|
|
77060
77039
|
context.onSubstituteNode = onSubstituteNode;
|
|
77061
77040
|
var previousOnEmitNode = context.onEmitNode;
|
|
@@ -77255,6 +77234,9 @@ var ts;
|
|
|
77255
77234
|
ts.Debug.assert(!ts.some(node.decorators));
|
|
77256
77235
|
if (ts.isPrivateIdentifier(node.name)) {
|
|
77257
77236
|
if (!shouldTransformPrivateElementsOrClassStaticBlocks) {
|
|
77237
|
+
if (ts.isStatic(node)) {
|
|
77238
|
+
return ts.visitEachChild(node, visitor, context);
|
|
77239
|
+
}
|
|
77258
77240
|
return factory.updatePropertyDeclaration(node, undefined, ts.visitNodes(node.modifiers, visitor, ts.isModifier), node.name, undefined, undefined, undefined);
|
|
77259
77241
|
}
|
|
77260
77242
|
var info = accessPrivateIdentifier(node.name);
|
|
@@ -77267,6 +77249,18 @@ var ts;
|
|
|
77267
77249
|
if (expr && !ts.isSimpleInlineableExpression(expr)) {
|
|
77268
77250
|
getPendingExpressions().push(expr);
|
|
77269
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
|
+
}
|
|
77270
77264
|
return undefined;
|
|
77271
77265
|
}
|
|
77272
77266
|
function createPrivateIdentifierAccess(info, receiver) {
|
|
@@ -77625,7 +77619,6 @@ var ts;
|
|
|
77625
77619
|
if (facts & 8) {
|
|
77626
77620
|
enableSubstitutionForClassStaticThisOrSuperReference();
|
|
77627
77621
|
}
|
|
77628
|
-
var staticProperties = ts.getStaticPropertiesAndClassStaticBlock(node);
|
|
77629
77622
|
var pendingClassReferenceAssignment;
|
|
77630
77623
|
if (facts & 2) {
|
|
77631
77624
|
var temp = factory.createTempVariable(hoistVariableDeclaration, true);
|
|
@@ -77643,6 +77636,7 @@ var ts;
|
|
|
77643
77636
|
if (ts.some(pendingExpressions)) {
|
|
77644
77637
|
statements.push(factory.createExpressionStatement(factory.inlineExpressions(pendingExpressions)));
|
|
77645
77638
|
}
|
|
77639
|
+
var staticProperties = ts.getStaticPropertiesAndClassStaticBlock(node);
|
|
77646
77640
|
if (ts.some(staticProperties)) {
|
|
77647
77641
|
addPropertyOrClassStaticBlockStatements(statements, staticProperties, factory.getInternalName(node));
|
|
77648
77642
|
}
|
|
@@ -77673,7 +77667,7 @@ var ts;
|
|
|
77673
77667
|
getClassLexicalEnvironment().classConstructor = factory.cloneNode(temp);
|
|
77674
77668
|
}
|
|
77675
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));
|
|
77676
|
-
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); });
|
|
77677
77671
|
if (hasTransformableStatics || ts.some(pendingExpressions)) {
|
|
77678
77672
|
if (isDecoratedClassDeclaration) {
|
|
77679
77673
|
ts.Debug.assertIsDefined(pendingStatements, "Decorated classes transformed by TypeScript are expected to be within a variable declaration.");
|
|
@@ -77714,6 +77708,7 @@ var ts;
|
|
|
77714
77708
|
return undefined;
|
|
77715
77709
|
}
|
|
77716
77710
|
function transformClassMembers(node, isDerivedClass) {
|
|
77711
|
+
var members = [];
|
|
77717
77712
|
if (shouldTransformPrivateElementsOrClassStaticBlocks) {
|
|
77718
77713
|
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
|
|
77719
77714
|
var member = _a[_i];
|
|
@@ -77725,12 +77720,18 @@ var ts;
|
|
|
77725
77720
|
createBrandCheckWeakSetForPrivateMethods();
|
|
77726
77721
|
}
|
|
77727
77722
|
}
|
|
77728
|
-
var members = [];
|
|
77729
77723
|
var constructor = transformConstructor(node, isDerivedClass);
|
|
77724
|
+
var visitedMembers = ts.visitNodes(node.members, classElementVisitor, ts.isClassElement);
|
|
77730
77725
|
if (constructor) {
|
|
77731
77726
|
members.push(constructor);
|
|
77732
77727
|
}
|
|
77733
|
-
|
|
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);
|
|
77734
77735
|
return ts.setTextRange(factory.createNodeArray(members), node.members);
|
|
77735
77736
|
}
|
|
77736
77737
|
function createBrandCheckWeakSetForPrivateMethods() {
|
|
@@ -77835,21 +77836,31 @@ var ts;
|
|
|
77835
77836
|
function addPropertyOrClassStaticBlockStatements(statements, properties, receiver) {
|
|
77836
77837
|
for (var _i = 0, properties_7 = properties; _i < properties_7.length; _i++) {
|
|
77837
77838
|
var property = properties_7[_i];
|
|
77838
|
-
|
|
77839
|
-
|
|
77840
|
-
|
|
77841
|
-
|
|
77839
|
+
if (ts.isStatic(property) && !shouldTransformPrivateElementsOrClassStaticBlocks && !useDefineForClassFields) {
|
|
77840
|
+
continue;
|
|
77841
|
+
}
|
|
77842
|
+
var statement = transformPropertyOrClassStaticBlock(property, receiver);
|
|
77843
|
+
if (!statement) {
|
|
77842
77844
|
continue;
|
|
77843
77845
|
}
|
|
77844
|
-
var statement = factory.createExpressionStatement(expression);
|
|
77845
|
-
ts.setSourceMapRange(statement, ts.moveRangePastModifiers(property));
|
|
77846
|
-
ts.setCommentRange(statement, property);
|
|
77847
|
-
ts.setOriginalNode(statement, property);
|
|
77848
|
-
ts.setSyntheticLeadingComments(expression, undefined);
|
|
77849
|
-
ts.setSyntheticTrailingComments(expression, undefined);
|
|
77850
77846
|
statements.push(statement);
|
|
77851
77847
|
}
|
|
77852
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
|
+
}
|
|
77853
77864
|
function generateInitializedPropertyExpressionsOrClassStaticBlock(propertiesOrClassStaticBlocks, receiver) {
|
|
77854
77865
|
var expressions = [];
|
|
77855
77866
|
for (var _i = 0, propertiesOrClassStaticBlocks_1 = propertiesOrClassStaticBlocks; _i < propertiesOrClassStaticBlocks_1.length; _i++) {
|