typescript 4.8.0-dev.20220531 → 4.8.0-dev.20220603
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 +186 -137
- package/lib/tsserver.js +242 -163
- package/lib/tsserverlibrary.d.ts +26 -0
- package/lib/tsserverlibrary.js +242 -163
- package/lib/typescript.d.ts +26 -0
- package/lib/typescript.js +242 -163
- package/lib/typescriptServices.d.ts +26 -0
- package/lib/typescriptServices.js +242 -163
- package/lib/typingsInstaller.js +222 -160
- package/package.json +1 -1
- package/test.js +9 -0
- package/test.ts +4 -0
package/lib/typingsInstaller.js
CHANGED
|
@@ -89,7 +89,7 @@ var ts;
|
|
|
89
89
|
// The following is baselined as a literal template type without intervention
|
|
90
90
|
/** The version of the TypeScript compiler release */
|
|
91
91
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
92
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
92
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220603";
|
|
93
93
|
/* @internal */
|
|
94
94
|
var Comparison;
|
|
95
95
|
(function (Comparison) {
|
|
@@ -8191,6 +8191,7 @@ var ts;
|
|
|
8191
8191
|
Decorators_are_not_valid_here: diag(1206, ts.DiagnosticCategory.Error, "Decorators_are_not_valid_here_1206", "Decorators are not valid here."),
|
|
8192
8192
|
Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name: diag(1207, ts.DiagnosticCategory.Error, "Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name_1207", "Decorators cannot be applied to multiple get/set accessors of the same name."),
|
|
8193
8193
|
_0_cannot_be_compiled_under_isolatedModules_because_it_is_considered_a_global_script_file_Add_an_import_export_or_an_empty_export_statement_to_make_it_a_module: diag(1208, ts.DiagnosticCategory.Error, "_0_cannot_be_compiled_under_isolatedModules_because_it_is_considered_a_global_script_file_Add_an_imp_1208", "'{0}' cannot be compiled under '--isolatedModules' because it is considered a global script file. Add an import, export, or an empty 'export {}' statement to make it a module."),
|
|
8194
|
+
Invalid_optional_chain_from_new_expression_Did_you_mean_to_call_0: diag(1209, ts.DiagnosticCategory.Error, "Invalid_optional_chain_from_new_expression_Did_you_mean_to_call_0_1209", "Invalid optional chain from new expression. Did you mean to call '{0}()'?"),
|
|
8194
8195
|
Code_contained_in_a_class_is_evaluated_in_JavaScript_s_strict_mode_which_does_not_allow_this_use_of_0_For_more_information_see_https_Colon_Slash_Slashdeveloper_mozilla_org_Slashen_US_Slashdocs_SlashWeb_SlashJavaScript_SlashReference_SlashStrict_mode: diag(1210, ts.DiagnosticCategory.Error, "Code_contained_in_a_class_is_evaluated_in_JavaScript_s_strict_mode_which_does_not_allow_this_use_of__1210", "Code contained in a class is evaluated in JavaScript's strict mode which does not allow this use of '{0}'. For more information, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode."),
|
|
8195
8196
|
A_class_declaration_without_the_default_modifier_must_have_a_name: diag(1211, ts.DiagnosticCategory.Error, "A_class_declaration_without_the_default_modifier_must_have_a_name_1211", "A class declaration without the 'default' modifier must have a name."),
|
|
8196
8197
|
Identifier_expected_0_is_a_reserved_word_in_strict_mode: diag(1212, ts.DiagnosticCategory.Error, "Identifier_expected_0_is_a_reserved_word_in_strict_mode_1212", "Identifier expected. '{0}' is a reserved word in strict mode."),
|
|
@@ -8387,7 +8388,7 @@ var ts;
|
|
|
8387
8388
|
Preserve_unused_imported_values_in_the_JavaScript_output_that_would_otherwise_be_removed: diag(1449, ts.DiagnosticCategory.Message, "Preserve_unused_imported_values_in_the_JavaScript_output_that_would_otherwise_be_removed_1449", "Preserve unused imported values in the JavaScript output that would otherwise be removed."),
|
|
8388
8389
|
Dynamic_imports_can_only_accept_a_module_specifier_and_an_optional_assertion_as_arguments: diag(1450, ts.DiagnosticCategory.Message, "Dynamic_imports_can_only_accept_a_module_specifier_and_an_optional_assertion_as_arguments_1450", "Dynamic imports can only accept a module specifier and an optional assertion as arguments"),
|
|
8389
8390
|
Private_identifiers_are_only_allowed_in_class_bodies_and_may_only_be_used_as_part_of_a_class_member_declaration_property_access_or_on_the_left_hand_side_of_an_in_expression: diag(1451, ts.DiagnosticCategory.Error, "Private_identifiers_are_only_allowed_in_class_bodies_and_may_only_be_used_as_part_of_a_class_member__1451", "Private identifiers are only allowed in class bodies and may only be used as part of a class member declaration, property access, or on the left-hand-side of an 'in' expression"),
|
|
8390
|
-
|
|
8391
|
+
resolution_mode_assertions_are_only_supported_when_moduleResolution_is_node16_or_nodenext: diag(1452, ts.DiagnosticCategory.Error, "resolution_mode_assertions_are_only_supported_when_moduleResolution_is_node16_or_nodenext_1452", "'resolution-mode' assertions are only supported when `moduleResolution` is `node16` or `nodenext`."),
|
|
8391
8392
|
resolution_mode_should_be_either_require_or_import: diag(1453, ts.DiagnosticCategory.Error, "resolution_mode_should_be_either_require_or_import_1453", "`resolution-mode` should be either `require` or `import`."),
|
|
8392
8393
|
resolution_mode_can_only_be_set_for_type_only_imports: diag(1454, ts.DiagnosticCategory.Error, "resolution_mode_can_only_be_set_for_type_only_imports_1454", "`resolution-mode` can only be set for type-only imports."),
|
|
8393
8394
|
resolution_mode_is_the_only_valid_key_for_type_import_assertions: diag(1455, ts.DiagnosticCategory.Error, "resolution_mode_is_the_only_valid_key_for_type_import_assertions_1455", "`resolution-mode` is the only valid key for type import assertions."),
|
|
@@ -8894,6 +8895,8 @@ var ts;
|
|
|
8894
8895
|
Import_assertion_values_must_be_string_literal_expressions: diag(2837, ts.DiagnosticCategory.Error, "Import_assertion_values_must_be_string_literal_expressions_2837", "Import assertion values must be string literal expressions."),
|
|
8895
8896
|
All_declarations_of_0_must_have_identical_constraints: diag(2838, ts.DiagnosticCategory.Error, "All_declarations_of_0_must_have_identical_constraints_2838", "All declarations of '{0}' must have identical constraints."),
|
|
8896
8897
|
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."),
|
|
8898
|
+
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"),
|
|
8899
|
+
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'."),
|
|
8897
8900
|
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}'."),
|
|
8898
8901
|
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}'."),
|
|
8899
8902
|
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}'."),
|
|
@@ -9001,7 +9004,7 @@ var ts;
|
|
|
9001
9004
|
This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base_class_0: diag(4122, ts.DiagnosticCategory.Error, "This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base__4122", "This member cannot have a JSDoc comment with an '@override' tag because it is not declared in the base class '{0}'."),
|
|
9002
9005
|
This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base_class_0_Did_you_mean_1: diag(4123, ts.DiagnosticCategory.Error, "This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base__4123", "This member cannot have a JSDoc comment with an 'override' tag because it is not declared in the base class '{0}'. Did you mean '{1}'?"),
|
|
9003
9006
|
Compiler_option_0_of_value_1_is_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next: diag(4124, ts.DiagnosticCategory.Error, "Compiler_option_0_of_value_1_is_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_w_4124", "Compiler option '{0}' of value '{1}' is unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'."),
|
|
9004
|
-
|
|
9007
|
+
resolution_mode_assertions_are_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next: diag(4125, ts.DiagnosticCategory.Error, "resolution_mode_assertions_are_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_wi_4125", "'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'."),
|
|
9005
9008
|
The_current_host_does_not_support_the_0_option: diag(5001, ts.DiagnosticCategory.Error, "The_current_host_does_not_support_the_0_option_5001", "The current host does not support the '{0}' option."),
|
|
9006
9009
|
Cannot_find_the_common_subdirectory_path_for_the_input_files: diag(5009, ts.DiagnosticCategory.Error, "Cannot_find_the_common_subdirectory_path_for_the_input_files_5009", "Cannot find the common subdirectory path for the input files."),
|
|
9007
9010
|
File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0: diag(5010, ts.DiagnosticCategory.Error, "File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0_5010", "File specification cannot end in a recursive directory wildcard ('**'): '{0}'."),
|
|
@@ -16042,6 +16045,8 @@ var ts;
|
|
|
16042
16045
|
case 218 /* AwaitExpression */:
|
|
16043
16046
|
case 231 /* MetaProperty */:
|
|
16044
16047
|
return true;
|
|
16048
|
+
case 228 /* ExpressionWithTypeArguments */:
|
|
16049
|
+
return !ts.isHeritageClause(node.parent);
|
|
16045
16050
|
case 161 /* QualifiedName */:
|
|
16046
16051
|
while (node.parent.kind === 161 /* QualifiedName */) {
|
|
16047
16052
|
node = node.parent;
|
|
@@ -29075,6 +29080,10 @@ var ts;
|
|
|
29075
29080
|
return node.kind === 267 /* ImportClause */;
|
|
29076
29081
|
}
|
|
29077
29082
|
ts.isImportClause = isImportClause;
|
|
29083
|
+
function isImportTypeAssertionContainer(node) {
|
|
29084
|
+
return node.kind === 295 /* ImportTypeAssertionContainer */;
|
|
29085
|
+
}
|
|
29086
|
+
ts.isImportTypeAssertionContainer = isImportTypeAssertionContainer;
|
|
29078
29087
|
function isAssertClause(node) {
|
|
29079
29088
|
return node.kind === 293 /* AssertClause */;
|
|
29080
29089
|
}
|
|
@@ -35647,6 +35656,9 @@ var ts;
|
|
|
35647
35656
|
typeArguments = expression.typeArguments;
|
|
35648
35657
|
expression = expression.expression;
|
|
35649
35658
|
}
|
|
35659
|
+
if (token() === 28 /* QuestionDotToken */) {
|
|
35660
|
+
parseErrorAtCurrentToken(ts.Diagnostics.Invalid_optional_chain_from_new_expression_Did_you_mean_to_call_0, ts.getTextOfNodeFromSourceText(sourceText, expression));
|
|
35661
|
+
}
|
|
35650
35662
|
var argumentList = token() === 20 /* OpenParenToken */ ? parseArgumentList() : undefined;
|
|
35651
35663
|
return finishNode(factory.createNewExpression(expression, typeArguments, argumentList), pos);
|
|
35652
35664
|
}
|
|
@@ -43838,13 +43850,36 @@ var ts;
|
|
|
43838
43850
|
}
|
|
43839
43851
|
return toSearchResult(/*value*/ undefined);
|
|
43840
43852
|
}
|
|
43853
|
+
/**
|
|
43854
|
+
* From https://github.com/nodejs/node/blob/8f39f51cbbd3b2de14b9ee896e26421cc5b20121/lib/internal/modules/esm/resolve.js#L722 -
|
|
43855
|
+
* "longest" has some nuance as to what "longest" means in the presence of pattern trailers
|
|
43856
|
+
*/
|
|
43857
|
+
function comparePatternKeys(a, b) {
|
|
43858
|
+
var aPatternIndex = a.indexOf("*");
|
|
43859
|
+
var bPatternIndex = b.indexOf("*");
|
|
43860
|
+
var baseLenA = aPatternIndex === -1 ? a.length : aPatternIndex + 1;
|
|
43861
|
+
var baseLenB = bPatternIndex === -1 ? b.length : bPatternIndex + 1;
|
|
43862
|
+
if (baseLenA > baseLenB)
|
|
43863
|
+
return -1;
|
|
43864
|
+
if (baseLenB > baseLenA)
|
|
43865
|
+
return 1;
|
|
43866
|
+
if (aPatternIndex === -1)
|
|
43867
|
+
return 1;
|
|
43868
|
+
if (bPatternIndex === -1)
|
|
43869
|
+
return -1;
|
|
43870
|
+
if (a.length > b.length)
|
|
43871
|
+
return -1;
|
|
43872
|
+
if (b.length > a.length)
|
|
43873
|
+
return 1;
|
|
43874
|
+
return 0;
|
|
43875
|
+
}
|
|
43841
43876
|
function loadModuleFromImportsOrExports(extensions, state, cache, redirectedReference, moduleName, lookupTable, scope, isImports) {
|
|
43842
43877
|
var loadModuleFromTargetImportOrExport = getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirectedReference, moduleName, scope, isImports);
|
|
43843
43878
|
if (!ts.endsWith(moduleName, ts.directorySeparator) && moduleName.indexOf("*") === -1 && ts.hasProperty(lookupTable, moduleName)) {
|
|
43844
43879
|
var target = lookupTable[moduleName];
|
|
43845
43880
|
return loadModuleFromTargetImportOrExport(target, /*subpath*/ "", /*pattern*/ false);
|
|
43846
43881
|
}
|
|
43847
|
-
var expandingKeys = ts.sort(ts.filter(ts.getOwnKeys(lookupTable), function (k) { return k.indexOf("*") !== -1 || ts.endsWith(k, "/"); }),
|
|
43882
|
+
var expandingKeys = ts.sort(ts.filter(ts.getOwnKeys(lookupTable), function (k) { return k.indexOf("*") !== -1 || ts.endsWith(k, "/"); }), comparePatternKeys);
|
|
43848
43883
|
for (var _i = 0, expandingKeys_1 = expandingKeys; _i < expandingKeys_1.length; _i++) {
|
|
43849
43884
|
var potentialTarget = expandingKeys_1[_i];
|
|
43850
43885
|
if (state.features & NodeResolutionFeatures.ExportsPatternTrailers && matchesPatternWithTrailer(potentialTarget, moduleName)) {
|
|
@@ -44163,8 +44198,8 @@ var ts;
|
|
|
44163
44198
|
var pathAndExtension = loadModuleFromFile(extensions, candidate, onlyRecordFailures, state) ||
|
|
44164
44199
|
loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageInfo && packageInfo.packageJsonContent, packageInfo && packageInfo.versionPaths);
|
|
44165
44200
|
if (!pathAndExtension && packageInfo
|
|
44166
|
-
|
|
44167
|
-
&& packageInfo.packageJsonContent.
|
|
44201
|
+
// eslint-disable-next-line no-null/no-null
|
|
44202
|
+
&& (packageInfo.packageJsonContent.exports === undefined || packageInfo.packageJsonContent.exports === null)
|
|
44168
44203
|
&& state.features & NodeResolutionFeatures.EsmMode) {
|
|
44169
44204
|
// EsmMode disables index lookup in `loadNodeModuleFromDirectoryWorker` generally, however non-relative package resolutions still assume
|
|
44170
44205
|
// a default `index.js` entrypoint if no `main` or `exports` are present
|
|
@@ -47829,7 +47864,10 @@ var ts;
|
|
|
47829
47864
|
TypeFacts[TypeFacts["NEUndefinedOrNull"] = 2097152] = "NEUndefinedOrNull";
|
|
47830
47865
|
TypeFacts[TypeFacts["Truthy"] = 4194304] = "Truthy";
|
|
47831
47866
|
TypeFacts[TypeFacts["Falsy"] = 8388608] = "Falsy";
|
|
47832
|
-
TypeFacts[TypeFacts["
|
|
47867
|
+
TypeFacts[TypeFacts["IsUndefined"] = 16777216] = "IsUndefined";
|
|
47868
|
+
TypeFacts[TypeFacts["IsNull"] = 33554432] = "IsNull";
|
|
47869
|
+
TypeFacts[TypeFacts["IsUndefinedOrNull"] = 50331648] = "IsUndefinedOrNull";
|
|
47870
|
+
TypeFacts[TypeFacts["All"] = 134217727] = "All";
|
|
47833
47871
|
// The following members encode facts about particular kinds of types for use in the getTypeFacts function.
|
|
47834
47872
|
// The presence of a particular fact means that the given test is true for some (and possibly all) values
|
|
47835
47873
|
// of that kind of type.
|
|
@@ -47871,14 +47909,16 @@ var ts;
|
|
|
47871
47909
|
TypeFacts[TypeFacts["ObjectFacts"] = 16736160] = "ObjectFacts";
|
|
47872
47910
|
TypeFacts[TypeFacts["FunctionStrictFacts"] = 7880640] = "FunctionStrictFacts";
|
|
47873
47911
|
TypeFacts[TypeFacts["FunctionFacts"] = 16728000] = "FunctionFacts";
|
|
47874
|
-
TypeFacts[TypeFacts["
|
|
47875
|
-
TypeFacts[TypeFacts["
|
|
47876
|
-
TypeFacts[TypeFacts["
|
|
47912
|
+
TypeFacts[TypeFacts["VoidFacts"] = 9830144] = "VoidFacts";
|
|
47913
|
+
TypeFacts[TypeFacts["UndefinedFacts"] = 26607360] = "UndefinedFacts";
|
|
47914
|
+
TypeFacts[TypeFacts["NullFacts"] = 42917664] = "NullFacts";
|
|
47915
|
+
TypeFacts[TypeFacts["EmptyObjectStrictFacts"] = 83427327] = "EmptyObjectStrictFacts";
|
|
47916
|
+
TypeFacts[TypeFacts["EmptyObjectFacts"] = 83886079] = "EmptyObjectFacts";
|
|
47917
|
+
TypeFacts[TypeFacts["UnknownFacts"] = 83886079] = "UnknownFacts";
|
|
47877
47918
|
TypeFacts[TypeFacts["AllTypeofNE"] = 556800] = "AllTypeofNE";
|
|
47878
|
-
TypeFacts[TypeFacts["EmptyObjectFacts"] = 16777215] = "EmptyObjectFacts";
|
|
47879
47919
|
// Masks
|
|
47880
47920
|
TypeFacts[TypeFacts["OrFactsMask"] = 8256] = "OrFactsMask";
|
|
47881
|
-
TypeFacts[TypeFacts["AndFactsMask"] =
|
|
47921
|
+
TypeFacts[TypeFacts["AndFactsMask"] = 134209471] = "AndFactsMask";
|
|
47882
47922
|
})(TypeFacts || (TypeFacts = {}));
|
|
47883
47923
|
var typeofEQFacts = new ts.Map(ts.getEntries({
|
|
47884
47924
|
string: 1 /* TypeofEQString */,
|
|
@@ -50042,7 +50082,12 @@ var ts;
|
|
|
50042
50082
|
function checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning) {
|
|
50043
50083
|
if (meaning & (111551 /* Value */ & ~1024 /* NamespaceModule */)) {
|
|
50044
50084
|
if (isPrimitiveTypeName(name)) {
|
|
50045
|
-
|
|
50085
|
+
if (isExtendedByInterface(errorLocation)) {
|
|
50086
|
+
error(errorLocation, ts.Diagnostics.An_interface_cannot_extend_a_primitive_type_like_0_an_interface_can_only_extend_named_types_and_classes, ts.unescapeLeadingUnderscores(name));
|
|
50087
|
+
}
|
|
50088
|
+
else {
|
|
50089
|
+
error(errorLocation, ts.Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here, ts.unescapeLeadingUnderscores(name));
|
|
50090
|
+
}
|
|
50046
50091
|
return true;
|
|
50047
50092
|
}
|
|
50048
50093
|
var symbol = resolveSymbol(resolveName(errorLocation, name, 788968 /* Type */ & ~111551 /* Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false));
|
|
@@ -50062,6 +50107,16 @@ var ts;
|
|
|
50062
50107
|
}
|
|
50063
50108
|
return false;
|
|
50064
50109
|
}
|
|
50110
|
+
function isExtendedByInterface(node) {
|
|
50111
|
+
var grandparent = node.parent.parent;
|
|
50112
|
+
var parentOfGrandparent = grandparent.parent;
|
|
50113
|
+
if (grandparent && parentOfGrandparent) {
|
|
50114
|
+
var isExtending = ts.isHeritageClause(grandparent) && grandparent.token === 94 /* ExtendsKeyword */;
|
|
50115
|
+
var isInterface = ts.isInterfaceDeclaration(parentOfGrandparent);
|
|
50116
|
+
return isExtending && isInterface;
|
|
50117
|
+
}
|
|
50118
|
+
return false;
|
|
50119
|
+
}
|
|
50065
50120
|
function maybeMappedType(node, symbol) {
|
|
50066
50121
|
var container = ts.findAncestor(node.parent, function (n) {
|
|
50067
50122
|
return ts.isComputedPropertyName(n) || ts.isPropertySignature(n) ? false : ts.isTypeLiteralNode(n) || "quit";
|
|
@@ -52902,7 +52957,7 @@ var ts;
|
|
|
52902
52957
|
anyType : getNonMissingTypeOfSymbol(propertySymbol);
|
|
52903
52958
|
var saveEnclosingDeclaration = context.enclosingDeclaration;
|
|
52904
52959
|
context.enclosingDeclaration = undefined;
|
|
52905
|
-
if (context.tracker.trackSymbol &&
|
|
52960
|
+
if (context.tracker.trackSymbol && isLateBoundName(propertySymbol.escapedName)) {
|
|
52906
52961
|
if (propertySymbol.declarations) {
|
|
52907
52962
|
var decl = ts.first(propertySymbol.declarations);
|
|
52908
52963
|
if (hasLateBindableName(decl)) {
|
|
@@ -53403,6 +53458,7 @@ var ts;
|
|
|
53403
53458
|
return symbol.parent ? ts.factory.createQualifiedName(symbolToEntityNameNode(symbol.parent), identifier) : identifier;
|
|
53404
53459
|
}
|
|
53405
53460
|
function symbolToTypeNode(symbol, context, meaning, overrideTypeArguments) {
|
|
53461
|
+
var _a, _b, _c, _d;
|
|
53406
53462
|
var chain = lookupSymbolChain(symbol, context, meaning, !(context.flags & 16384 /* UseAliasDefinedOutsideCurrentScope */)); // If we're using aliases outside the current scope, dont bother with the module
|
|
53407
53463
|
var isTypeOf = meaning === 111551 /* Value */;
|
|
53408
53464
|
if (ts.some(chain[0].declarations, hasNonGlobalAugmentationExternalModuleSymbol)) {
|
|
@@ -53420,6 +53476,7 @@ var ts;
|
|
|
53420
53476
|
assertion = ts.factory.createImportTypeAssertionContainer(ts.factory.createAssertClause(ts.factory.createNodeArray([
|
|
53421
53477
|
ts.factory.createAssertEntry(ts.factory.createStringLiteral("resolution-mode"), ts.factory.createStringLiteral("import"))
|
|
53422
53478
|
])));
|
|
53479
|
+
(_b = (_a = context.tracker).reportImportTypeNodeResolutionModeOverride) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
53423
53480
|
}
|
|
53424
53481
|
}
|
|
53425
53482
|
if (!specifier) {
|
|
@@ -53439,6 +53496,7 @@ var ts;
|
|
|
53439
53496
|
assertion = ts.factory.createImportTypeAssertionContainer(ts.factory.createAssertClause(ts.factory.createNodeArray([
|
|
53440
53497
|
ts.factory.createAssertEntry(ts.factory.createStringLiteral("resolution-mode"), ts.factory.createStringLiteral(swappedMode === ts.ModuleKind.ESNext ? "import" : "require"))
|
|
53441
53498
|
])));
|
|
53499
|
+
(_d = (_c = context.tracker).reportImportTypeNodeResolutionModeOverride) === null || _d === void 0 ? void 0 : _d.call(_c);
|
|
53442
53500
|
}
|
|
53443
53501
|
}
|
|
53444
53502
|
if (!assertion) {
|
|
@@ -54586,7 +54644,7 @@ var ts;
|
|
|
54586
54644
|
? getBaseConstructorTypeOfClass(staticType)
|
|
54587
54645
|
: anyType;
|
|
54588
54646
|
var heritageClauses = __spreadArray(__spreadArray([], !ts.length(baseTypes) ? [] : [ts.factory.createHeritageClause(94 /* ExtendsKeyword */, ts.map(baseTypes, function (b) { return serializeBaseType(b, staticBaseType, localName); }))], true), !ts.length(implementsExpressions) ? [] : [ts.factory.createHeritageClause(117 /* ImplementsKeyword */, implementsExpressions)], true);
|
|
54589
|
-
var symbolProps =
|
|
54647
|
+
var symbolProps = getNonInheritedProperties(classType, baseTypes, getPropertiesOfType(classType));
|
|
54590
54648
|
var publicSymbolProps = ts.filter(symbolProps, function (s) {
|
|
54591
54649
|
// `valueDeclaration` could be undefined if inherited from
|
|
54592
54650
|
// a union/intersection base type, but inherited properties
|
|
@@ -55724,7 +55782,7 @@ var ts;
|
|
|
55724
55782
|
if (ts.getEffectiveTypeAnnotationNode(ts.walkUpBindingElementsAndPatterns(declaration))) {
|
|
55725
55783
|
// In strict null checking mode, if a default value of a non-undefined type is specified, remove
|
|
55726
55784
|
// undefined from the final type.
|
|
55727
|
-
return strictNullChecks && !(
|
|
55785
|
+
return strictNullChecks && !(getTypeFacts(checkDeclarationInitializer(declaration, 0 /* Normal */)) & 16777216 /* IsUndefined */) ? getNonUndefinedType(type) : type;
|
|
55728
55786
|
}
|
|
55729
55787
|
return widenTypeInferredFromInitializer(declaration, getUnionType([getNonUndefinedType(type), checkDeclarationInitializer(declaration, 0 /* Normal */)], 2 /* Subtype */));
|
|
55730
55788
|
}
|
|
@@ -58927,7 +58985,7 @@ var ts;
|
|
|
58927
58985
|
var objectType;
|
|
58928
58986
|
return !!(type.flags & 8388608 /* IndexedAccess */ && ts.getObjectFlags(objectType = type.objectType) & 32 /* Mapped */ &&
|
|
58929
58987
|
!isGenericMappedType(objectType) && isGenericIndexType(type.indexType) &&
|
|
58930
|
-
!objectType
|
|
58988
|
+
!(getMappedTypeModifiers(objectType) & 8 /* ExcludeOptional */) && !objectType.declaration.nameType);
|
|
58931
58989
|
}
|
|
58932
58990
|
/**
|
|
58933
58991
|
* For a type parameter, return the base constraint of the type parameter. For the string, number,
|
|
@@ -64219,7 +64277,7 @@ var ts;
|
|
|
64219
64277
|
var sourceSig = checkMode & 3 /* Callback */ ? undefined : getSingleCallSignature(getNonNullableType(sourceType));
|
|
64220
64278
|
var targetSig = checkMode & 3 /* Callback */ ? undefined : getSingleCallSignature(getNonNullableType(targetType));
|
|
64221
64279
|
var callbacks = sourceSig && targetSig && !getTypePredicateOfSignature(sourceSig) && !getTypePredicateOfSignature(targetSig) &&
|
|
64222
|
-
(
|
|
64280
|
+
(getTypeFacts(sourceType) & 50331648 /* IsUndefinedOrNull */) === (getTypeFacts(targetType) & 50331648 /* IsUndefinedOrNull */);
|
|
64223
64281
|
var related = callbacks ?
|
|
64224
64282
|
compareSignaturesRelated(targetSig, sourceSig, (checkMode & 8 /* StrictArity */) | (strictVariance ? 2 /* StrictCallback */ : 1 /* BivariantCallback */), reportErrors, errorReporter, incompatibleErrorReporter, compareTypes, reportUnreliableMarkers) :
|
|
64225
64283
|
!(checkMode & 3 /* Callback */) && !strictVariance && compareTypes(sourceType, targetType, /*reportErrors*/ false) || compareTypes(targetType, sourceType, reportErrors);
|
|
@@ -67437,30 +67495,8 @@ var ts;
|
|
|
67437
67495
|
var value = _a.value;
|
|
67438
67496
|
return value.base10Value === "0";
|
|
67439
67497
|
}
|
|
67440
|
-
function getFalsyFlagsOfTypes(types) {
|
|
67441
|
-
var result = 0;
|
|
67442
|
-
for (var _i = 0, types_14 = types; _i < types_14.length; _i++) {
|
|
67443
|
-
var t = types_14[_i];
|
|
67444
|
-
result |= getFalsyFlags(t);
|
|
67445
|
-
}
|
|
67446
|
-
return result;
|
|
67447
|
-
}
|
|
67448
|
-
// Returns the String, Number, Boolean, StringLiteral, NumberLiteral, BooleanLiteral, Void, Undefined, or Null
|
|
67449
|
-
// flags for the string, number, boolean, "", 0, false, void, undefined, or null types respectively. Returns
|
|
67450
|
-
// no flags for all other types (including non-falsy literal types).
|
|
67451
|
-
function getFalsyFlags(type) {
|
|
67452
|
-
var t = type.flags & 2097152 /* Intersection */ ? getBaseConstraintOrType(type) : type;
|
|
67453
|
-
return t.flags & 1048576 /* Union */ ? getFalsyFlagsOfTypes(t.types) :
|
|
67454
|
-
t.flags & 128 /* StringLiteral */ ? t.value === "" ? 128 /* StringLiteral */ : 0 :
|
|
67455
|
-
t.flags & 256 /* NumberLiteral */ ? t.value === 0 ? 256 /* NumberLiteral */ : 0 :
|
|
67456
|
-
t.flags & 2048 /* BigIntLiteral */ ? isZeroBigInt(t) ? 2048 /* BigIntLiteral */ : 0 :
|
|
67457
|
-
t.flags & 512 /* BooleanLiteral */ ? (t === falseType || t === regularFalseType) ? 512 /* BooleanLiteral */ : 0 :
|
|
67458
|
-
t.flags & 117724 /* PossiblyFalsy */;
|
|
67459
|
-
}
|
|
67460
67498
|
function removeDefinitelyFalsyTypes(type) {
|
|
67461
|
-
return
|
|
67462
|
-
filterType(type, function (t) { return !(getFalsyFlags(t) & 117632 /* DefinitelyFalsy */); }) :
|
|
67463
|
-
type;
|
|
67499
|
+
return filterType(type, function (t) { return !!(getTypeFacts(t) & 4194304 /* Truthy */); });
|
|
67464
67500
|
}
|
|
67465
67501
|
function extractDefinitelyFalsyTypes(type) {
|
|
67466
67502
|
return mapType(type, getDefinitelyFalsyPartOfType);
|
|
@@ -67503,14 +67539,7 @@ var ts;
|
|
|
67503
67539
|
getIntersectionType([type, emptyObjectType]);
|
|
67504
67540
|
}
|
|
67505
67541
|
function getNonNullableType(type) {
|
|
67506
|
-
|
|
67507
|
-
// First reduce away any constituents that are assignable to 'undefined' or 'null'. This not only eliminates
|
|
67508
|
-
// 'undefined' and 'null', but also higher-order types such as a type parameter 'U extends undefined | null'
|
|
67509
|
-
// that isn't eliminated by a NonNullable<T> instantiation.
|
|
67510
|
-
var reducedType = getTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
|
|
67511
|
-
return maybeTypeOfKind(reducedType, 465829888 /* Instantiable */) ? getGlobalNonNullableTypeInstantiation(reducedType) : reducedType;
|
|
67512
|
-
}
|
|
67513
|
-
return type;
|
|
67542
|
+
return strictNullChecks ? getAdjustedTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */) : type;
|
|
67514
67543
|
}
|
|
67515
67544
|
function addOptionalTypeMarker(type) {
|
|
67516
67545
|
return strictNullChecks ? getUnionType([type, optionalType]) : type;
|
|
@@ -68654,8 +68683,8 @@ var ts;
|
|
|
68654
68683
|
}
|
|
68655
68684
|
function getSingleTypeVariableFromIntersectionTypes(types) {
|
|
68656
68685
|
var typeVariable;
|
|
68657
|
-
for (var _i = 0,
|
|
68658
|
-
var type =
|
|
68686
|
+
for (var _i = 0, types_14 = types; _i < types_14.length; _i++) {
|
|
68687
|
+
var type = types_14[_i];
|
|
68659
68688
|
var t = type.flags & 2097152 /* Intersection */ && ts.find(type.types, function (t) { return !!getInferenceInfoForType(t); });
|
|
68660
68689
|
if (!t || typeVariable && t !== typeVariable) {
|
|
68661
68690
|
return undefined;
|
|
@@ -69408,8 +69437,8 @@ var ts;
|
|
|
69408
69437
|
}
|
|
69409
69438
|
}
|
|
69410
69439
|
};
|
|
69411
|
-
for (var _i = 0,
|
|
69412
|
-
var type =
|
|
69440
|
+
for (var _i = 0, types_15 = types; _i < types_15.length; _i++) {
|
|
69441
|
+
var type = types_15[_i];
|
|
69413
69442
|
var state_9 = _loop_24(type);
|
|
69414
69443
|
if (typeof state_9 === "object")
|
|
69415
69444
|
return state_9.value;
|
|
@@ -69524,14 +69553,16 @@ var ts;
|
|
|
69524
69553
|
return !!(resolved.callSignatures.length || resolved.constructSignatures.length ||
|
|
69525
69554
|
resolved.members.get("bind") && isTypeSubtypeOf(type, globalFunctionType));
|
|
69526
69555
|
}
|
|
69527
|
-
function getTypeFacts(type
|
|
69528
|
-
if (
|
|
69556
|
+
function getTypeFacts(type) {
|
|
69557
|
+
if (type.flags & (2097152 /* Intersection */ | 465829888 /* Instantiable */)) {
|
|
69558
|
+
type = getBaseConstraintOfType(type) || unknownType;
|
|
69559
|
+
}
|
|
69529
69560
|
var flags = type.flags;
|
|
69530
|
-
if (flags & 4 /* String */) {
|
|
69561
|
+
if (flags & (4 /* String */ | 268435456 /* StringMapping */)) {
|
|
69531
69562
|
return strictNullChecks ? 16317953 /* StringStrictFacts */ : 16776705 /* StringFacts */;
|
|
69532
69563
|
}
|
|
69533
|
-
if (flags & 128 /* StringLiteral */) {
|
|
69534
|
-
var isEmpty = type.value === "";
|
|
69564
|
+
if (flags & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */)) {
|
|
69565
|
+
var isEmpty = flags & 128 /* StringLiteral */ && type.value === "";
|
|
69535
69566
|
return strictNullChecks ?
|
|
69536
69567
|
isEmpty ? 12123649 /* EmptyStringStrictFacts */ : 7929345 /* NonEmptyStringStrictFacts */ :
|
|
69537
69568
|
isEmpty ? 12582401 /* EmptyStringFacts */ : 16776705 /* NonEmptyStringFacts */;
|
|
@@ -69563,20 +69594,20 @@ var ts;
|
|
|
69563
69594
|
(type === falseType || type === regularFalseType) ? 12580616 /* FalseFacts */ : 16774920 /* TrueFacts */;
|
|
69564
69595
|
}
|
|
69565
69596
|
if (flags & 524288 /* Object */) {
|
|
69566
|
-
if (ignoreObjects) {
|
|
69567
|
-
return 16768959 /* AndFactsMask */; // This is the identity element for computing type facts of intersection.
|
|
69568
|
-
}
|
|
69569
69597
|
return ts.getObjectFlags(type) & 16 /* Anonymous */ && isEmptyObjectType(type) ?
|
|
69570
|
-
strictNullChecks ?
|
|
69598
|
+
strictNullChecks ? 83427327 /* EmptyObjectStrictFacts */ : 83886079 /* EmptyObjectFacts */ :
|
|
69571
69599
|
isFunctionObjectType(type) ?
|
|
69572
69600
|
strictNullChecks ? 7880640 /* FunctionStrictFacts */ : 16728000 /* FunctionFacts */ :
|
|
69573
69601
|
strictNullChecks ? 7888800 /* ObjectStrictFacts */ : 16736160 /* ObjectFacts */;
|
|
69574
69602
|
}
|
|
69575
|
-
if (flags &
|
|
69576
|
-
return 9830144 /*
|
|
69603
|
+
if (flags & 16384 /* Void */) {
|
|
69604
|
+
return 9830144 /* VoidFacts */;
|
|
69605
|
+
}
|
|
69606
|
+
if (flags & 32768 /* Undefined */) {
|
|
69607
|
+
return 26607360 /* UndefinedFacts */;
|
|
69577
69608
|
}
|
|
69578
69609
|
if (flags & 65536 /* Null */) {
|
|
69579
|
-
return
|
|
69610
|
+
return 42917664 /* NullFacts */;
|
|
69580
69611
|
}
|
|
69581
69612
|
if (flags & 12288 /* ESSymbolLike */) {
|
|
69582
69613
|
return strictNullChecks ? 7925520 /* SymbolStrictFacts */ : 16772880 /* SymbolFacts */;
|
|
@@ -69587,38 +69618,39 @@ var ts;
|
|
|
69587
69618
|
if (flags & 131072 /* Never */) {
|
|
69588
69619
|
return 0 /* None */;
|
|
69589
69620
|
}
|
|
69590
|
-
if (flags & 465829888 /* Instantiable */) {
|
|
69591
|
-
return !isPatternLiteralType(type) ? getTypeFacts(getBaseConstraintOfType(type) || unknownType, ignoreObjects) :
|
|
69592
|
-
strictNullChecks ? 7929345 /* NonEmptyStringStrictFacts */ : 16776705 /* NonEmptyStringFacts */;
|
|
69593
|
-
}
|
|
69594
69621
|
if (flags & 1048576 /* Union */) {
|
|
69595
|
-
return ts.reduceLeft(type.types, function (facts, t) { return facts | getTypeFacts(t
|
|
69622
|
+
return ts.reduceLeft(type.types, function (facts, t) { return facts | getTypeFacts(t); }, 0 /* None */);
|
|
69596
69623
|
}
|
|
69597
69624
|
if (flags & 2097152 /* Intersection */) {
|
|
69598
|
-
|
|
69599
|
-
// presumably type tags. For example, in string & { __kind__: "name" } we ignore the object type.
|
|
69600
|
-
ignoreObjects || (ignoreObjects = maybeTypeOfKind(type, 131068 /* Primitive */));
|
|
69601
|
-
return getIntersectionTypeFacts(type, ignoreObjects);
|
|
69625
|
+
return getIntersectionTypeFacts(type);
|
|
69602
69626
|
}
|
|
69603
|
-
return
|
|
69627
|
+
return 83886079 /* UnknownFacts */;
|
|
69604
69628
|
}
|
|
69605
|
-
function getIntersectionTypeFacts(type
|
|
69629
|
+
function getIntersectionTypeFacts(type) {
|
|
69630
|
+
// When an intersection contains a primitive type we ignore object type constituents as they are
|
|
69631
|
+
// presumably type tags. For example, in string & { __kind__: "name" } we ignore the object type.
|
|
69632
|
+
var ignoreObjects = maybeTypeOfKind(type, 131068 /* Primitive */);
|
|
69606
69633
|
// When computing the type facts of an intersection type, certain type facts are computed as `and`
|
|
69607
69634
|
// and others are computed as `or`.
|
|
69608
69635
|
var oredFacts = 0 /* None */;
|
|
69609
|
-
var andedFacts =
|
|
69636
|
+
var andedFacts = 134217727 /* All */;
|
|
69610
69637
|
for (var _i = 0, _a = type.types; _i < _a.length; _i++) {
|
|
69611
69638
|
var t = _a[_i];
|
|
69612
|
-
|
|
69613
|
-
|
|
69614
|
-
|
|
69639
|
+
if (!(ignoreObjects && t.flags & 524288 /* Object */)) {
|
|
69640
|
+
var f = getTypeFacts(t);
|
|
69641
|
+
oredFacts |= f;
|
|
69642
|
+
andedFacts &= f;
|
|
69643
|
+
}
|
|
69615
69644
|
}
|
|
69616
|
-
return oredFacts & 8256 /* OrFactsMask */ | andedFacts &
|
|
69645
|
+
return oredFacts & 8256 /* OrFactsMask */ | andedFacts & 134209471 /* AndFactsMask */;
|
|
69617
69646
|
}
|
|
69618
69647
|
function getTypeWithFacts(type, include) {
|
|
69619
69648
|
return filterType(type, function (t) { return (getTypeFacts(t) & include) !== 0; });
|
|
69620
69649
|
}
|
|
69621
|
-
function
|
|
69650
|
+
// This function is similar to getTypeWithFacts, except that in strictNullChecks mode it replaces type
|
|
69651
|
+
// unknown with the union {} | null | undefined (and reduces that accordingly), and it intersects remaining
|
|
69652
|
+
// instantiable types with {}, {} | null, or {} | undefined in order to remove null and/or undefined.
|
|
69653
|
+
function getAdjustedTypeWithFacts(type, facts) {
|
|
69622
69654
|
var reduced = recombineUnknownType(getTypeWithFacts(strictNullChecks && type.flags & 2 /* Unknown */ ? unknownUnionType : type, facts));
|
|
69623
69655
|
if (strictNullChecks) {
|
|
69624
69656
|
switch (facts) {
|
|
@@ -69884,8 +69916,8 @@ var ts;
|
|
|
69884
69916
|
var types = origin && origin.flags & 1048576 /* Union */ ? origin.types : type.types;
|
|
69885
69917
|
var mappedTypes;
|
|
69886
69918
|
var changed = false;
|
|
69887
|
-
for (var _i = 0,
|
|
69888
|
-
var t =
|
|
69919
|
+
for (var _i = 0, types_16 = types; _i < types_16.length; _i++) {
|
|
69920
|
+
var t = types_16[_i];
|
|
69889
69921
|
var mapped = t.flags & 1048576 /* Union */ ? mapType(t, mapper, noReductions) : mapper(t);
|
|
69890
69922
|
changed || (changed = t !== mapped);
|
|
69891
69923
|
if (mapped) {
|
|
@@ -69971,8 +70003,8 @@ var ts;
|
|
|
69971
70003
|
}
|
|
69972
70004
|
function isEvolvingArrayTypeList(types) {
|
|
69973
70005
|
var hasEvolvingArrayType = false;
|
|
69974
|
-
for (var _i = 0,
|
|
69975
|
-
var t =
|
|
70006
|
+
for (var _i = 0, types_17 = types; _i < types_17.length; _i++) {
|
|
70007
|
+
var t = types_17[_i];
|
|
69976
70008
|
if (!(t.flags & 131072 /* Never */)) {
|
|
69977
70009
|
if (!(ts.getObjectFlags(t) & 256 /* EvolvingArray */)) {
|
|
69978
70010
|
return false;
|
|
@@ -70795,10 +70827,10 @@ var ts;
|
|
|
70795
70827
|
}
|
|
70796
70828
|
function narrowTypeByTruthiness(type, expr, assumeTrue) {
|
|
70797
70829
|
if (isMatchingReference(reference, expr)) {
|
|
70798
|
-
return
|
|
70830
|
+
return getAdjustedTypeWithFacts(type, assumeTrue ? 4194304 /* Truthy */ : 8388608 /* Falsy */);
|
|
70799
70831
|
}
|
|
70800
70832
|
if (strictNullChecks && assumeTrue && optionalChainContainsReference(expr, reference)) {
|
|
70801
|
-
type =
|
|
70833
|
+
type = getAdjustedTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
|
|
70802
70834
|
}
|
|
70803
70835
|
var access = getDiscriminantPropertyAccess(expr, type);
|
|
70804
70836
|
if (access) {
|
|
@@ -70938,7 +70970,7 @@ var ts;
|
|
|
70938
70970
|
// Note that we include any and unknown in the exclusion test because their domain includes null and undefined.
|
|
70939
70971
|
var removeNullable = equalsOperator !== assumeTrue && everyType(valueType, function (t) { return !!(t.flags & nullableFlags); }) ||
|
|
70940
70972
|
equalsOperator === assumeTrue && everyType(valueType, function (t) { return !(t.flags & (3 /* AnyOrUnknown */ | nullableFlags)); });
|
|
70941
|
-
return removeNullable ?
|
|
70973
|
+
return removeNullable ? getAdjustedTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */) : type;
|
|
70942
70974
|
}
|
|
70943
70975
|
function narrowTypeByEquality(type, operator, value, assumeTrue) {
|
|
70944
70976
|
if (type.flags & 1 /* Any */) {
|
|
@@ -70967,7 +70999,7 @@ var ts;
|
|
|
70967
70999
|
valueType.flags & 65536 /* Null */ ?
|
|
70968
71000
|
assumeTrue ? 131072 /* EQNull */ : 1048576 /* NENull */ :
|
|
70969
71001
|
assumeTrue ? 65536 /* EQUndefined */ : 524288 /* NEUndefined */;
|
|
70970
|
-
return
|
|
71002
|
+
return getAdjustedTypeWithFacts(type, facts);
|
|
70971
71003
|
}
|
|
70972
71004
|
if (assumeTrue) {
|
|
70973
71005
|
var filterFn = operator === 34 /* EqualsEqualsToken */ ?
|
|
@@ -70988,7 +71020,7 @@ var ts;
|
|
|
70988
71020
|
var target = getReferenceCandidate(typeOfExpr.expression);
|
|
70989
71021
|
if (!isMatchingReference(reference, target)) {
|
|
70990
71022
|
if (strictNullChecks && optionalChainContainsReference(target, reference) && assumeTrue === (literal.text !== "undefined")) {
|
|
70991
|
-
return
|
|
71023
|
+
return getAdjustedTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
|
|
70992
71024
|
}
|
|
70993
71025
|
return type;
|
|
70994
71026
|
}
|
|
@@ -71192,7 +71224,7 @@ var ts;
|
|
|
71192
71224
|
var left = getReferenceCandidate(expr.left);
|
|
71193
71225
|
if (!isMatchingReference(reference, left)) {
|
|
71194
71226
|
if (assumeTrue && strictNullChecks && optionalChainContainsReference(left, reference)) {
|
|
71195
|
-
return
|
|
71227
|
+
return getAdjustedTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
|
|
71196
71228
|
}
|
|
71197
71229
|
return type;
|
|
71198
71230
|
}
|
|
@@ -71280,7 +71312,7 @@ var ts;
|
|
|
71280
71312
|
}
|
|
71281
71313
|
if (strictNullChecks && assumeTrue && optionalChainContainsReference(predicateArgument, reference) &&
|
|
71282
71314
|
!(getTypeFacts(predicate.type) & 65536 /* EQUndefined */)) {
|
|
71283
|
-
type =
|
|
71315
|
+
type = getAdjustedTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
|
|
71284
71316
|
}
|
|
71285
71317
|
var access = getDiscriminantPropertyAccess(predicateArgument, type);
|
|
71286
71318
|
if (access) {
|
|
@@ -71337,7 +71369,7 @@ var ts;
|
|
|
71337
71369
|
}
|
|
71338
71370
|
function narrowTypeByOptionality(type, expr, assumePresent) {
|
|
71339
71371
|
if (isMatchingReference(reference, expr)) {
|
|
71340
|
-
return
|
|
71372
|
+
return getAdjustedTypeWithFacts(type, assumePresent ? 2097152 /* NEUndefinedOrNull */ : 262144 /* EQUndefinedOrNull */);
|
|
71341
71373
|
}
|
|
71342
71374
|
var access = getDiscriminantPropertyAccess(expr, type);
|
|
71343
71375
|
if (access) {
|
|
@@ -71423,8 +71455,8 @@ var ts;
|
|
|
71423
71455
|
var annotationIncludesUndefined = strictNullChecks &&
|
|
71424
71456
|
declaration.kind === 164 /* Parameter */ &&
|
|
71425
71457
|
declaration.initializer &&
|
|
71426
|
-
|
|
71427
|
-
!(
|
|
71458
|
+
getTypeFacts(declaredType) & 16777216 /* IsUndefined */ &&
|
|
71459
|
+
!(getTypeFacts(checkExpression(declaration.initializer)) & 16777216 /* IsUndefined */);
|
|
71428
71460
|
popTypeResolution();
|
|
71429
71461
|
return annotationIncludesUndefined ? getTypeWithFacts(declaredType, 524288 /* NEUndefined */) : declaredType;
|
|
71430
71462
|
}
|
|
@@ -71752,7 +71784,7 @@ var ts;
|
|
|
71752
71784
|
return convertAutoToAny(flowType);
|
|
71753
71785
|
}
|
|
71754
71786
|
}
|
|
71755
|
-
else if (!assumeInitialized && !(
|
|
71787
|
+
else if (!assumeInitialized && !(getTypeFacts(type) & 16777216 /* IsUndefined */) && getTypeFacts(flowType) & 16777216 /* IsUndefined */) {
|
|
71756
71788
|
error(node, ts.Diagnostics.Variable_0_is_used_before_being_assigned, symbolToString(symbol));
|
|
71757
71789
|
// Return the declared type to reduce follow-on errors
|
|
71758
71790
|
return type;
|
|
@@ -73281,8 +73313,8 @@ var ts;
|
|
|
73281
73313
|
}
|
|
73282
73314
|
var signatureList;
|
|
73283
73315
|
var types = type.types;
|
|
73284
|
-
for (var _i = 0,
|
|
73285
|
-
var current =
|
|
73316
|
+
for (var _i = 0, types_18 = types; _i < types_18.length; _i++) {
|
|
73317
|
+
var current = types_18[_i];
|
|
73286
73318
|
var signature = getContextualCallSignature(current, node);
|
|
73287
73319
|
if (signature) {
|
|
73288
73320
|
if (!signatureList) {
|
|
@@ -74444,19 +74476,19 @@ var ts;
|
|
|
74444
74476
|
return checkNonNullType(checkExpression(node), node);
|
|
74445
74477
|
}
|
|
74446
74478
|
function isNullableType(type) {
|
|
74447
|
-
return !!((
|
|
74479
|
+
return !!(getTypeFacts(type) & 50331648 /* IsUndefinedOrNull */);
|
|
74448
74480
|
}
|
|
74449
74481
|
function getNonNullableTypeIfNeeded(type) {
|
|
74450
74482
|
return isNullableType(type) ? getNonNullableType(type) : type;
|
|
74451
74483
|
}
|
|
74452
|
-
function reportObjectPossiblyNullOrUndefinedError(node,
|
|
74453
|
-
error(node,
|
|
74484
|
+
function reportObjectPossiblyNullOrUndefinedError(node, facts) {
|
|
74485
|
+
error(node, facts & 16777216 /* IsUndefined */ ? facts & 33554432 /* IsNull */ ?
|
|
74454
74486
|
ts.Diagnostics.Object_is_possibly_null_or_undefined :
|
|
74455
74487
|
ts.Diagnostics.Object_is_possibly_undefined :
|
|
74456
74488
|
ts.Diagnostics.Object_is_possibly_null);
|
|
74457
74489
|
}
|
|
74458
|
-
function reportCannotInvokePossiblyNullOrUndefinedError(node,
|
|
74459
|
-
error(node,
|
|
74490
|
+
function reportCannotInvokePossiblyNullOrUndefinedError(node, facts) {
|
|
74491
|
+
error(node, facts & 16777216 /* IsUndefined */ ? facts & 33554432 /* IsNull */ ?
|
|
74460
74492
|
ts.Diagnostics.Cannot_invoke_an_object_which_is_possibly_null_or_undefined :
|
|
74461
74493
|
ts.Diagnostics.Cannot_invoke_an_object_which_is_possibly_undefined :
|
|
74462
74494
|
ts.Diagnostics.Cannot_invoke_an_object_which_is_possibly_null);
|
|
@@ -74466,9 +74498,9 @@ var ts;
|
|
|
74466
74498
|
error(node, ts.Diagnostics.Object_is_of_type_unknown);
|
|
74467
74499
|
return errorType;
|
|
74468
74500
|
}
|
|
74469
|
-
var
|
|
74470
|
-
if (
|
|
74471
|
-
reportError(node,
|
|
74501
|
+
var facts = getTypeFacts(type);
|
|
74502
|
+
if (facts & 50331648 /* IsUndefinedOrNull */) {
|
|
74503
|
+
reportError(node, facts);
|
|
74472
74504
|
var t = getNonNullableType(type);
|
|
74473
74505
|
return t.flags & (98304 /* Nullable */ | 131072 /* Never */) ? errorType : t;
|
|
74474
74506
|
}
|
|
@@ -74763,7 +74795,7 @@ var ts;
|
|
|
74763
74795
|
assumeUninitialized = true;
|
|
74764
74796
|
}
|
|
74765
74797
|
var flowType = getFlowTypeOfReference(node, propType, assumeUninitialized ? getOptionalType(propType) : propType);
|
|
74766
|
-
if (assumeUninitialized && !(
|
|
74798
|
+
if (assumeUninitialized && !(getTypeFacts(propType) & 16777216 /* IsUndefined */) && getTypeFacts(flowType) & 16777216 /* IsUndefined */) {
|
|
74767
74799
|
error(errorNode, ts.Diagnostics.Property_0_is_used_before_being_assigned, symbolToString(prop)); // TODO: GH#18217
|
|
74768
74800
|
// Return the declared type to reduce follow-on errors
|
|
74769
74801
|
return propType;
|
|
@@ -76679,8 +76711,8 @@ var ts;
|
|
|
76679
76711
|
if (apparentType.flags & 1048576 /* Union */) {
|
|
76680
76712
|
var types = apparentType.types;
|
|
76681
76713
|
var hasSignatures = false;
|
|
76682
|
-
for (var _i = 0,
|
|
76683
|
-
var constituent =
|
|
76714
|
+
for (var _i = 0, types_19 = types; _i < types_19.length; _i++) {
|
|
76715
|
+
var constituent = types_19[_i];
|
|
76684
76716
|
var signatures = getSignaturesOfType(constituent, kind);
|
|
76685
76717
|
if (signatures.length !== 0) {
|
|
76686
76718
|
hasSignatures = true;
|
|
@@ -78371,7 +78403,7 @@ var ts;
|
|
|
78371
78403
|
var type = getTypeOfSymbol(symbol);
|
|
78372
78404
|
if (strictNullChecks &&
|
|
78373
78405
|
!(type.flags & (3 /* AnyOrUnknown */ | 131072 /* Never */)) &&
|
|
78374
|
-
!(exactOptionalPropertyTypes ? symbol.flags & 16777216 /* Optional */ :
|
|
78406
|
+
!(exactOptionalPropertyTypes ? symbol.flags & 16777216 /* Optional */ : getTypeFacts(type) & 16777216 /* IsUndefined */)) {
|
|
78375
78407
|
error(expr, ts.Diagnostics.The_operand_of_a_delete_operator_must_be_optional);
|
|
78376
78408
|
}
|
|
78377
78409
|
}
|
|
@@ -78539,8 +78571,8 @@ var ts;
|
|
|
78539
78571
|
}
|
|
78540
78572
|
if (type.flags & 3145728 /* UnionOrIntersection */) {
|
|
78541
78573
|
var types = type.types;
|
|
78542
|
-
for (var _i = 0,
|
|
78543
|
-
var t =
|
|
78574
|
+
for (var _i = 0, types_20 = types; _i < types_20.length; _i++) {
|
|
78575
|
+
var t = types_20[_i];
|
|
78544
78576
|
if (maybeTypeOfKind(t, kind)) {
|
|
78545
78577
|
return true;
|
|
78546
78578
|
}
|
|
@@ -78767,7 +78799,7 @@ var ts;
|
|
|
78767
78799
|
// In strict null checking mode, if a default value of a non-undefined type is specified, remove
|
|
78768
78800
|
// undefined from the final type.
|
|
78769
78801
|
if (strictNullChecks &&
|
|
78770
|
-
!(
|
|
78802
|
+
!(getTypeFacts(checkExpression(prop.objectAssignmentInitializer)) & 16777216 /* IsUndefined */)) {
|
|
78771
78803
|
sourceType = getTypeWithFacts(sourceType, 524288 /* NEUndefined */);
|
|
78772
78804
|
}
|
|
78773
78805
|
checkBinaryLikeExpression(prop.name, prop.equalsToken, prop.objectAssignmentInitializer, checkMode);
|
|
@@ -78780,6 +78812,10 @@ var ts;
|
|
|
78780
78812
|
if (target.kind === 221 /* BinaryExpression */ && target.operatorToken.kind === 63 /* EqualsToken */) {
|
|
78781
78813
|
checkBinaryExpression(target, checkMode);
|
|
78782
78814
|
target = target.left;
|
|
78815
|
+
// A default value is specified, so remove undefined from the final type.
|
|
78816
|
+
if (strictNullChecks) {
|
|
78817
|
+
sourceType = getTypeWithFacts(sourceType, 524288 /* NEUndefined */);
|
|
78818
|
+
}
|
|
78783
78819
|
}
|
|
78784
78820
|
if (target.kind === 205 /* ObjectLiteralExpression */) {
|
|
78785
78821
|
return checkObjectLiteralAssignment(target, sourceType, rightIsThis);
|
|
@@ -79167,7 +79203,7 @@ var ts;
|
|
|
79167
79203
|
case 56 /* BarBarToken */:
|
|
79168
79204
|
case 75 /* BarBarEqualsToken */: {
|
|
79169
79205
|
var resultType_3 = getTypeFacts(leftType) & 8388608 /* Falsy */ ?
|
|
79170
|
-
getUnionType([removeDefinitelyFalsyTypes(leftType), rightType], 2 /* Subtype */) :
|
|
79206
|
+
getUnionType([getNonNullableType(removeDefinitelyFalsyTypes(leftType)), rightType], 2 /* Subtype */) :
|
|
79171
79207
|
leftType;
|
|
79172
79208
|
if (operator === 75 /* BarBarEqualsToken */) {
|
|
79173
79209
|
checkAssignmentOperator(rightType);
|
|
@@ -80870,8 +80906,11 @@ var ts;
|
|
|
80870
80906
|
if (node.assertions) {
|
|
80871
80907
|
var override = ts.getResolutionModeOverrideForClause(node.assertions.assertClause, grammarErrorOnNode);
|
|
80872
80908
|
if (override) {
|
|
80909
|
+
if (!ts.isNightly()) {
|
|
80910
|
+
grammarErrorOnNode(node.assertions.assertClause, ts.Diagnostics.resolution_mode_assertions_are_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next);
|
|
80911
|
+
}
|
|
80873
80912
|
if (ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.Node16 && ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.NodeNext) {
|
|
80874
|
-
grammarErrorOnNode(node.assertions.assertClause, ts.Diagnostics.
|
|
80913
|
+
grammarErrorOnNode(node.assertions.assertClause, ts.Diagnostics.resolution_mode_assertions_are_only_supported_when_moduleResolution_is_node16_or_nodenext);
|
|
80875
80914
|
}
|
|
80876
80915
|
}
|
|
80877
80916
|
}
|
|
@@ -81708,8 +81747,8 @@ var ts;
|
|
|
81708
81747
|
}
|
|
81709
81748
|
function getEntityNameForDecoratorMetadataFromTypeList(types) {
|
|
81710
81749
|
var commonEntityName;
|
|
81711
|
-
for (var _i = 0,
|
|
81712
|
-
var typeNode =
|
|
81750
|
+
for (var _i = 0, types_21 = types; _i < types_21.length; _i++) {
|
|
81751
|
+
var typeNode = types_21[_i];
|
|
81713
81752
|
while (typeNode.kind === 191 /* ParenthesizedType */ || typeNode.kind === 197 /* NamedTupleMember */) {
|
|
81714
81753
|
typeNode = typeNode.type; // Skip parens if need be
|
|
81715
81754
|
}
|
|
@@ -82575,7 +82614,7 @@ var ts;
|
|
|
82575
82614
|
// For a binding pattern, validate the initializer and exit
|
|
82576
82615
|
if (ts.isBindingPattern(node.name)) {
|
|
82577
82616
|
var needCheckInitializer = node.initializer && node.parent.parent.kind !== 243 /* ForInStatement */;
|
|
82578
|
-
var needCheckWidenedType = node.name.elements.
|
|
82617
|
+
var needCheckWidenedType = !ts.some(node.name.elements, ts.not(ts.isOmittedExpression));
|
|
82579
82618
|
if (needCheckInitializer || needCheckWidenedType) {
|
|
82580
82619
|
// Don't validate for-in initializer as it is already an error
|
|
82581
82620
|
var widenedType = getWidenedTypeForVariableLikeDeclaration(node);
|
|
@@ -82728,7 +82767,7 @@ var ts;
|
|
|
82728
82767
|
return;
|
|
82729
82768
|
var type = checkTruthinessExpression(location);
|
|
82730
82769
|
var isPropertyExpressionCast = ts.isPropertyAccessExpression(location) && isTypeAssertion(location.expression);
|
|
82731
|
-
if (
|
|
82770
|
+
if (!(getTypeFacts(type) & 4194304 /* Truthy */) || isPropertyExpressionCast)
|
|
82732
82771
|
return;
|
|
82733
82772
|
// While it technically should be invalid for any known-truthy value
|
|
82734
82773
|
// to be tested, we de-scope to functions and Promises unreferenced in
|
|
@@ -84414,18 +84453,17 @@ var ts;
|
|
|
84414
84453
|
// but not by other kinds of members.
|
|
84415
84454
|
// Base class instance member variables and accessors can be overridden by
|
|
84416
84455
|
// derived class instance member variables and accessors, but not by other kinds of members.
|
|
84417
|
-
var _a, _b;
|
|
84456
|
+
var _a, _b, _c, _d;
|
|
84418
84457
|
// NOTE: assignability is checked in checkClassDeclaration
|
|
84419
84458
|
var baseProperties = getPropertiesOfType(baseType);
|
|
84420
|
-
|
|
84421
|
-
var baseProperty = baseProperties_1[_i];
|
|
84459
|
+
var _loop_33 = function (baseProperty) {
|
|
84422
84460
|
var base = getTargetSymbol(baseProperty);
|
|
84423
84461
|
if (base.flags & 4194304 /* Prototype */) {
|
|
84424
|
-
continue;
|
|
84462
|
+
return "continue";
|
|
84425
84463
|
}
|
|
84426
84464
|
var baseSymbol = getPropertyOfObjectType(type, base.escapedName);
|
|
84427
84465
|
if (!baseSymbol) {
|
|
84428
|
-
continue;
|
|
84466
|
+
return "continue";
|
|
84429
84467
|
}
|
|
84430
84468
|
var derived = getTargetSymbol(baseSymbol);
|
|
84431
84469
|
var baseDeclarationFlags = ts.getDeclarationModifierFlagsFromSymbol(base);
|
|
@@ -84443,14 +84481,14 @@ var ts;
|
|
|
84443
84481
|
// Searches other base types for a declaration that would satisfy the inherited abstract member.
|
|
84444
84482
|
// (The class may have more than one base type via declaration merging with an interface with the
|
|
84445
84483
|
// same name.)
|
|
84446
|
-
for (var
|
|
84447
|
-
var otherBaseType =
|
|
84484
|
+
for (var _e = 0, _f = getBaseTypes(type); _e < _f.length; _e++) {
|
|
84485
|
+
var otherBaseType = _f[_e];
|
|
84448
84486
|
if (otherBaseType === baseType)
|
|
84449
84487
|
continue;
|
|
84450
84488
|
var baseSymbol_1 = getPropertyOfObjectType(otherBaseType, base.escapedName);
|
|
84451
84489
|
var derivedElsewhere = baseSymbol_1 && getTargetSymbol(baseSymbol_1);
|
|
84452
84490
|
if (derivedElsewhere && derivedElsewhere !== base) {
|
|
84453
|
-
continue
|
|
84491
|
+
return "continue-basePropertyCheck";
|
|
84454
84492
|
}
|
|
84455
84493
|
}
|
|
84456
84494
|
if (derivedClassDecl.kind === 226 /* ClassExpression */) {
|
|
@@ -84465,20 +84503,19 @@ var ts;
|
|
|
84465
84503
|
// derived overrides base.
|
|
84466
84504
|
var derivedDeclarationFlags = ts.getDeclarationModifierFlagsFromSymbol(derived);
|
|
84467
84505
|
if (baseDeclarationFlags & 8 /* Private */ || derivedDeclarationFlags & 8 /* Private */) {
|
|
84468
|
-
|
|
84469
|
-
continue;
|
|
84506
|
+
return "continue";
|
|
84470
84507
|
}
|
|
84471
84508
|
var errorMessage = void 0;
|
|
84472
84509
|
var basePropertyFlags = base.flags & 98308 /* PropertyOrAccessor */;
|
|
84473
84510
|
var derivedPropertyFlags = derived.flags & 98308 /* PropertyOrAccessor */;
|
|
84474
84511
|
if (basePropertyFlags && derivedPropertyFlags) {
|
|
84475
84512
|
// property/accessor is overridden with property/accessor
|
|
84476
|
-
if (
|
|
84477
|
-
|
|
84513
|
+
if ((ts.getCheckFlags(base) & 6 /* Synthetic */
|
|
84514
|
+
? (_a = base.declarations) === null || _a === void 0 ? void 0 : _a.some(function (d) { return isPropertyAbstractOrInterface(d, baseDeclarationFlags); })
|
|
84515
|
+
: (_b = base.declarations) === null || _b === void 0 ? void 0 : _b.every(function (d) { return isPropertyAbstractOrInterface(d, baseDeclarationFlags); }))
|
|
84516
|
+
|| ts.getCheckFlags(base) & 262144 /* Mapped */
|
|
84478
84517
|
|| derived.valueDeclaration && ts.isBinaryExpression(derived.valueDeclaration)) {
|
|
84479
|
-
|
|
84480
|
-
// same when the derived property is from an assignment
|
|
84481
|
-
continue;
|
|
84518
|
+
return "continue";
|
|
84482
84519
|
}
|
|
84483
84520
|
var overriddenInstanceProperty = basePropertyFlags !== 4 /* Property */ && derivedPropertyFlags === 4 /* Property */;
|
|
84484
84521
|
var overriddenInstanceAccessor = basePropertyFlags === 4 /* Property */ && derivedPropertyFlags !== 4 /* Property */;
|
|
@@ -84489,12 +84526,12 @@ var ts;
|
|
|
84489
84526
|
error(ts.getNameOfDeclaration(derived.valueDeclaration) || derived.valueDeclaration, errorMessage_1, symbolToString(base), typeToString(baseType), typeToString(type));
|
|
84490
84527
|
}
|
|
84491
84528
|
else if (useDefineForClassFields) {
|
|
84492
|
-
var uninitialized = (
|
|
84529
|
+
var uninitialized = (_c = derived.declarations) === null || _c === void 0 ? void 0 : _c.find(function (d) { return d.kind === 167 /* PropertyDeclaration */ && !d.initializer; });
|
|
84493
84530
|
if (uninitialized
|
|
84494
84531
|
&& !(derived.flags & 33554432 /* Transient */)
|
|
84495
84532
|
&& !(baseDeclarationFlags & 128 /* Abstract */)
|
|
84496
84533
|
&& !(derivedDeclarationFlags & 128 /* Abstract */)
|
|
84497
|
-
&& !((
|
|
84534
|
+
&& !((_d = derived.declarations) === null || _d === void 0 ? void 0 : _d.some(function (d) { return !!(d.flags & 16777216 /* Ambient */); }))) {
|
|
84498
84535
|
var constructor = findConstructorDeclaration(ts.getClassLikeDeclarationOfSymbol(type.symbol));
|
|
84499
84536
|
var propName = uninitialized.name;
|
|
84500
84537
|
if (uninitialized.exclamationToken
|
|
@@ -84507,13 +84544,11 @@ var ts;
|
|
|
84507
84544
|
}
|
|
84508
84545
|
}
|
|
84509
84546
|
}
|
|
84510
|
-
|
|
84511
|
-
continue;
|
|
84547
|
+
return "continue";
|
|
84512
84548
|
}
|
|
84513
84549
|
else if (isPrototypeProperty(base)) {
|
|
84514
84550
|
if (isPrototypeProperty(derived) || derived.flags & 4 /* Property */) {
|
|
84515
|
-
|
|
84516
|
-
continue;
|
|
84551
|
+
return "continue";
|
|
84517
84552
|
}
|
|
84518
84553
|
else {
|
|
84519
84554
|
ts.Debug.assert(!!(derived.flags & 98304 /* Accessor */));
|
|
@@ -84528,9 +84563,20 @@ var ts;
|
|
|
84528
84563
|
}
|
|
84529
84564
|
error(ts.getNameOfDeclaration(derived.valueDeclaration) || derived.valueDeclaration, errorMessage, typeToString(baseType), symbolToString(base), typeToString(type));
|
|
84530
84565
|
}
|
|
84566
|
+
};
|
|
84567
|
+
basePropertyCheck: for (var _i = 0, baseProperties_1 = baseProperties; _i < baseProperties_1.length; _i++) {
|
|
84568
|
+
var baseProperty = baseProperties_1[_i];
|
|
84569
|
+
var state_10 = _loop_33(baseProperty);
|
|
84570
|
+
switch (state_10) {
|
|
84571
|
+
case "continue-basePropertyCheck": continue basePropertyCheck;
|
|
84572
|
+
}
|
|
84531
84573
|
}
|
|
84532
84574
|
}
|
|
84533
|
-
function
|
|
84575
|
+
function isPropertyAbstractOrInterface(declaration, baseDeclarationFlags) {
|
|
84576
|
+
return baseDeclarationFlags & 128 /* Abstract */ && (!ts.isPropertyDeclaration(declaration) || !declaration.initializer)
|
|
84577
|
+
|| ts.isInterfaceDeclaration(declaration.parent);
|
|
84578
|
+
}
|
|
84579
|
+
function getNonInheritedProperties(type, baseTypes, properties) {
|
|
84534
84580
|
if (!ts.length(baseTypes)) {
|
|
84535
84581
|
return properties;
|
|
84536
84582
|
}
|
|
@@ -84599,7 +84645,7 @@ var ts;
|
|
|
84599
84645
|
var propName = member.name;
|
|
84600
84646
|
if (ts.isIdentifier(propName) || ts.isPrivateIdentifier(propName) || ts.isComputedPropertyName(propName)) {
|
|
84601
84647
|
var type = getTypeOfSymbol(getSymbolOfNode(member));
|
|
84602
|
-
if (!(type.flags & 3 /* AnyOrUnknown */ ||
|
|
84648
|
+
if (!(type.flags & 3 /* AnyOrUnknown */ || getTypeFacts(type) & 16777216 /* IsUndefined */)) {
|
|
84603
84649
|
if (!constructor || !isPropertyInitializedInConstructor(propName, type, constructor)) {
|
|
84604
84650
|
error(member.name, ts.Diagnostics.Property_0_has_no_initializer_and_is_not_definitely_assigned_in_the_constructor, ts.declarationNameToString(propName));
|
|
84605
84651
|
}
|
|
@@ -84624,7 +84670,7 @@ var ts;
|
|
|
84624
84670
|
ts.setParent(reference, staticBlock);
|
|
84625
84671
|
reference.flowNode = staticBlock.returnFlowNode;
|
|
84626
84672
|
var flowType = getFlowTypeOfReference(reference, propType, getOptionalType(propType));
|
|
84627
|
-
if (!(
|
|
84673
|
+
if (!(getTypeFacts(flowType) & 16777216 /* IsUndefined */)) {
|
|
84628
84674
|
return true;
|
|
84629
84675
|
}
|
|
84630
84676
|
}
|
|
@@ -84639,7 +84685,7 @@ var ts;
|
|
|
84639
84685
|
ts.setParent(reference, constructor);
|
|
84640
84686
|
reference.flowNode = constructor.returnFlowNode;
|
|
84641
84687
|
var flowType = getFlowTypeOfReference(reference, propType, getOptionalType(propType));
|
|
84642
|
-
return !(
|
|
84688
|
+
return !(getTypeFacts(flowType) & 16777216 /* IsUndefined */);
|
|
84643
84689
|
}
|
|
84644
84690
|
function checkInterfaceDeclaration(node) {
|
|
84645
84691
|
// Grammar checking
|
|
@@ -85270,10 +85316,10 @@ var ts;
|
|
|
85270
85316
|
var override = ts.getResolutionModeOverrideForClause(declaration.assertClause, validForTypeAssertions ? grammarErrorOnNode : undefined);
|
|
85271
85317
|
if (validForTypeAssertions && override) {
|
|
85272
85318
|
if (!ts.isNightly()) {
|
|
85273
|
-
grammarErrorOnNode(declaration.assertClause, ts.Diagnostics.
|
|
85319
|
+
grammarErrorOnNode(declaration.assertClause, ts.Diagnostics.resolution_mode_assertions_are_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next);
|
|
85274
85320
|
}
|
|
85275
85321
|
if (ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.Node16 && ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.NodeNext) {
|
|
85276
|
-
return grammarErrorOnNode(declaration.assertClause, ts.Diagnostics.
|
|
85322
|
+
return grammarErrorOnNode(declaration.assertClause, ts.Diagnostics.resolution_mode_assertions_are_only_supported_when_moduleResolution_is_node16_or_nodenext);
|
|
85277
85323
|
}
|
|
85278
85324
|
return; // Other grammar checks do not apply to type-only imports with resolution mode assertions
|
|
85279
85325
|
}
|
|
@@ -92929,8 +92975,8 @@ var ts;
|
|
|
92929
92975
|
// Note when updating logic here also update getEntityNameForDecoratorMetadata
|
|
92930
92976
|
// so that aliases can be marked as referenced
|
|
92931
92977
|
var serializedUnion;
|
|
92932
|
-
for (var _i = 0,
|
|
92933
|
-
var typeNode =
|
|
92978
|
+
for (var _i = 0, types_22 = types; _i < types_22.length; _i++) {
|
|
92979
|
+
var typeNode = types_22[_i];
|
|
92934
92980
|
while (typeNode.kind === 191 /* ParenthesizedType */) {
|
|
92935
92981
|
typeNode = typeNode.type; // Skip parens if need be
|
|
92936
92982
|
}
|
|
@@ -108132,7 +108178,8 @@ var ts;
|
|
|
108132
108178
|
trackReferencedAmbientModule: trackReferencedAmbientModule,
|
|
108133
108179
|
trackExternalModuleSymbolOfImportTypeNode: trackExternalModuleSymbolOfImportTypeNode,
|
|
108134
108180
|
reportNonlocalAugmentation: reportNonlocalAugmentation,
|
|
108135
|
-
reportNonSerializableProperty: reportNonSerializableProperty
|
|
108181
|
+
reportNonSerializableProperty: reportNonSerializableProperty,
|
|
108182
|
+
reportImportTypeNodeResolutionModeOverride: reportImportTypeNodeResolutionModeOverride,
|
|
108136
108183
|
};
|
|
108137
108184
|
var errorNameNode;
|
|
108138
108185
|
var errorFallbackNode;
|
|
@@ -108259,6 +108306,11 @@ var ts;
|
|
|
108259
108306
|
context.addDiagnostic(ts.createDiagnosticForNode((errorNameNode || errorFallbackNode), ts.Diagnostics.The_type_of_this_node_cannot_be_serialized_because_its_property_0_cannot_be_serialized, propertyName));
|
|
108260
108307
|
}
|
|
108261
108308
|
}
|
|
108309
|
+
function reportImportTypeNodeResolutionModeOverride() {
|
|
108310
|
+
if (!ts.isNightly() && (errorNameNode || errorFallbackNode)) {
|
|
108311
|
+
context.addDiagnostic(ts.createDiagnosticForNode((errorNameNode || errorFallbackNode), ts.Diagnostics.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));
|
|
108312
|
+
}
|
|
108313
|
+
}
|
|
108262
108314
|
function transformDeclarationsForJS(sourceFile, bundled) {
|
|
108263
108315
|
var oldDiag = getSymbolAccessibilityDiagnostic;
|
|
108264
108316
|
getSymbolAccessibilityDiagnostic = function (s) { return (s.errorNode && ts.canProduceDiagnostics(s.errorNode) ? ts.createGetSymbolAccessibilityDiagnosticForNode(s.errorNode)(s) : ({
|
|
@@ -108709,7 +108761,7 @@ var ts;
|
|
|
108709
108761
|
var mode = ts.getResolutionModeOverrideForClause(assertClause);
|
|
108710
108762
|
if (mode !== undefined) {
|
|
108711
108763
|
if (!ts.isNightly()) {
|
|
108712
|
-
context.addDiagnostic(ts.createDiagnosticForNode(assertClause, ts.Diagnostics.
|
|
108764
|
+
context.addDiagnostic(ts.createDiagnosticForNode(assertClause, ts.Diagnostics.resolution_mode_assertions_are_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next));
|
|
108713
108765
|
}
|
|
108714
108766
|
return assertClause;
|
|
108715
108767
|
}
|
|
@@ -113545,8 +113597,8 @@ var ts;
|
|
|
113545
113597
|
bundleFileInfo.sections.push({ pos: pos, end: writer.getTextPos(), kind: "reference" /* Reference */, data: directive.fileName });
|
|
113546
113598
|
writeLine();
|
|
113547
113599
|
}
|
|
113548
|
-
for (var _d = 0,
|
|
113549
|
-
var directive =
|
|
113600
|
+
for (var _d = 0, types_23 = types; _d < types_23.length; _d++) {
|
|
113601
|
+
var directive = types_23[_d];
|
|
113550
113602
|
var pos = writer.getTextPos();
|
|
113551
113603
|
var resolutionMode = directive.resolutionMode && directive.resolutionMode !== (currentSourceFile === null || currentSourceFile === void 0 ? void 0 : currentSourceFile.impliedNodeFormat)
|
|
113552
113604
|
? "resolution-mode=\"" + (directive.resolutionMode === ts.ModuleKind.ESNext ? "import" : "require") + "\""
|
|
@@ -116218,12 +116270,14 @@ var ts;
|
|
|
116218
116270
|
}
|
|
116219
116271
|
ts.loadWithTypeDirectiveCache = loadWithTypeDirectiveCache;
|
|
116220
116272
|
;
|
|
116221
|
-
|
|
116273
|
+
/**
|
|
116274
|
+
* Calculates the resulting resolution mode for some reference in some file - this is generally the explicitly
|
|
116275
|
+
* provided resolution mode in the reference, unless one is not present, in which case it is the mode of the containing file.
|
|
116276
|
+
*/
|
|
116222
116277
|
function getModeForFileReference(ref, containingFileMode) {
|
|
116223
116278
|
return (ts.isString(ref) ? containingFileMode : ref.resolutionMode) || containingFileMode;
|
|
116224
116279
|
}
|
|
116225
116280
|
ts.getModeForFileReference = getModeForFileReference;
|
|
116226
|
-
/* @internal */
|
|
116227
116281
|
function getModeForResolutionAtIndex(file, index) {
|
|
116228
116282
|
if (file.impliedNodeFormat === undefined)
|
|
116229
116283
|
return undefined;
|
|
@@ -116244,7 +116298,15 @@ var ts;
|
|
|
116244
116298
|
return false;
|
|
116245
116299
|
}
|
|
116246
116300
|
ts.isExclusivelyTypeOnlyImportOrExport = isExclusivelyTypeOnlyImportOrExport;
|
|
116247
|
-
|
|
116301
|
+
/**
|
|
116302
|
+
* Calculates the final resolution mode for a given module reference node. This is generally the explicitly provided resolution mode, if
|
|
116303
|
+
* one exists, or the mode of the containing source file. (Excepting import=require, which is always commonjs, and dynamic import, which is always esm).
|
|
116304
|
+
* Notably, this function always returns `undefined` if the containing file has an `undefined` `impliedNodeFormat` - this field is only set when
|
|
116305
|
+
* `moduleResolution` is `node16`+.
|
|
116306
|
+
* @param file The file the import or import-like reference is contained within
|
|
116307
|
+
* @param usage The module reference string
|
|
116308
|
+
* @returns The final resolution mode of the import
|
|
116309
|
+
*/
|
|
116248
116310
|
function getModeForUsageLocation(file, usage) {
|
|
116249
116311
|
var _a, _b;
|
|
116250
116312
|
if (file.impliedNodeFormat === undefined)
|
|
@@ -118480,7 +118542,7 @@ var ts;
|
|
|
118480
118542
|
ts.setResolvedTypeReferenceDirective(file, fileName, resolvedTypeReferenceDirective);
|
|
118481
118543
|
var mode = ref.resolutionMode || file.impliedNodeFormat;
|
|
118482
118544
|
if (mode && ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.Node16 && ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.NodeNext) {
|
|
118483
|
-
programDiagnostics.add(ts.createDiagnosticForRange(file, ref, ts.Diagnostics.
|
|
118545
|
+
programDiagnostics.add(ts.createDiagnosticForRange(file, ref, ts.Diagnostics.resolution_mode_assertions_are_only_supported_when_moduleResolution_is_node16_or_nodenext));
|
|
118484
118546
|
}
|
|
118485
118547
|
processTypeReferenceDirective(fileName, mode, resolvedTypeReferenceDirective, { kind: ts.FileIncludeKind.TypeReferenceDirective, file: file.path, index: index, });
|
|
118486
118548
|
}
|
|
@@ -122314,7 +122376,7 @@ var ts;
|
|
|
122314
122376
|
});
|
|
122315
122377
|
// Sort by paths closest to importing file Name directory
|
|
122316
122378
|
var sortedPaths = [];
|
|
122317
|
-
var
|
|
122379
|
+
var _loop_34 = function (directory) {
|
|
122318
122380
|
var directoryStart = ts.ensureTrailingDirectorySeparator(directory);
|
|
122319
122381
|
var pathsInDirectory;
|
|
122320
122382
|
allFileNames.forEach(function (_a, fileName) {
|
|
@@ -122338,9 +122400,9 @@ var ts;
|
|
|
122338
122400
|
};
|
|
122339
122401
|
var out_directory_1;
|
|
122340
122402
|
for (var directory = ts.getDirectoryPath(importingFileName); allFileNames.size !== 0;) {
|
|
122341
|
-
var
|
|
122403
|
+
var state_11 = _loop_34(directory);
|
|
122342
122404
|
directory = out_directory_1;
|
|
122343
|
-
if (
|
|
122405
|
+
if (state_11 === "break")
|
|
122344
122406
|
break;
|
|
122345
122407
|
}
|
|
122346
122408
|
if (allFileNames.size) {
|