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/tsserver.js
CHANGED
|
@@ -100,7 +100,7 @@ var ts;
|
|
|
100
100
|
// The following is baselined as a literal template type without intervention
|
|
101
101
|
/** The version of the TypeScript compiler release */
|
|
102
102
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
103
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
103
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220603";
|
|
104
104
|
/* @internal */
|
|
105
105
|
var Comparison;
|
|
106
106
|
(function (Comparison) {
|
|
@@ -8202,6 +8202,7 @@ var ts;
|
|
|
8202
8202
|
Decorators_are_not_valid_here: diag(1206, ts.DiagnosticCategory.Error, "Decorators_are_not_valid_here_1206", "Decorators are not valid here."),
|
|
8203
8203
|
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."),
|
|
8204
8204
|
_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."),
|
|
8205
|
+
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}()'?"),
|
|
8205
8206
|
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."),
|
|
8206
8207
|
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."),
|
|
8207
8208
|
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."),
|
|
@@ -8398,7 +8399,7 @@ var ts;
|
|
|
8398
8399
|
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."),
|
|
8399
8400
|
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"),
|
|
8400
8401
|
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"),
|
|
8401
|
-
|
|
8402
|
+
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`."),
|
|
8402
8403
|
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`."),
|
|
8403
8404
|
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."),
|
|
8404
8405
|
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."),
|
|
@@ -8905,6 +8906,8 @@ var ts;
|
|
|
8905
8906
|
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."),
|
|
8906
8907
|
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."),
|
|
8907
8908
|
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."),
|
|
8909
|
+
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"),
|
|
8910
|
+
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'."),
|
|
8908
8911
|
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}'."),
|
|
8909
8912
|
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}'."),
|
|
8910
8913
|
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}'."),
|
|
@@ -9012,7 +9015,7 @@ var ts;
|
|
|
9012
9015
|
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}'."),
|
|
9013
9016
|
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}'?"),
|
|
9014
9017
|
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'."),
|
|
9015
|
-
|
|
9018
|
+
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'."),
|
|
9016
9019
|
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."),
|
|
9017
9020
|
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."),
|
|
9018
9021
|
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}'."),
|
|
@@ -16053,6 +16056,8 @@ var ts;
|
|
|
16053
16056
|
case 218 /* AwaitExpression */:
|
|
16054
16057
|
case 231 /* MetaProperty */:
|
|
16055
16058
|
return true;
|
|
16059
|
+
case 228 /* ExpressionWithTypeArguments */:
|
|
16060
|
+
return !ts.isHeritageClause(node.parent);
|
|
16056
16061
|
case 161 /* QualifiedName */:
|
|
16057
16062
|
while (node.parent.kind === 161 /* QualifiedName */) {
|
|
16058
16063
|
node = node.parent;
|
|
@@ -29086,6 +29091,10 @@ var ts;
|
|
|
29086
29091
|
return node.kind === 267 /* ImportClause */;
|
|
29087
29092
|
}
|
|
29088
29093
|
ts.isImportClause = isImportClause;
|
|
29094
|
+
function isImportTypeAssertionContainer(node) {
|
|
29095
|
+
return node.kind === 295 /* ImportTypeAssertionContainer */;
|
|
29096
|
+
}
|
|
29097
|
+
ts.isImportTypeAssertionContainer = isImportTypeAssertionContainer;
|
|
29089
29098
|
function isAssertClause(node) {
|
|
29090
29099
|
return node.kind === 293 /* AssertClause */;
|
|
29091
29100
|
}
|
|
@@ -35658,6 +35667,9 @@ var ts;
|
|
|
35658
35667
|
typeArguments = expression.typeArguments;
|
|
35659
35668
|
expression = expression.expression;
|
|
35660
35669
|
}
|
|
35670
|
+
if (token() === 28 /* QuestionDotToken */) {
|
|
35671
|
+
parseErrorAtCurrentToken(ts.Diagnostics.Invalid_optional_chain_from_new_expression_Did_you_mean_to_call_0, ts.getTextOfNodeFromSourceText(sourceText, expression));
|
|
35672
|
+
}
|
|
35661
35673
|
var argumentList = token() === 20 /* OpenParenToken */ ? parseArgumentList() : undefined;
|
|
35662
35674
|
return finishNode(factory.createNewExpression(expression, typeArguments, argumentList), pos);
|
|
35663
35675
|
}
|
|
@@ -43849,13 +43861,36 @@ var ts;
|
|
|
43849
43861
|
}
|
|
43850
43862
|
return toSearchResult(/*value*/ undefined);
|
|
43851
43863
|
}
|
|
43864
|
+
/**
|
|
43865
|
+
* From https://github.com/nodejs/node/blob/8f39f51cbbd3b2de14b9ee896e26421cc5b20121/lib/internal/modules/esm/resolve.js#L722 -
|
|
43866
|
+
* "longest" has some nuance as to what "longest" means in the presence of pattern trailers
|
|
43867
|
+
*/
|
|
43868
|
+
function comparePatternKeys(a, b) {
|
|
43869
|
+
var aPatternIndex = a.indexOf("*");
|
|
43870
|
+
var bPatternIndex = b.indexOf("*");
|
|
43871
|
+
var baseLenA = aPatternIndex === -1 ? a.length : aPatternIndex + 1;
|
|
43872
|
+
var baseLenB = bPatternIndex === -1 ? b.length : bPatternIndex + 1;
|
|
43873
|
+
if (baseLenA > baseLenB)
|
|
43874
|
+
return -1;
|
|
43875
|
+
if (baseLenB > baseLenA)
|
|
43876
|
+
return 1;
|
|
43877
|
+
if (aPatternIndex === -1)
|
|
43878
|
+
return 1;
|
|
43879
|
+
if (bPatternIndex === -1)
|
|
43880
|
+
return -1;
|
|
43881
|
+
if (a.length > b.length)
|
|
43882
|
+
return -1;
|
|
43883
|
+
if (b.length > a.length)
|
|
43884
|
+
return 1;
|
|
43885
|
+
return 0;
|
|
43886
|
+
}
|
|
43852
43887
|
function loadModuleFromImportsOrExports(extensions, state, cache, redirectedReference, moduleName, lookupTable, scope, isImports) {
|
|
43853
43888
|
var loadModuleFromTargetImportOrExport = getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirectedReference, moduleName, scope, isImports);
|
|
43854
43889
|
if (!ts.endsWith(moduleName, ts.directorySeparator) && moduleName.indexOf("*") === -1 && ts.hasProperty(lookupTable, moduleName)) {
|
|
43855
43890
|
var target = lookupTable[moduleName];
|
|
43856
43891
|
return loadModuleFromTargetImportOrExport(target, /*subpath*/ "", /*pattern*/ false);
|
|
43857
43892
|
}
|
|
43858
|
-
var expandingKeys = ts.sort(ts.filter(ts.getOwnKeys(lookupTable), function (k) { return k.indexOf("*") !== -1 || ts.endsWith(k, "/"); }),
|
|
43893
|
+
var expandingKeys = ts.sort(ts.filter(ts.getOwnKeys(lookupTable), function (k) { return k.indexOf("*") !== -1 || ts.endsWith(k, "/"); }), comparePatternKeys);
|
|
43859
43894
|
for (var _i = 0, expandingKeys_1 = expandingKeys; _i < expandingKeys_1.length; _i++) {
|
|
43860
43895
|
var potentialTarget = expandingKeys_1[_i];
|
|
43861
43896
|
if (state.features & NodeResolutionFeatures.ExportsPatternTrailers && matchesPatternWithTrailer(potentialTarget, moduleName)) {
|
|
@@ -44174,8 +44209,8 @@ var ts;
|
|
|
44174
44209
|
var pathAndExtension = loadModuleFromFile(extensions, candidate, onlyRecordFailures, state) ||
|
|
44175
44210
|
loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageInfo && packageInfo.packageJsonContent, packageInfo && packageInfo.versionPaths);
|
|
44176
44211
|
if (!pathAndExtension && packageInfo
|
|
44177
|
-
|
|
44178
|
-
&& packageInfo.packageJsonContent.
|
|
44212
|
+
// eslint-disable-next-line no-null/no-null
|
|
44213
|
+
&& (packageInfo.packageJsonContent.exports === undefined || packageInfo.packageJsonContent.exports === null)
|
|
44179
44214
|
&& state.features & NodeResolutionFeatures.EsmMode) {
|
|
44180
44215
|
// EsmMode disables index lookup in `loadNodeModuleFromDirectoryWorker` generally, however non-relative package resolutions still assume
|
|
44181
44216
|
// a default `index.js` entrypoint if no `main` or `exports` are present
|
|
@@ -47840,7 +47875,10 @@ var ts;
|
|
|
47840
47875
|
TypeFacts[TypeFacts["NEUndefinedOrNull"] = 2097152] = "NEUndefinedOrNull";
|
|
47841
47876
|
TypeFacts[TypeFacts["Truthy"] = 4194304] = "Truthy";
|
|
47842
47877
|
TypeFacts[TypeFacts["Falsy"] = 8388608] = "Falsy";
|
|
47843
|
-
TypeFacts[TypeFacts["
|
|
47878
|
+
TypeFacts[TypeFacts["IsUndefined"] = 16777216] = "IsUndefined";
|
|
47879
|
+
TypeFacts[TypeFacts["IsNull"] = 33554432] = "IsNull";
|
|
47880
|
+
TypeFacts[TypeFacts["IsUndefinedOrNull"] = 50331648] = "IsUndefinedOrNull";
|
|
47881
|
+
TypeFacts[TypeFacts["All"] = 134217727] = "All";
|
|
47844
47882
|
// The following members encode facts about particular kinds of types for use in the getTypeFacts function.
|
|
47845
47883
|
// The presence of a particular fact means that the given test is true for some (and possibly all) values
|
|
47846
47884
|
// of that kind of type.
|
|
@@ -47882,14 +47920,16 @@ var ts;
|
|
|
47882
47920
|
TypeFacts[TypeFacts["ObjectFacts"] = 16736160] = "ObjectFacts";
|
|
47883
47921
|
TypeFacts[TypeFacts["FunctionStrictFacts"] = 7880640] = "FunctionStrictFacts";
|
|
47884
47922
|
TypeFacts[TypeFacts["FunctionFacts"] = 16728000] = "FunctionFacts";
|
|
47885
|
-
TypeFacts[TypeFacts["
|
|
47886
|
-
TypeFacts[TypeFacts["
|
|
47887
|
-
TypeFacts[TypeFacts["
|
|
47923
|
+
TypeFacts[TypeFacts["VoidFacts"] = 9830144] = "VoidFacts";
|
|
47924
|
+
TypeFacts[TypeFacts["UndefinedFacts"] = 26607360] = "UndefinedFacts";
|
|
47925
|
+
TypeFacts[TypeFacts["NullFacts"] = 42917664] = "NullFacts";
|
|
47926
|
+
TypeFacts[TypeFacts["EmptyObjectStrictFacts"] = 83427327] = "EmptyObjectStrictFacts";
|
|
47927
|
+
TypeFacts[TypeFacts["EmptyObjectFacts"] = 83886079] = "EmptyObjectFacts";
|
|
47928
|
+
TypeFacts[TypeFacts["UnknownFacts"] = 83886079] = "UnknownFacts";
|
|
47888
47929
|
TypeFacts[TypeFacts["AllTypeofNE"] = 556800] = "AllTypeofNE";
|
|
47889
|
-
TypeFacts[TypeFacts["EmptyObjectFacts"] = 16777215] = "EmptyObjectFacts";
|
|
47890
47930
|
// Masks
|
|
47891
47931
|
TypeFacts[TypeFacts["OrFactsMask"] = 8256] = "OrFactsMask";
|
|
47892
|
-
TypeFacts[TypeFacts["AndFactsMask"] =
|
|
47932
|
+
TypeFacts[TypeFacts["AndFactsMask"] = 134209471] = "AndFactsMask";
|
|
47893
47933
|
})(TypeFacts || (TypeFacts = {}));
|
|
47894
47934
|
var typeofEQFacts = new ts.Map(ts.getEntries({
|
|
47895
47935
|
string: 1 /* TypeofEQString */,
|
|
@@ -50053,7 +50093,12 @@ var ts;
|
|
|
50053
50093
|
function checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning) {
|
|
50054
50094
|
if (meaning & (111551 /* Value */ & ~1024 /* NamespaceModule */)) {
|
|
50055
50095
|
if (isPrimitiveTypeName(name)) {
|
|
50056
|
-
|
|
50096
|
+
if (isExtendedByInterface(errorLocation)) {
|
|
50097
|
+
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));
|
|
50098
|
+
}
|
|
50099
|
+
else {
|
|
50100
|
+
error(errorLocation, ts.Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here, ts.unescapeLeadingUnderscores(name));
|
|
50101
|
+
}
|
|
50057
50102
|
return true;
|
|
50058
50103
|
}
|
|
50059
50104
|
var symbol = resolveSymbol(resolveName(errorLocation, name, 788968 /* Type */ & ~111551 /* Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false));
|
|
@@ -50073,6 +50118,16 @@ var ts;
|
|
|
50073
50118
|
}
|
|
50074
50119
|
return false;
|
|
50075
50120
|
}
|
|
50121
|
+
function isExtendedByInterface(node) {
|
|
50122
|
+
var grandparent = node.parent.parent;
|
|
50123
|
+
var parentOfGrandparent = grandparent.parent;
|
|
50124
|
+
if (grandparent && parentOfGrandparent) {
|
|
50125
|
+
var isExtending = ts.isHeritageClause(grandparent) && grandparent.token === 94 /* ExtendsKeyword */;
|
|
50126
|
+
var isInterface = ts.isInterfaceDeclaration(parentOfGrandparent);
|
|
50127
|
+
return isExtending && isInterface;
|
|
50128
|
+
}
|
|
50129
|
+
return false;
|
|
50130
|
+
}
|
|
50076
50131
|
function maybeMappedType(node, symbol) {
|
|
50077
50132
|
var container = ts.findAncestor(node.parent, function (n) {
|
|
50078
50133
|
return ts.isComputedPropertyName(n) || ts.isPropertySignature(n) ? false : ts.isTypeLiteralNode(n) || "quit";
|
|
@@ -52913,7 +52968,7 @@ var ts;
|
|
|
52913
52968
|
anyType : getNonMissingTypeOfSymbol(propertySymbol);
|
|
52914
52969
|
var saveEnclosingDeclaration = context.enclosingDeclaration;
|
|
52915
52970
|
context.enclosingDeclaration = undefined;
|
|
52916
|
-
if (context.tracker.trackSymbol &&
|
|
52971
|
+
if (context.tracker.trackSymbol && isLateBoundName(propertySymbol.escapedName)) {
|
|
52917
52972
|
if (propertySymbol.declarations) {
|
|
52918
52973
|
var decl = ts.first(propertySymbol.declarations);
|
|
52919
52974
|
if (hasLateBindableName(decl)) {
|
|
@@ -53414,6 +53469,7 @@ var ts;
|
|
|
53414
53469
|
return symbol.parent ? ts.factory.createQualifiedName(symbolToEntityNameNode(symbol.parent), identifier) : identifier;
|
|
53415
53470
|
}
|
|
53416
53471
|
function symbolToTypeNode(symbol, context, meaning, overrideTypeArguments) {
|
|
53472
|
+
var _a, _b, _c, _d;
|
|
53417
53473
|
var chain = lookupSymbolChain(symbol, context, meaning, !(context.flags & 16384 /* UseAliasDefinedOutsideCurrentScope */)); // If we're using aliases outside the current scope, dont bother with the module
|
|
53418
53474
|
var isTypeOf = meaning === 111551 /* Value */;
|
|
53419
53475
|
if (ts.some(chain[0].declarations, hasNonGlobalAugmentationExternalModuleSymbol)) {
|
|
@@ -53431,6 +53487,7 @@ var ts;
|
|
|
53431
53487
|
assertion = ts.factory.createImportTypeAssertionContainer(ts.factory.createAssertClause(ts.factory.createNodeArray([
|
|
53432
53488
|
ts.factory.createAssertEntry(ts.factory.createStringLiteral("resolution-mode"), ts.factory.createStringLiteral("import"))
|
|
53433
53489
|
])));
|
|
53490
|
+
(_b = (_a = context.tracker).reportImportTypeNodeResolutionModeOverride) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
53434
53491
|
}
|
|
53435
53492
|
}
|
|
53436
53493
|
if (!specifier) {
|
|
@@ -53450,6 +53507,7 @@ var ts;
|
|
|
53450
53507
|
assertion = ts.factory.createImportTypeAssertionContainer(ts.factory.createAssertClause(ts.factory.createNodeArray([
|
|
53451
53508
|
ts.factory.createAssertEntry(ts.factory.createStringLiteral("resolution-mode"), ts.factory.createStringLiteral(swappedMode === ts.ModuleKind.ESNext ? "import" : "require"))
|
|
53452
53509
|
])));
|
|
53510
|
+
(_d = (_c = context.tracker).reportImportTypeNodeResolutionModeOverride) === null || _d === void 0 ? void 0 : _d.call(_c);
|
|
53453
53511
|
}
|
|
53454
53512
|
}
|
|
53455
53513
|
if (!assertion) {
|
|
@@ -54597,7 +54655,7 @@ var ts;
|
|
|
54597
54655
|
? getBaseConstructorTypeOfClass(staticType)
|
|
54598
54656
|
: anyType;
|
|
54599
54657
|
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);
|
|
54600
|
-
var symbolProps =
|
|
54658
|
+
var symbolProps = getNonInheritedProperties(classType, baseTypes, getPropertiesOfType(classType));
|
|
54601
54659
|
var publicSymbolProps = ts.filter(symbolProps, function (s) {
|
|
54602
54660
|
// `valueDeclaration` could be undefined if inherited from
|
|
54603
54661
|
// a union/intersection base type, but inherited properties
|
|
@@ -55735,7 +55793,7 @@ var ts;
|
|
|
55735
55793
|
if (ts.getEffectiveTypeAnnotationNode(ts.walkUpBindingElementsAndPatterns(declaration))) {
|
|
55736
55794
|
// In strict null checking mode, if a default value of a non-undefined type is specified, remove
|
|
55737
55795
|
// undefined from the final type.
|
|
55738
|
-
return strictNullChecks && !(
|
|
55796
|
+
return strictNullChecks && !(getTypeFacts(checkDeclarationInitializer(declaration, 0 /* Normal */)) & 16777216 /* IsUndefined */) ? getNonUndefinedType(type) : type;
|
|
55739
55797
|
}
|
|
55740
55798
|
return widenTypeInferredFromInitializer(declaration, getUnionType([getNonUndefinedType(type), checkDeclarationInitializer(declaration, 0 /* Normal */)], 2 /* Subtype */));
|
|
55741
55799
|
}
|
|
@@ -58938,7 +58996,7 @@ var ts;
|
|
|
58938
58996
|
var objectType;
|
|
58939
58997
|
return !!(type.flags & 8388608 /* IndexedAccess */ && ts.getObjectFlags(objectType = type.objectType) & 32 /* Mapped */ &&
|
|
58940
58998
|
!isGenericMappedType(objectType) && isGenericIndexType(type.indexType) &&
|
|
58941
|
-
!objectType
|
|
58999
|
+
!(getMappedTypeModifiers(objectType) & 8 /* ExcludeOptional */) && !objectType.declaration.nameType);
|
|
58942
59000
|
}
|
|
58943
59001
|
/**
|
|
58944
59002
|
* For a type parameter, return the base constraint of the type parameter. For the string, number,
|
|
@@ -64230,7 +64288,7 @@ var ts;
|
|
|
64230
64288
|
var sourceSig = checkMode & 3 /* Callback */ ? undefined : getSingleCallSignature(getNonNullableType(sourceType));
|
|
64231
64289
|
var targetSig = checkMode & 3 /* Callback */ ? undefined : getSingleCallSignature(getNonNullableType(targetType));
|
|
64232
64290
|
var callbacks = sourceSig && targetSig && !getTypePredicateOfSignature(sourceSig) && !getTypePredicateOfSignature(targetSig) &&
|
|
64233
|
-
(
|
|
64291
|
+
(getTypeFacts(sourceType) & 50331648 /* IsUndefinedOrNull */) === (getTypeFacts(targetType) & 50331648 /* IsUndefinedOrNull */);
|
|
64234
64292
|
var related = callbacks ?
|
|
64235
64293
|
compareSignaturesRelated(targetSig, sourceSig, (checkMode & 8 /* StrictArity */) | (strictVariance ? 2 /* StrictCallback */ : 1 /* BivariantCallback */), reportErrors, errorReporter, incompatibleErrorReporter, compareTypes, reportUnreliableMarkers) :
|
|
64236
64294
|
!(checkMode & 3 /* Callback */) && !strictVariance && compareTypes(sourceType, targetType, /*reportErrors*/ false) || compareTypes(targetType, sourceType, reportErrors);
|
|
@@ -67448,30 +67506,8 @@ var ts;
|
|
|
67448
67506
|
var value = _a.value;
|
|
67449
67507
|
return value.base10Value === "0";
|
|
67450
67508
|
}
|
|
67451
|
-
function getFalsyFlagsOfTypes(types) {
|
|
67452
|
-
var result = 0;
|
|
67453
|
-
for (var _i = 0, types_14 = types; _i < types_14.length; _i++) {
|
|
67454
|
-
var t = types_14[_i];
|
|
67455
|
-
result |= getFalsyFlags(t);
|
|
67456
|
-
}
|
|
67457
|
-
return result;
|
|
67458
|
-
}
|
|
67459
|
-
// Returns the String, Number, Boolean, StringLiteral, NumberLiteral, BooleanLiteral, Void, Undefined, or Null
|
|
67460
|
-
// flags for the string, number, boolean, "", 0, false, void, undefined, or null types respectively. Returns
|
|
67461
|
-
// no flags for all other types (including non-falsy literal types).
|
|
67462
|
-
function getFalsyFlags(type) {
|
|
67463
|
-
var t = type.flags & 2097152 /* Intersection */ ? getBaseConstraintOrType(type) : type;
|
|
67464
|
-
return t.flags & 1048576 /* Union */ ? getFalsyFlagsOfTypes(t.types) :
|
|
67465
|
-
t.flags & 128 /* StringLiteral */ ? t.value === "" ? 128 /* StringLiteral */ : 0 :
|
|
67466
|
-
t.flags & 256 /* NumberLiteral */ ? t.value === 0 ? 256 /* NumberLiteral */ : 0 :
|
|
67467
|
-
t.flags & 2048 /* BigIntLiteral */ ? isZeroBigInt(t) ? 2048 /* BigIntLiteral */ : 0 :
|
|
67468
|
-
t.flags & 512 /* BooleanLiteral */ ? (t === falseType || t === regularFalseType) ? 512 /* BooleanLiteral */ : 0 :
|
|
67469
|
-
t.flags & 117724 /* PossiblyFalsy */;
|
|
67470
|
-
}
|
|
67471
67509
|
function removeDefinitelyFalsyTypes(type) {
|
|
67472
|
-
return
|
|
67473
|
-
filterType(type, function (t) { return !(getFalsyFlags(t) & 117632 /* DefinitelyFalsy */); }) :
|
|
67474
|
-
type;
|
|
67510
|
+
return filterType(type, function (t) { return !!(getTypeFacts(t) & 4194304 /* Truthy */); });
|
|
67475
67511
|
}
|
|
67476
67512
|
function extractDefinitelyFalsyTypes(type) {
|
|
67477
67513
|
return mapType(type, getDefinitelyFalsyPartOfType);
|
|
@@ -67514,14 +67550,7 @@ var ts;
|
|
|
67514
67550
|
getIntersectionType([type, emptyObjectType]);
|
|
67515
67551
|
}
|
|
67516
67552
|
function getNonNullableType(type) {
|
|
67517
|
-
|
|
67518
|
-
// First reduce away any constituents that are assignable to 'undefined' or 'null'. This not only eliminates
|
|
67519
|
-
// 'undefined' and 'null', but also higher-order types such as a type parameter 'U extends undefined | null'
|
|
67520
|
-
// that isn't eliminated by a NonNullable<T> instantiation.
|
|
67521
|
-
var reducedType = getTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
|
|
67522
|
-
return maybeTypeOfKind(reducedType, 465829888 /* Instantiable */) ? getGlobalNonNullableTypeInstantiation(reducedType) : reducedType;
|
|
67523
|
-
}
|
|
67524
|
-
return type;
|
|
67553
|
+
return strictNullChecks ? getAdjustedTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */) : type;
|
|
67525
67554
|
}
|
|
67526
67555
|
function addOptionalTypeMarker(type) {
|
|
67527
67556
|
return strictNullChecks ? getUnionType([type, optionalType]) : type;
|
|
@@ -68665,8 +68694,8 @@ var ts;
|
|
|
68665
68694
|
}
|
|
68666
68695
|
function getSingleTypeVariableFromIntersectionTypes(types) {
|
|
68667
68696
|
var typeVariable;
|
|
68668
|
-
for (var _i = 0,
|
|
68669
|
-
var type =
|
|
68697
|
+
for (var _i = 0, types_14 = types; _i < types_14.length; _i++) {
|
|
68698
|
+
var type = types_14[_i];
|
|
68670
68699
|
var t = type.flags & 2097152 /* Intersection */ && ts.find(type.types, function (t) { return !!getInferenceInfoForType(t); });
|
|
68671
68700
|
if (!t || typeVariable && t !== typeVariable) {
|
|
68672
68701
|
return undefined;
|
|
@@ -69419,8 +69448,8 @@ var ts;
|
|
|
69419
69448
|
}
|
|
69420
69449
|
}
|
|
69421
69450
|
};
|
|
69422
|
-
for (var _i = 0,
|
|
69423
|
-
var type =
|
|
69451
|
+
for (var _i = 0, types_15 = types; _i < types_15.length; _i++) {
|
|
69452
|
+
var type = types_15[_i];
|
|
69424
69453
|
var state_9 = _loop_24(type);
|
|
69425
69454
|
if (typeof state_9 === "object")
|
|
69426
69455
|
return state_9.value;
|
|
@@ -69535,14 +69564,16 @@ var ts;
|
|
|
69535
69564
|
return !!(resolved.callSignatures.length || resolved.constructSignatures.length ||
|
|
69536
69565
|
resolved.members.get("bind") && isTypeSubtypeOf(type, globalFunctionType));
|
|
69537
69566
|
}
|
|
69538
|
-
function getTypeFacts(type
|
|
69539
|
-
if (
|
|
69567
|
+
function getTypeFacts(type) {
|
|
69568
|
+
if (type.flags & (2097152 /* Intersection */ | 465829888 /* Instantiable */)) {
|
|
69569
|
+
type = getBaseConstraintOfType(type) || unknownType;
|
|
69570
|
+
}
|
|
69540
69571
|
var flags = type.flags;
|
|
69541
|
-
if (flags & 4 /* String */) {
|
|
69572
|
+
if (flags & (4 /* String */ | 268435456 /* StringMapping */)) {
|
|
69542
69573
|
return strictNullChecks ? 16317953 /* StringStrictFacts */ : 16776705 /* StringFacts */;
|
|
69543
69574
|
}
|
|
69544
|
-
if (flags & 128 /* StringLiteral */) {
|
|
69545
|
-
var isEmpty = type.value === "";
|
|
69575
|
+
if (flags & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */)) {
|
|
69576
|
+
var isEmpty = flags & 128 /* StringLiteral */ && type.value === "";
|
|
69546
69577
|
return strictNullChecks ?
|
|
69547
69578
|
isEmpty ? 12123649 /* EmptyStringStrictFacts */ : 7929345 /* NonEmptyStringStrictFacts */ :
|
|
69548
69579
|
isEmpty ? 12582401 /* EmptyStringFacts */ : 16776705 /* NonEmptyStringFacts */;
|
|
@@ -69574,20 +69605,20 @@ var ts;
|
|
|
69574
69605
|
(type === falseType || type === regularFalseType) ? 12580616 /* FalseFacts */ : 16774920 /* TrueFacts */;
|
|
69575
69606
|
}
|
|
69576
69607
|
if (flags & 524288 /* Object */) {
|
|
69577
|
-
if (ignoreObjects) {
|
|
69578
|
-
return 16768959 /* AndFactsMask */; // This is the identity element for computing type facts of intersection.
|
|
69579
|
-
}
|
|
69580
69608
|
return ts.getObjectFlags(type) & 16 /* Anonymous */ && isEmptyObjectType(type) ?
|
|
69581
|
-
strictNullChecks ?
|
|
69609
|
+
strictNullChecks ? 83427327 /* EmptyObjectStrictFacts */ : 83886079 /* EmptyObjectFacts */ :
|
|
69582
69610
|
isFunctionObjectType(type) ?
|
|
69583
69611
|
strictNullChecks ? 7880640 /* FunctionStrictFacts */ : 16728000 /* FunctionFacts */ :
|
|
69584
69612
|
strictNullChecks ? 7888800 /* ObjectStrictFacts */ : 16736160 /* ObjectFacts */;
|
|
69585
69613
|
}
|
|
69586
|
-
if (flags &
|
|
69587
|
-
return 9830144 /*
|
|
69614
|
+
if (flags & 16384 /* Void */) {
|
|
69615
|
+
return 9830144 /* VoidFacts */;
|
|
69616
|
+
}
|
|
69617
|
+
if (flags & 32768 /* Undefined */) {
|
|
69618
|
+
return 26607360 /* UndefinedFacts */;
|
|
69588
69619
|
}
|
|
69589
69620
|
if (flags & 65536 /* Null */) {
|
|
69590
|
-
return
|
|
69621
|
+
return 42917664 /* NullFacts */;
|
|
69591
69622
|
}
|
|
69592
69623
|
if (flags & 12288 /* ESSymbolLike */) {
|
|
69593
69624
|
return strictNullChecks ? 7925520 /* SymbolStrictFacts */ : 16772880 /* SymbolFacts */;
|
|
@@ -69598,38 +69629,39 @@ var ts;
|
|
|
69598
69629
|
if (flags & 131072 /* Never */) {
|
|
69599
69630
|
return 0 /* None */;
|
|
69600
69631
|
}
|
|
69601
|
-
if (flags & 465829888 /* Instantiable */) {
|
|
69602
|
-
return !isPatternLiteralType(type) ? getTypeFacts(getBaseConstraintOfType(type) || unknownType, ignoreObjects) :
|
|
69603
|
-
strictNullChecks ? 7929345 /* NonEmptyStringStrictFacts */ : 16776705 /* NonEmptyStringFacts */;
|
|
69604
|
-
}
|
|
69605
69632
|
if (flags & 1048576 /* Union */) {
|
|
69606
|
-
return ts.reduceLeft(type.types, function (facts, t) { return facts | getTypeFacts(t
|
|
69633
|
+
return ts.reduceLeft(type.types, function (facts, t) { return facts | getTypeFacts(t); }, 0 /* None */);
|
|
69607
69634
|
}
|
|
69608
69635
|
if (flags & 2097152 /* Intersection */) {
|
|
69609
|
-
|
|
69610
|
-
// presumably type tags. For example, in string & { __kind__: "name" } we ignore the object type.
|
|
69611
|
-
ignoreObjects || (ignoreObjects = maybeTypeOfKind(type, 131068 /* Primitive */));
|
|
69612
|
-
return getIntersectionTypeFacts(type, ignoreObjects);
|
|
69636
|
+
return getIntersectionTypeFacts(type);
|
|
69613
69637
|
}
|
|
69614
|
-
return
|
|
69638
|
+
return 83886079 /* UnknownFacts */;
|
|
69615
69639
|
}
|
|
69616
|
-
function getIntersectionTypeFacts(type
|
|
69640
|
+
function getIntersectionTypeFacts(type) {
|
|
69641
|
+
// When an intersection contains a primitive type we ignore object type constituents as they are
|
|
69642
|
+
// presumably type tags. For example, in string & { __kind__: "name" } we ignore the object type.
|
|
69643
|
+
var ignoreObjects = maybeTypeOfKind(type, 131068 /* Primitive */);
|
|
69617
69644
|
// When computing the type facts of an intersection type, certain type facts are computed as `and`
|
|
69618
69645
|
// and others are computed as `or`.
|
|
69619
69646
|
var oredFacts = 0 /* None */;
|
|
69620
|
-
var andedFacts =
|
|
69647
|
+
var andedFacts = 134217727 /* All */;
|
|
69621
69648
|
for (var _i = 0, _a = type.types; _i < _a.length; _i++) {
|
|
69622
69649
|
var t = _a[_i];
|
|
69623
|
-
|
|
69624
|
-
|
|
69625
|
-
|
|
69650
|
+
if (!(ignoreObjects && t.flags & 524288 /* Object */)) {
|
|
69651
|
+
var f = getTypeFacts(t);
|
|
69652
|
+
oredFacts |= f;
|
|
69653
|
+
andedFacts &= f;
|
|
69654
|
+
}
|
|
69626
69655
|
}
|
|
69627
|
-
return oredFacts & 8256 /* OrFactsMask */ | andedFacts &
|
|
69656
|
+
return oredFacts & 8256 /* OrFactsMask */ | andedFacts & 134209471 /* AndFactsMask */;
|
|
69628
69657
|
}
|
|
69629
69658
|
function getTypeWithFacts(type, include) {
|
|
69630
69659
|
return filterType(type, function (t) { return (getTypeFacts(t) & include) !== 0; });
|
|
69631
69660
|
}
|
|
69632
|
-
function
|
|
69661
|
+
// This function is similar to getTypeWithFacts, except that in strictNullChecks mode it replaces type
|
|
69662
|
+
// unknown with the union {} | null | undefined (and reduces that accordingly), and it intersects remaining
|
|
69663
|
+
// instantiable types with {}, {} | null, or {} | undefined in order to remove null and/or undefined.
|
|
69664
|
+
function getAdjustedTypeWithFacts(type, facts) {
|
|
69633
69665
|
var reduced = recombineUnknownType(getTypeWithFacts(strictNullChecks && type.flags & 2 /* Unknown */ ? unknownUnionType : type, facts));
|
|
69634
69666
|
if (strictNullChecks) {
|
|
69635
69667
|
switch (facts) {
|
|
@@ -69895,8 +69927,8 @@ var ts;
|
|
|
69895
69927
|
var types = origin && origin.flags & 1048576 /* Union */ ? origin.types : type.types;
|
|
69896
69928
|
var mappedTypes;
|
|
69897
69929
|
var changed = false;
|
|
69898
|
-
for (var _i = 0,
|
|
69899
|
-
var t =
|
|
69930
|
+
for (var _i = 0, types_16 = types; _i < types_16.length; _i++) {
|
|
69931
|
+
var t = types_16[_i];
|
|
69900
69932
|
var mapped = t.flags & 1048576 /* Union */ ? mapType(t, mapper, noReductions) : mapper(t);
|
|
69901
69933
|
changed || (changed = t !== mapped);
|
|
69902
69934
|
if (mapped) {
|
|
@@ -69982,8 +70014,8 @@ var ts;
|
|
|
69982
70014
|
}
|
|
69983
70015
|
function isEvolvingArrayTypeList(types) {
|
|
69984
70016
|
var hasEvolvingArrayType = false;
|
|
69985
|
-
for (var _i = 0,
|
|
69986
|
-
var t =
|
|
70017
|
+
for (var _i = 0, types_17 = types; _i < types_17.length; _i++) {
|
|
70018
|
+
var t = types_17[_i];
|
|
69987
70019
|
if (!(t.flags & 131072 /* Never */)) {
|
|
69988
70020
|
if (!(ts.getObjectFlags(t) & 256 /* EvolvingArray */)) {
|
|
69989
70021
|
return false;
|
|
@@ -70806,10 +70838,10 @@ var ts;
|
|
|
70806
70838
|
}
|
|
70807
70839
|
function narrowTypeByTruthiness(type, expr, assumeTrue) {
|
|
70808
70840
|
if (isMatchingReference(reference, expr)) {
|
|
70809
|
-
return
|
|
70841
|
+
return getAdjustedTypeWithFacts(type, assumeTrue ? 4194304 /* Truthy */ : 8388608 /* Falsy */);
|
|
70810
70842
|
}
|
|
70811
70843
|
if (strictNullChecks && assumeTrue && optionalChainContainsReference(expr, reference)) {
|
|
70812
|
-
type =
|
|
70844
|
+
type = getAdjustedTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
|
|
70813
70845
|
}
|
|
70814
70846
|
var access = getDiscriminantPropertyAccess(expr, type);
|
|
70815
70847
|
if (access) {
|
|
@@ -70949,7 +70981,7 @@ var ts;
|
|
|
70949
70981
|
// Note that we include any and unknown in the exclusion test because their domain includes null and undefined.
|
|
70950
70982
|
var removeNullable = equalsOperator !== assumeTrue && everyType(valueType, function (t) { return !!(t.flags & nullableFlags); }) ||
|
|
70951
70983
|
equalsOperator === assumeTrue && everyType(valueType, function (t) { return !(t.flags & (3 /* AnyOrUnknown */ | nullableFlags)); });
|
|
70952
|
-
return removeNullable ?
|
|
70984
|
+
return removeNullable ? getAdjustedTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */) : type;
|
|
70953
70985
|
}
|
|
70954
70986
|
function narrowTypeByEquality(type, operator, value, assumeTrue) {
|
|
70955
70987
|
if (type.flags & 1 /* Any */) {
|
|
@@ -70978,7 +71010,7 @@ var ts;
|
|
|
70978
71010
|
valueType.flags & 65536 /* Null */ ?
|
|
70979
71011
|
assumeTrue ? 131072 /* EQNull */ : 1048576 /* NENull */ :
|
|
70980
71012
|
assumeTrue ? 65536 /* EQUndefined */ : 524288 /* NEUndefined */;
|
|
70981
|
-
return
|
|
71013
|
+
return getAdjustedTypeWithFacts(type, facts);
|
|
70982
71014
|
}
|
|
70983
71015
|
if (assumeTrue) {
|
|
70984
71016
|
var filterFn = operator === 34 /* EqualsEqualsToken */ ?
|
|
@@ -70999,7 +71031,7 @@ var ts;
|
|
|
70999
71031
|
var target = getReferenceCandidate(typeOfExpr.expression);
|
|
71000
71032
|
if (!isMatchingReference(reference, target)) {
|
|
71001
71033
|
if (strictNullChecks && optionalChainContainsReference(target, reference) && assumeTrue === (literal.text !== "undefined")) {
|
|
71002
|
-
return
|
|
71034
|
+
return getAdjustedTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
|
|
71003
71035
|
}
|
|
71004
71036
|
return type;
|
|
71005
71037
|
}
|
|
@@ -71203,7 +71235,7 @@ var ts;
|
|
|
71203
71235
|
var left = getReferenceCandidate(expr.left);
|
|
71204
71236
|
if (!isMatchingReference(reference, left)) {
|
|
71205
71237
|
if (assumeTrue && strictNullChecks && optionalChainContainsReference(left, reference)) {
|
|
71206
|
-
return
|
|
71238
|
+
return getAdjustedTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
|
|
71207
71239
|
}
|
|
71208
71240
|
return type;
|
|
71209
71241
|
}
|
|
@@ -71291,7 +71323,7 @@ var ts;
|
|
|
71291
71323
|
}
|
|
71292
71324
|
if (strictNullChecks && assumeTrue && optionalChainContainsReference(predicateArgument, reference) &&
|
|
71293
71325
|
!(getTypeFacts(predicate.type) & 65536 /* EQUndefined */)) {
|
|
71294
|
-
type =
|
|
71326
|
+
type = getAdjustedTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
|
|
71295
71327
|
}
|
|
71296
71328
|
var access = getDiscriminantPropertyAccess(predicateArgument, type);
|
|
71297
71329
|
if (access) {
|
|
@@ -71348,7 +71380,7 @@ var ts;
|
|
|
71348
71380
|
}
|
|
71349
71381
|
function narrowTypeByOptionality(type, expr, assumePresent) {
|
|
71350
71382
|
if (isMatchingReference(reference, expr)) {
|
|
71351
|
-
return
|
|
71383
|
+
return getAdjustedTypeWithFacts(type, assumePresent ? 2097152 /* NEUndefinedOrNull */ : 262144 /* EQUndefinedOrNull */);
|
|
71352
71384
|
}
|
|
71353
71385
|
var access = getDiscriminantPropertyAccess(expr, type);
|
|
71354
71386
|
if (access) {
|
|
@@ -71434,8 +71466,8 @@ var ts;
|
|
|
71434
71466
|
var annotationIncludesUndefined = strictNullChecks &&
|
|
71435
71467
|
declaration.kind === 164 /* Parameter */ &&
|
|
71436
71468
|
declaration.initializer &&
|
|
71437
|
-
|
|
71438
|
-
!(
|
|
71469
|
+
getTypeFacts(declaredType) & 16777216 /* IsUndefined */ &&
|
|
71470
|
+
!(getTypeFacts(checkExpression(declaration.initializer)) & 16777216 /* IsUndefined */);
|
|
71439
71471
|
popTypeResolution();
|
|
71440
71472
|
return annotationIncludesUndefined ? getTypeWithFacts(declaredType, 524288 /* NEUndefined */) : declaredType;
|
|
71441
71473
|
}
|
|
@@ -71763,7 +71795,7 @@ var ts;
|
|
|
71763
71795
|
return convertAutoToAny(flowType);
|
|
71764
71796
|
}
|
|
71765
71797
|
}
|
|
71766
|
-
else if (!assumeInitialized && !(
|
|
71798
|
+
else if (!assumeInitialized && !(getTypeFacts(type) & 16777216 /* IsUndefined */) && getTypeFacts(flowType) & 16777216 /* IsUndefined */) {
|
|
71767
71799
|
error(node, ts.Diagnostics.Variable_0_is_used_before_being_assigned, symbolToString(symbol));
|
|
71768
71800
|
// Return the declared type to reduce follow-on errors
|
|
71769
71801
|
return type;
|
|
@@ -73292,8 +73324,8 @@ var ts;
|
|
|
73292
73324
|
}
|
|
73293
73325
|
var signatureList;
|
|
73294
73326
|
var types = type.types;
|
|
73295
|
-
for (var _i = 0,
|
|
73296
|
-
var current =
|
|
73327
|
+
for (var _i = 0, types_18 = types; _i < types_18.length; _i++) {
|
|
73328
|
+
var current = types_18[_i];
|
|
73297
73329
|
var signature = getContextualCallSignature(current, node);
|
|
73298
73330
|
if (signature) {
|
|
73299
73331
|
if (!signatureList) {
|
|
@@ -74455,19 +74487,19 @@ var ts;
|
|
|
74455
74487
|
return checkNonNullType(checkExpression(node), node);
|
|
74456
74488
|
}
|
|
74457
74489
|
function isNullableType(type) {
|
|
74458
|
-
return !!((
|
|
74490
|
+
return !!(getTypeFacts(type) & 50331648 /* IsUndefinedOrNull */);
|
|
74459
74491
|
}
|
|
74460
74492
|
function getNonNullableTypeIfNeeded(type) {
|
|
74461
74493
|
return isNullableType(type) ? getNonNullableType(type) : type;
|
|
74462
74494
|
}
|
|
74463
|
-
function reportObjectPossiblyNullOrUndefinedError(node,
|
|
74464
|
-
error(node,
|
|
74495
|
+
function reportObjectPossiblyNullOrUndefinedError(node, facts) {
|
|
74496
|
+
error(node, facts & 16777216 /* IsUndefined */ ? facts & 33554432 /* IsNull */ ?
|
|
74465
74497
|
ts.Diagnostics.Object_is_possibly_null_or_undefined :
|
|
74466
74498
|
ts.Diagnostics.Object_is_possibly_undefined :
|
|
74467
74499
|
ts.Diagnostics.Object_is_possibly_null);
|
|
74468
74500
|
}
|
|
74469
|
-
function reportCannotInvokePossiblyNullOrUndefinedError(node,
|
|
74470
|
-
error(node,
|
|
74501
|
+
function reportCannotInvokePossiblyNullOrUndefinedError(node, facts) {
|
|
74502
|
+
error(node, facts & 16777216 /* IsUndefined */ ? facts & 33554432 /* IsNull */ ?
|
|
74471
74503
|
ts.Diagnostics.Cannot_invoke_an_object_which_is_possibly_null_or_undefined :
|
|
74472
74504
|
ts.Diagnostics.Cannot_invoke_an_object_which_is_possibly_undefined :
|
|
74473
74505
|
ts.Diagnostics.Cannot_invoke_an_object_which_is_possibly_null);
|
|
@@ -74477,9 +74509,9 @@ var ts;
|
|
|
74477
74509
|
error(node, ts.Diagnostics.Object_is_of_type_unknown);
|
|
74478
74510
|
return errorType;
|
|
74479
74511
|
}
|
|
74480
|
-
var
|
|
74481
|
-
if (
|
|
74482
|
-
reportError(node,
|
|
74512
|
+
var facts = getTypeFacts(type);
|
|
74513
|
+
if (facts & 50331648 /* IsUndefinedOrNull */) {
|
|
74514
|
+
reportError(node, facts);
|
|
74483
74515
|
var t = getNonNullableType(type);
|
|
74484
74516
|
return t.flags & (98304 /* Nullable */ | 131072 /* Never */) ? errorType : t;
|
|
74485
74517
|
}
|
|
@@ -74774,7 +74806,7 @@ var ts;
|
|
|
74774
74806
|
assumeUninitialized = true;
|
|
74775
74807
|
}
|
|
74776
74808
|
var flowType = getFlowTypeOfReference(node, propType, assumeUninitialized ? getOptionalType(propType) : propType);
|
|
74777
|
-
if (assumeUninitialized && !(
|
|
74809
|
+
if (assumeUninitialized && !(getTypeFacts(propType) & 16777216 /* IsUndefined */) && getTypeFacts(flowType) & 16777216 /* IsUndefined */) {
|
|
74778
74810
|
error(errorNode, ts.Diagnostics.Property_0_is_used_before_being_assigned, symbolToString(prop)); // TODO: GH#18217
|
|
74779
74811
|
// Return the declared type to reduce follow-on errors
|
|
74780
74812
|
return propType;
|
|
@@ -76690,8 +76722,8 @@ var ts;
|
|
|
76690
76722
|
if (apparentType.flags & 1048576 /* Union */) {
|
|
76691
76723
|
var types = apparentType.types;
|
|
76692
76724
|
var hasSignatures = false;
|
|
76693
|
-
for (var _i = 0,
|
|
76694
|
-
var constituent =
|
|
76725
|
+
for (var _i = 0, types_19 = types; _i < types_19.length; _i++) {
|
|
76726
|
+
var constituent = types_19[_i];
|
|
76695
76727
|
var signatures = getSignaturesOfType(constituent, kind);
|
|
76696
76728
|
if (signatures.length !== 0) {
|
|
76697
76729
|
hasSignatures = true;
|
|
@@ -78382,7 +78414,7 @@ var ts;
|
|
|
78382
78414
|
var type = getTypeOfSymbol(symbol);
|
|
78383
78415
|
if (strictNullChecks &&
|
|
78384
78416
|
!(type.flags & (3 /* AnyOrUnknown */ | 131072 /* Never */)) &&
|
|
78385
|
-
!(exactOptionalPropertyTypes ? symbol.flags & 16777216 /* Optional */ :
|
|
78417
|
+
!(exactOptionalPropertyTypes ? symbol.flags & 16777216 /* Optional */ : getTypeFacts(type) & 16777216 /* IsUndefined */)) {
|
|
78386
78418
|
error(expr, ts.Diagnostics.The_operand_of_a_delete_operator_must_be_optional);
|
|
78387
78419
|
}
|
|
78388
78420
|
}
|
|
@@ -78550,8 +78582,8 @@ var ts;
|
|
|
78550
78582
|
}
|
|
78551
78583
|
if (type.flags & 3145728 /* UnionOrIntersection */) {
|
|
78552
78584
|
var types = type.types;
|
|
78553
|
-
for (var _i = 0,
|
|
78554
|
-
var t =
|
|
78585
|
+
for (var _i = 0, types_20 = types; _i < types_20.length; _i++) {
|
|
78586
|
+
var t = types_20[_i];
|
|
78555
78587
|
if (maybeTypeOfKind(t, kind)) {
|
|
78556
78588
|
return true;
|
|
78557
78589
|
}
|
|
@@ -78778,7 +78810,7 @@ var ts;
|
|
|
78778
78810
|
// In strict null checking mode, if a default value of a non-undefined type is specified, remove
|
|
78779
78811
|
// undefined from the final type.
|
|
78780
78812
|
if (strictNullChecks &&
|
|
78781
|
-
!(
|
|
78813
|
+
!(getTypeFacts(checkExpression(prop.objectAssignmentInitializer)) & 16777216 /* IsUndefined */)) {
|
|
78782
78814
|
sourceType = getTypeWithFacts(sourceType, 524288 /* NEUndefined */);
|
|
78783
78815
|
}
|
|
78784
78816
|
checkBinaryLikeExpression(prop.name, prop.equalsToken, prop.objectAssignmentInitializer, checkMode);
|
|
@@ -78791,6 +78823,10 @@ var ts;
|
|
|
78791
78823
|
if (target.kind === 221 /* BinaryExpression */ && target.operatorToken.kind === 63 /* EqualsToken */) {
|
|
78792
78824
|
checkBinaryExpression(target, checkMode);
|
|
78793
78825
|
target = target.left;
|
|
78826
|
+
// A default value is specified, so remove undefined from the final type.
|
|
78827
|
+
if (strictNullChecks) {
|
|
78828
|
+
sourceType = getTypeWithFacts(sourceType, 524288 /* NEUndefined */);
|
|
78829
|
+
}
|
|
78794
78830
|
}
|
|
78795
78831
|
if (target.kind === 205 /* ObjectLiteralExpression */) {
|
|
78796
78832
|
return checkObjectLiteralAssignment(target, sourceType, rightIsThis);
|
|
@@ -79178,7 +79214,7 @@ var ts;
|
|
|
79178
79214
|
case 56 /* BarBarToken */:
|
|
79179
79215
|
case 75 /* BarBarEqualsToken */: {
|
|
79180
79216
|
var resultType_3 = getTypeFacts(leftType) & 8388608 /* Falsy */ ?
|
|
79181
|
-
getUnionType([removeDefinitelyFalsyTypes(leftType), rightType], 2 /* Subtype */) :
|
|
79217
|
+
getUnionType([getNonNullableType(removeDefinitelyFalsyTypes(leftType)), rightType], 2 /* Subtype */) :
|
|
79182
79218
|
leftType;
|
|
79183
79219
|
if (operator === 75 /* BarBarEqualsToken */) {
|
|
79184
79220
|
checkAssignmentOperator(rightType);
|
|
@@ -80881,8 +80917,11 @@ var ts;
|
|
|
80881
80917
|
if (node.assertions) {
|
|
80882
80918
|
var override = ts.getResolutionModeOverrideForClause(node.assertions.assertClause, grammarErrorOnNode);
|
|
80883
80919
|
if (override) {
|
|
80920
|
+
if (!ts.isNightly()) {
|
|
80921
|
+
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);
|
|
80922
|
+
}
|
|
80884
80923
|
if (ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.Node16 && ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.NodeNext) {
|
|
80885
|
-
grammarErrorOnNode(node.assertions.assertClause, ts.Diagnostics.
|
|
80924
|
+
grammarErrorOnNode(node.assertions.assertClause, ts.Diagnostics.resolution_mode_assertions_are_only_supported_when_moduleResolution_is_node16_or_nodenext);
|
|
80886
80925
|
}
|
|
80887
80926
|
}
|
|
80888
80927
|
}
|
|
@@ -81719,8 +81758,8 @@ var ts;
|
|
|
81719
81758
|
}
|
|
81720
81759
|
function getEntityNameForDecoratorMetadataFromTypeList(types) {
|
|
81721
81760
|
var commonEntityName;
|
|
81722
|
-
for (var _i = 0,
|
|
81723
|
-
var typeNode =
|
|
81761
|
+
for (var _i = 0, types_21 = types; _i < types_21.length; _i++) {
|
|
81762
|
+
var typeNode = types_21[_i];
|
|
81724
81763
|
while (typeNode.kind === 191 /* ParenthesizedType */ || typeNode.kind === 197 /* NamedTupleMember */) {
|
|
81725
81764
|
typeNode = typeNode.type; // Skip parens if need be
|
|
81726
81765
|
}
|
|
@@ -82586,7 +82625,7 @@ var ts;
|
|
|
82586
82625
|
// For a binding pattern, validate the initializer and exit
|
|
82587
82626
|
if (ts.isBindingPattern(node.name)) {
|
|
82588
82627
|
var needCheckInitializer = node.initializer && node.parent.parent.kind !== 243 /* ForInStatement */;
|
|
82589
|
-
var needCheckWidenedType = node.name.elements.
|
|
82628
|
+
var needCheckWidenedType = !ts.some(node.name.elements, ts.not(ts.isOmittedExpression));
|
|
82590
82629
|
if (needCheckInitializer || needCheckWidenedType) {
|
|
82591
82630
|
// Don't validate for-in initializer as it is already an error
|
|
82592
82631
|
var widenedType = getWidenedTypeForVariableLikeDeclaration(node);
|
|
@@ -82739,7 +82778,7 @@ var ts;
|
|
|
82739
82778
|
return;
|
|
82740
82779
|
var type = checkTruthinessExpression(location);
|
|
82741
82780
|
var isPropertyExpressionCast = ts.isPropertyAccessExpression(location) && isTypeAssertion(location.expression);
|
|
82742
|
-
if (
|
|
82781
|
+
if (!(getTypeFacts(type) & 4194304 /* Truthy */) || isPropertyExpressionCast)
|
|
82743
82782
|
return;
|
|
82744
82783
|
// While it technically should be invalid for any known-truthy value
|
|
82745
82784
|
// to be tested, we de-scope to functions and Promises unreferenced in
|
|
@@ -84425,18 +84464,17 @@ var ts;
|
|
|
84425
84464
|
// but not by other kinds of members.
|
|
84426
84465
|
// Base class instance member variables and accessors can be overridden by
|
|
84427
84466
|
// derived class instance member variables and accessors, but not by other kinds of members.
|
|
84428
|
-
var _a, _b;
|
|
84467
|
+
var _a, _b, _c, _d;
|
|
84429
84468
|
// NOTE: assignability is checked in checkClassDeclaration
|
|
84430
84469
|
var baseProperties = getPropertiesOfType(baseType);
|
|
84431
|
-
|
|
84432
|
-
var baseProperty = baseProperties_1[_i];
|
|
84470
|
+
var _loop_33 = function (baseProperty) {
|
|
84433
84471
|
var base = getTargetSymbol(baseProperty);
|
|
84434
84472
|
if (base.flags & 4194304 /* Prototype */) {
|
|
84435
|
-
continue;
|
|
84473
|
+
return "continue";
|
|
84436
84474
|
}
|
|
84437
84475
|
var baseSymbol = getPropertyOfObjectType(type, base.escapedName);
|
|
84438
84476
|
if (!baseSymbol) {
|
|
84439
|
-
continue;
|
|
84477
|
+
return "continue";
|
|
84440
84478
|
}
|
|
84441
84479
|
var derived = getTargetSymbol(baseSymbol);
|
|
84442
84480
|
var baseDeclarationFlags = ts.getDeclarationModifierFlagsFromSymbol(base);
|
|
@@ -84454,14 +84492,14 @@ var ts;
|
|
|
84454
84492
|
// Searches other base types for a declaration that would satisfy the inherited abstract member.
|
|
84455
84493
|
// (The class may have more than one base type via declaration merging with an interface with the
|
|
84456
84494
|
// same name.)
|
|
84457
|
-
for (var
|
|
84458
|
-
var otherBaseType =
|
|
84495
|
+
for (var _e = 0, _f = getBaseTypes(type); _e < _f.length; _e++) {
|
|
84496
|
+
var otherBaseType = _f[_e];
|
|
84459
84497
|
if (otherBaseType === baseType)
|
|
84460
84498
|
continue;
|
|
84461
84499
|
var baseSymbol_1 = getPropertyOfObjectType(otherBaseType, base.escapedName);
|
|
84462
84500
|
var derivedElsewhere = baseSymbol_1 && getTargetSymbol(baseSymbol_1);
|
|
84463
84501
|
if (derivedElsewhere && derivedElsewhere !== base) {
|
|
84464
|
-
continue
|
|
84502
|
+
return "continue-basePropertyCheck";
|
|
84465
84503
|
}
|
|
84466
84504
|
}
|
|
84467
84505
|
if (derivedClassDecl.kind === 226 /* ClassExpression */) {
|
|
@@ -84476,20 +84514,19 @@ var ts;
|
|
|
84476
84514
|
// derived overrides base.
|
|
84477
84515
|
var derivedDeclarationFlags = ts.getDeclarationModifierFlagsFromSymbol(derived);
|
|
84478
84516
|
if (baseDeclarationFlags & 8 /* Private */ || derivedDeclarationFlags & 8 /* Private */) {
|
|
84479
|
-
|
|
84480
|
-
continue;
|
|
84517
|
+
return "continue";
|
|
84481
84518
|
}
|
|
84482
84519
|
var errorMessage = void 0;
|
|
84483
84520
|
var basePropertyFlags = base.flags & 98308 /* PropertyOrAccessor */;
|
|
84484
84521
|
var derivedPropertyFlags = derived.flags & 98308 /* PropertyOrAccessor */;
|
|
84485
84522
|
if (basePropertyFlags && derivedPropertyFlags) {
|
|
84486
84523
|
// property/accessor is overridden with property/accessor
|
|
84487
|
-
if (
|
|
84488
|
-
|
|
84524
|
+
if ((ts.getCheckFlags(base) & 6 /* Synthetic */
|
|
84525
|
+
? (_a = base.declarations) === null || _a === void 0 ? void 0 : _a.some(function (d) { return isPropertyAbstractOrInterface(d, baseDeclarationFlags); })
|
|
84526
|
+
: (_b = base.declarations) === null || _b === void 0 ? void 0 : _b.every(function (d) { return isPropertyAbstractOrInterface(d, baseDeclarationFlags); }))
|
|
84527
|
+
|| ts.getCheckFlags(base) & 262144 /* Mapped */
|
|
84489
84528
|
|| derived.valueDeclaration && ts.isBinaryExpression(derived.valueDeclaration)) {
|
|
84490
|
-
|
|
84491
|
-
// same when the derived property is from an assignment
|
|
84492
|
-
continue;
|
|
84529
|
+
return "continue";
|
|
84493
84530
|
}
|
|
84494
84531
|
var overriddenInstanceProperty = basePropertyFlags !== 4 /* Property */ && derivedPropertyFlags === 4 /* Property */;
|
|
84495
84532
|
var overriddenInstanceAccessor = basePropertyFlags === 4 /* Property */ && derivedPropertyFlags !== 4 /* Property */;
|
|
@@ -84500,12 +84537,12 @@ var ts;
|
|
|
84500
84537
|
error(ts.getNameOfDeclaration(derived.valueDeclaration) || derived.valueDeclaration, errorMessage_1, symbolToString(base), typeToString(baseType), typeToString(type));
|
|
84501
84538
|
}
|
|
84502
84539
|
else if (useDefineForClassFields) {
|
|
84503
|
-
var uninitialized = (
|
|
84540
|
+
var uninitialized = (_c = derived.declarations) === null || _c === void 0 ? void 0 : _c.find(function (d) { return d.kind === 167 /* PropertyDeclaration */ && !d.initializer; });
|
|
84504
84541
|
if (uninitialized
|
|
84505
84542
|
&& !(derived.flags & 33554432 /* Transient */)
|
|
84506
84543
|
&& !(baseDeclarationFlags & 128 /* Abstract */)
|
|
84507
84544
|
&& !(derivedDeclarationFlags & 128 /* Abstract */)
|
|
84508
|
-
&& !((
|
|
84545
|
+
&& !((_d = derived.declarations) === null || _d === void 0 ? void 0 : _d.some(function (d) { return !!(d.flags & 16777216 /* Ambient */); }))) {
|
|
84509
84546
|
var constructor = findConstructorDeclaration(ts.getClassLikeDeclarationOfSymbol(type.symbol));
|
|
84510
84547
|
var propName = uninitialized.name;
|
|
84511
84548
|
if (uninitialized.exclamationToken
|
|
@@ -84518,13 +84555,11 @@ var ts;
|
|
|
84518
84555
|
}
|
|
84519
84556
|
}
|
|
84520
84557
|
}
|
|
84521
|
-
|
|
84522
|
-
continue;
|
|
84558
|
+
return "continue";
|
|
84523
84559
|
}
|
|
84524
84560
|
else if (isPrototypeProperty(base)) {
|
|
84525
84561
|
if (isPrototypeProperty(derived) || derived.flags & 4 /* Property */) {
|
|
84526
|
-
|
|
84527
|
-
continue;
|
|
84562
|
+
return "continue";
|
|
84528
84563
|
}
|
|
84529
84564
|
else {
|
|
84530
84565
|
ts.Debug.assert(!!(derived.flags & 98304 /* Accessor */));
|
|
@@ -84539,9 +84574,20 @@ var ts;
|
|
|
84539
84574
|
}
|
|
84540
84575
|
error(ts.getNameOfDeclaration(derived.valueDeclaration) || derived.valueDeclaration, errorMessage, typeToString(baseType), symbolToString(base), typeToString(type));
|
|
84541
84576
|
}
|
|
84577
|
+
};
|
|
84578
|
+
basePropertyCheck: for (var _i = 0, baseProperties_1 = baseProperties; _i < baseProperties_1.length; _i++) {
|
|
84579
|
+
var baseProperty = baseProperties_1[_i];
|
|
84580
|
+
var state_10 = _loop_33(baseProperty);
|
|
84581
|
+
switch (state_10) {
|
|
84582
|
+
case "continue-basePropertyCheck": continue basePropertyCheck;
|
|
84583
|
+
}
|
|
84542
84584
|
}
|
|
84543
84585
|
}
|
|
84544
|
-
function
|
|
84586
|
+
function isPropertyAbstractOrInterface(declaration, baseDeclarationFlags) {
|
|
84587
|
+
return baseDeclarationFlags & 128 /* Abstract */ && (!ts.isPropertyDeclaration(declaration) || !declaration.initializer)
|
|
84588
|
+
|| ts.isInterfaceDeclaration(declaration.parent);
|
|
84589
|
+
}
|
|
84590
|
+
function getNonInheritedProperties(type, baseTypes, properties) {
|
|
84545
84591
|
if (!ts.length(baseTypes)) {
|
|
84546
84592
|
return properties;
|
|
84547
84593
|
}
|
|
@@ -84610,7 +84656,7 @@ var ts;
|
|
|
84610
84656
|
var propName = member.name;
|
|
84611
84657
|
if (ts.isIdentifier(propName) || ts.isPrivateIdentifier(propName) || ts.isComputedPropertyName(propName)) {
|
|
84612
84658
|
var type = getTypeOfSymbol(getSymbolOfNode(member));
|
|
84613
|
-
if (!(type.flags & 3 /* AnyOrUnknown */ ||
|
|
84659
|
+
if (!(type.flags & 3 /* AnyOrUnknown */ || getTypeFacts(type) & 16777216 /* IsUndefined */)) {
|
|
84614
84660
|
if (!constructor || !isPropertyInitializedInConstructor(propName, type, constructor)) {
|
|
84615
84661
|
error(member.name, ts.Diagnostics.Property_0_has_no_initializer_and_is_not_definitely_assigned_in_the_constructor, ts.declarationNameToString(propName));
|
|
84616
84662
|
}
|
|
@@ -84635,7 +84681,7 @@ var ts;
|
|
|
84635
84681
|
ts.setParent(reference, staticBlock);
|
|
84636
84682
|
reference.flowNode = staticBlock.returnFlowNode;
|
|
84637
84683
|
var flowType = getFlowTypeOfReference(reference, propType, getOptionalType(propType));
|
|
84638
|
-
if (!(
|
|
84684
|
+
if (!(getTypeFacts(flowType) & 16777216 /* IsUndefined */)) {
|
|
84639
84685
|
return true;
|
|
84640
84686
|
}
|
|
84641
84687
|
}
|
|
@@ -84650,7 +84696,7 @@ var ts;
|
|
|
84650
84696
|
ts.setParent(reference, constructor);
|
|
84651
84697
|
reference.flowNode = constructor.returnFlowNode;
|
|
84652
84698
|
var flowType = getFlowTypeOfReference(reference, propType, getOptionalType(propType));
|
|
84653
|
-
return !(
|
|
84699
|
+
return !(getTypeFacts(flowType) & 16777216 /* IsUndefined */);
|
|
84654
84700
|
}
|
|
84655
84701
|
function checkInterfaceDeclaration(node) {
|
|
84656
84702
|
// Grammar checking
|
|
@@ -85281,10 +85327,10 @@ var ts;
|
|
|
85281
85327
|
var override = ts.getResolutionModeOverrideForClause(declaration.assertClause, validForTypeAssertions ? grammarErrorOnNode : undefined);
|
|
85282
85328
|
if (validForTypeAssertions && override) {
|
|
85283
85329
|
if (!ts.isNightly()) {
|
|
85284
|
-
grammarErrorOnNode(declaration.assertClause, ts.Diagnostics.
|
|
85330
|
+
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);
|
|
85285
85331
|
}
|
|
85286
85332
|
if (ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.Node16 && ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.NodeNext) {
|
|
85287
|
-
return grammarErrorOnNode(declaration.assertClause, ts.Diagnostics.
|
|
85333
|
+
return grammarErrorOnNode(declaration.assertClause, ts.Diagnostics.resolution_mode_assertions_are_only_supported_when_moduleResolution_is_node16_or_nodenext);
|
|
85288
85334
|
}
|
|
85289
85335
|
return; // Other grammar checks do not apply to type-only imports with resolution mode assertions
|
|
85290
85336
|
}
|
|
@@ -92940,8 +92986,8 @@ var ts;
|
|
|
92940
92986
|
// Note when updating logic here also update getEntityNameForDecoratorMetadata
|
|
92941
92987
|
// so that aliases can be marked as referenced
|
|
92942
92988
|
var serializedUnion;
|
|
92943
|
-
for (var _i = 0,
|
|
92944
|
-
var typeNode =
|
|
92989
|
+
for (var _i = 0, types_22 = types; _i < types_22.length; _i++) {
|
|
92990
|
+
var typeNode = types_22[_i];
|
|
92945
92991
|
while (typeNode.kind === 191 /* ParenthesizedType */) {
|
|
92946
92992
|
typeNode = typeNode.type; // Skip parens if need be
|
|
92947
92993
|
}
|
|
@@ -108143,7 +108189,8 @@ var ts;
|
|
|
108143
108189
|
trackReferencedAmbientModule: trackReferencedAmbientModule,
|
|
108144
108190
|
trackExternalModuleSymbolOfImportTypeNode: trackExternalModuleSymbolOfImportTypeNode,
|
|
108145
108191
|
reportNonlocalAugmentation: reportNonlocalAugmentation,
|
|
108146
|
-
reportNonSerializableProperty: reportNonSerializableProperty
|
|
108192
|
+
reportNonSerializableProperty: reportNonSerializableProperty,
|
|
108193
|
+
reportImportTypeNodeResolutionModeOverride: reportImportTypeNodeResolutionModeOverride,
|
|
108147
108194
|
};
|
|
108148
108195
|
var errorNameNode;
|
|
108149
108196
|
var errorFallbackNode;
|
|
@@ -108270,6 +108317,11 @@ var ts;
|
|
|
108270
108317
|
context.addDiagnostic(ts.createDiagnosticForNode((errorNameNode || errorFallbackNode), ts.Diagnostics.The_type_of_this_node_cannot_be_serialized_because_its_property_0_cannot_be_serialized, propertyName));
|
|
108271
108318
|
}
|
|
108272
108319
|
}
|
|
108320
|
+
function reportImportTypeNodeResolutionModeOverride() {
|
|
108321
|
+
if (!ts.isNightly() && (errorNameNode || errorFallbackNode)) {
|
|
108322
|
+
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));
|
|
108323
|
+
}
|
|
108324
|
+
}
|
|
108273
108325
|
function transformDeclarationsForJS(sourceFile, bundled) {
|
|
108274
108326
|
var oldDiag = getSymbolAccessibilityDiagnostic;
|
|
108275
108327
|
getSymbolAccessibilityDiagnostic = function (s) { return (s.errorNode && ts.canProduceDiagnostics(s.errorNode) ? ts.createGetSymbolAccessibilityDiagnosticForNode(s.errorNode)(s) : ({
|
|
@@ -108720,7 +108772,7 @@ var ts;
|
|
|
108720
108772
|
var mode = ts.getResolutionModeOverrideForClause(assertClause);
|
|
108721
108773
|
if (mode !== undefined) {
|
|
108722
108774
|
if (!ts.isNightly()) {
|
|
108723
|
-
context.addDiagnostic(ts.createDiagnosticForNode(assertClause, ts.Diagnostics.
|
|
108775
|
+
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));
|
|
108724
108776
|
}
|
|
108725
108777
|
return assertClause;
|
|
108726
108778
|
}
|
|
@@ -113556,8 +113608,8 @@ var ts;
|
|
|
113556
113608
|
bundleFileInfo.sections.push({ pos: pos, end: writer.getTextPos(), kind: "reference" /* Reference */, data: directive.fileName });
|
|
113557
113609
|
writeLine();
|
|
113558
113610
|
}
|
|
113559
|
-
for (var _d = 0,
|
|
113560
|
-
var directive =
|
|
113611
|
+
for (var _d = 0, types_23 = types; _d < types_23.length; _d++) {
|
|
113612
|
+
var directive = types_23[_d];
|
|
113561
113613
|
var pos = writer.getTextPos();
|
|
113562
113614
|
var resolutionMode = directive.resolutionMode && directive.resolutionMode !== (currentSourceFile === null || currentSourceFile === void 0 ? void 0 : currentSourceFile.impliedNodeFormat)
|
|
113563
113615
|
? "resolution-mode=\"" + (directive.resolutionMode === ts.ModuleKind.ESNext ? "import" : "require") + "\""
|
|
@@ -116229,12 +116281,14 @@ var ts;
|
|
|
116229
116281
|
}
|
|
116230
116282
|
ts.loadWithTypeDirectiveCache = loadWithTypeDirectiveCache;
|
|
116231
116283
|
;
|
|
116232
|
-
|
|
116284
|
+
/**
|
|
116285
|
+
* Calculates the resulting resolution mode for some reference in some file - this is generally the explicitly
|
|
116286
|
+
* provided resolution mode in the reference, unless one is not present, in which case it is the mode of the containing file.
|
|
116287
|
+
*/
|
|
116233
116288
|
function getModeForFileReference(ref, containingFileMode) {
|
|
116234
116289
|
return (ts.isString(ref) ? containingFileMode : ref.resolutionMode) || containingFileMode;
|
|
116235
116290
|
}
|
|
116236
116291
|
ts.getModeForFileReference = getModeForFileReference;
|
|
116237
|
-
/* @internal */
|
|
116238
116292
|
function getModeForResolutionAtIndex(file, index) {
|
|
116239
116293
|
if (file.impliedNodeFormat === undefined)
|
|
116240
116294
|
return undefined;
|
|
@@ -116255,7 +116309,15 @@ var ts;
|
|
|
116255
116309
|
return false;
|
|
116256
116310
|
}
|
|
116257
116311
|
ts.isExclusivelyTypeOnlyImportOrExport = isExclusivelyTypeOnlyImportOrExport;
|
|
116258
|
-
|
|
116312
|
+
/**
|
|
116313
|
+
* Calculates the final resolution mode for a given module reference node. This is generally the explicitly provided resolution mode, if
|
|
116314
|
+
* one exists, or the mode of the containing source file. (Excepting import=require, which is always commonjs, and dynamic import, which is always esm).
|
|
116315
|
+
* Notably, this function always returns `undefined` if the containing file has an `undefined` `impliedNodeFormat` - this field is only set when
|
|
116316
|
+
* `moduleResolution` is `node16`+.
|
|
116317
|
+
* @param file The file the import or import-like reference is contained within
|
|
116318
|
+
* @param usage The module reference string
|
|
116319
|
+
* @returns The final resolution mode of the import
|
|
116320
|
+
*/
|
|
116259
116321
|
function getModeForUsageLocation(file, usage) {
|
|
116260
116322
|
var _a, _b;
|
|
116261
116323
|
if (file.impliedNodeFormat === undefined)
|
|
@@ -118491,7 +118553,7 @@ var ts;
|
|
|
118491
118553
|
ts.setResolvedTypeReferenceDirective(file, fileName, resolvedTypeReferenceDirective);
|
|
118492
118554
|
var mode = ref.resolutionMode || file.impliedNodeFormat;
|
|
118493
118555
|
if (mode && ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.Node16 && ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.NodeNext) {
|
|
118494
|
-
programDiagnostics.add(ts.createDiagnosticForRange(file, ref, ts.Diagnostics.
|
|
118556
|
+
programDiagnostics.add(ts.createDiagnosticForRange(file, ref, ts.Diagnostics.resolution_mode_assertions_are_only_supported_when_moduleResolution_is_node16_or_nodenext));
|
|
118495
118557
|
}
|
|
118496
118558
|
processTypeReferenceDirective(fileName, mode, resolvedTypeReferenceDirective, { kind: ts.FileIncludeKind.TypeReferenceDirective, file: file.path, index: index, });
|
|
118497
118559
|
}
|
|
@@ -122325,7 +122387,7 @@ var ts;
|
|
|
122325
122387
|
});
|
|
122326
122388
|
// Sort by paths closest to importing file Name directory
|
|
122327
122389
|
var sortedPaths = [];
|
|
122328
|
-
var
|
|
122390
|
+
var _loop_34 = function (directory) {
|
|
122329
122391
|
var directoryStart = ts.ensureTrailingDirectorySeparator(directory);
|
|
122330
122392
|
var pathsInDirectory;
|
|
122331
122393
|
allFileNames.forEach(function (_a, fileName) {
|
|
@@ -122349,9 +122411,9 @@ var ts;
|
|
|
122349
122411
|
};
|
|
122350
122412
|
var out_directory_1;
|
|
122351
122413
|
for (var directory = ts.getDirectoryPath(importingFileName); allFileNames.size !== 0;) {
|
|
122352
|
-
var
|
|
122414
|
+
var state_11 = _loop_34(directory);
|
|
122353
122415
|
directory = out_directory_1;
|
|
122354
|
-
if (
|
|
122416
|
+
if (state_11 === "break")
|
|
122355
122417
|
break;
|
|
122356
122418
|
}
|
|
122357
122419
|
if (allFileNames.size) {
|
|
@@ -144037,7 +144099,7 @@ var ts;
|
|
|
144037
144099
|
if (!ts.textSpanIntersectsWith(span, node.pos, node.getFullWidth())) {
|
|
144038
144100
|
return;
|
|
144039
144101
|
}
|
|
144040
|
-
if (ts.isTypeNode(node)) {
|
|
144102
|
+
if (ts.isTypeNode(node) && !ts.isExpressionWithTypeArguments(node)) {
|
|
144041
144103
|
return;
|
|
144042
144104
|
}
|
|
144043
144105
|
if (preferences.includeInlayVariableTypeHints && ts.isVariableDeclaration(node)) {
|
|
@@ -147148,7 +147210,6 @@ var ts;
|
|
|
147148
147210
|
case 280 /* JsxOpeningElement */:
|
|
147149
147211
|
case 281 /* JsxClosingElement */:
|
|
147150
147212
|
case 279 /* JsxSelfClosingElement */:
|
|
147151
|
-
case 228 /* ExpressionWithTypeArguments */:
|
|
147152
147213
|
return false;
|
|
147153
147214
|
}
|
|
147154
147215
|
break;
|
|
@@ -147318,7 +147379,7 @@ var ts;
|
|
|
147318
147379
|
var listEndToken = getCloseTokenForOpenToken(listStartToken);
|
|
147319
147380
|
if (listEndToken !== 0 /* Unknown */ && formattingScanner.isOnToken() && formattingScanner.getStartPos() < originalRange.end) {
|
|
147320
147381
|
var tokenInfo = formattingScanner.readTokenInfo(parent);
|
|
147321
|
-
if (tokenInfo.token.kind === 27 /* CommaToken */
|
|
147382
|
+
if (tokenInfo.token.kind === 27 /* CommaToken */) {
|
|
147322
147383
|
// consume the comma
|
|
147323
147384
|
consumeTokenAndAdvanceScanner(tokenInfo, parent, listDynamicIndentation, parent);
|
|
147324
147385
|
tokenInfo = formattingScanner.isOnToken() ? formattingScanner.readTokenInfo(parent) : undefined;
|
|
@@ -147722,6 +147783,12 @@ var ts;
|
|
|
147722
147783
|
case 169 /* MethodDeclaration */:
|
|
147723
147784
|
case 168 /* MethodSignature */:
|
|
147724
147785
|
case 214 /* ArrowFunction */:
|
|
147786
|
+
case 174 /* CallSignature */:
|
|
147787
|
+
case 175 /* ConstructSignature */:
|
|
147788
|
+
case 179 /* FunctionType */:
|
|
147789
|
+
case 180 /* ConstructorType */:
|
|
147790
|
+
case 172 /* GetAccessor */:
|
|
147791
|
+
case 173 /* SetAccessor */:
|
|
147725
147792
|
if (node.typeParameters === list) {
|
|
147726
147793
|
return 29 /* LessThanToken */;
|
|
147727
147794
|
}
|
|
@@ -147738,7 +147805,19 @@ var ts;
|
|
|
147738
147805
|
return 20 /* OpenParenToken */;
|
|
147739
147806
|
}
|
|
147740
147807
|
break;
|
|
147808
|
+
case 257 /* ClassDeclaration */:
|
|
147809
|
+
case 226 /* ClassExpression */:
|
|
147810
|
+
case 258 /* InterfaceDeclaration */:
|
|
147811
|
+
case 259 /* TypeAliasDeclaration */:
|
|
147812
|
+
if (node.typeParameters === list) {
|
|
147813
|
+
return 29 /* LessThanToken */;
|
|
147814
|
+
}
|
|
147815
|
+
break;
|
|
147741
147816
|
case 178 /* TypeReference */:
|
|
147817
|
+
case 210 /* TaggedTemplateExpression */:
|
|
147818
|
+
case 181 /* TypeQuery */:
|
|
147819
|
+
case 228 /* ExpressionWithTypeArguments */:
|
|
147820
|
+
case 200 /* ImportType */:
|
|
147742
147821
|
if (node.typeArguments === list) {
|
|
147743
147822
|
return 29 /* LessThanToken */;
|
|
147744
147823
|
}
|