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
|
@@ -294,7 +294,7 @@ var ts;
|
|
|
294
294
|
// The following is baselined as a literal template type without intervention
|
|
295
295
|
/** The version of the TypeScript compiler release */
|
|
296
296
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
297
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
297
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220603";
|
|
298
298
|
/* @internal */
|
|
299
299
|
var Comparison;
|
|
300
300
|
(function (Comparison) {
|
|
@@ -8396,6 +8396,7 @@ var ts;
|
|
|
8396
8396
|
Decorators_are_not_valid_here: diag(1206, ts.DiagnosticCategory.Error, "Decorators_are_not_valid_here_1206", "Decorators are not valid here."),
|
|
8397
8397
|
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."),
|
|
8398
8398
|
_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."),
|
|
8399
|
+
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}()'?"),
|
|
8399
8400
|
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."),
|
|
8400
8401
|
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."),
|
|
8401
8402
|
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."),
|
|
@@ -8592,7 +8593,7 @@ var ts;
|
|
|
8592
8593
|
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."),
|
|
8593
8594
|
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"),
|
|
8594
8595
|
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"),
|
|
8595
|
-
|
|
8596
|
+
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`."),
|
|
8596
8597
|
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`."),
|
|
8597
8598
|
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."),
|
|
8598
8599
|
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."),
|
|
@@ -9099,6 +9100,8 @@ var ts;
|
|
|
9099
9100
|
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."),
|
|
9100
9101
|
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."),
|
|
9101
9102
|
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."),
|
|
9103
|
+
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"),
|
|
9104
|
+
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'."),
|
|
9102
9105
|
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}'."),
|
|
9103
9106
|
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}'."),
|
|
9104
9107
|
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}'."),
|
|
@@ -9206,7 +9209,7 @@ var ts;
|
|
|
9206
9209
|
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}'."),
|
|
9207
9210
|
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}'?"),
|
|
9208
9211
|
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'."),
|
|
9209
|
-
|
|
9212
|
+
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'."),
|
|
9210
9213
|
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."),
|
|
9211
9214
|
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."),
|
|
9212
9215
|
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}'."),
|
|
@@ -16247,6 +16250,8 @@ var ts;
|
|
|
16247
16250
|
case 218 /* AwaitExpression */:
|
|
16248
16251
|
case 231 /* MetaProperty */:
|
|
16249
16252
|
return true;
|
|
16253
|
+
case 228 /* ExpressionWithTypeArguments */:
|
|
16254
|
+
return !ts.isHeritageClause(node.parent);
|
|
16250
16255
|
case 161 /* QualifiedName */:
|
|
16251
16256
|
while (node.parent.kind === 161 /* QualifiedName */) {
|
|
16252
16257
|
node = node.parent;
|
|
@@ -29280,6 +29285,10 @@ var ts;
|
|
|
29280
29285
|
return node.kind === 267 /* ImportClause */;
|
|
29281
29286
|
}
|
|
29282
29287
|
ts.isImportClause = isImportClause;
|
|
29288
|
+
function isImportTypeAssertionContainer(node) {
|
|
29289
|
+
return node.kind === 295 /* ImportTypeAssertionContainer */;
|
|
29290
|
+
}
|
|
29291
|
+
ts.isImportTypeAssertionContainer = isImportTypeAssertionContainer;
|
|
29283
29292
|
function isAssertClause(node) {
|
|
29284
29293
|
return node.kind === 293 /* AssertClause */;
|
|
29285
29294
|
}
|
|
@@ -35852,6 +35861,9 @@ var ts;
|
|
|
35852
35861
|
typeArguments = expression.typeArguments;
|
|
35853
35862
|
expression = expression.expression;
|
|
35854
35863
|
}
|
|
35864
|
+
if (token() === 28 /* QuestionDotToken */) {
|
|
35865
|
+
parseErrorAtCurrentToken(ts.Diagnostics.Invalid_optional_chain_from_new_expression_Did_you_mean_to_call_0, ts.getTextOfNodeFromSourceText(sourceText, expression));
|
|
35866
|
+
}
|
|
35855
35867
|
var argumentList = token() === 20 /* OpenParenToken */ ? parseArgumentList() : undefined;
|
|
35856
35868
|
return finishNode(factory.createNewExpression(expression, typeArguments, argumentList), pos);
|
|
35857
35869
|
}
|
|
@@ -44043,13 +44055,36 @@ var ts;
|
|
|
44043
44055
|
}
|
|
44044
44056
|
return toSearchResult(/*value*/ undefined);
|
|
44045
44057
|
}
|
|
44058
|
+
/**
|
|
44059
|
+
* From https://github.com/nodejs/node/blob/8f39f51cbbd3b2de14b9ee896e26421cc5b20121/lib/internal/modules/esm/resolve.js#L722 -
|
|
44060
|
+
* "longest" has some nuance as to what "longest" means in the presence of pattern trailers
|
|
44061
|
+
*/
|
|
44062
|
+
function comparePatternKeys(a, b) {
|
|
44063
|
+
var aPatternIndex = a.indexOf("*");
|
|
44064
|
+
var bPatternIndex = b.indexOf("*");
|
|
44065
|
+
var baseLenA = aPatternIndex === -1 ? a.length : aPatternIndex + 1;
|
|
44066
|
+
var baseLenB = bPatternIndex === -1 ? b.length : bPatternIndex + 1;
|
|
44067
|
+
if (baseLenA > baseLenB)
|
|
44068
|
+
return -1;
|
|
44069
|
+
if (baseLenB > baseLenA)
|
|
44070
|
+
return 1;
|
|
44071
|
+
if (aPatternIndex === -1)
|
|
44072
|
+
return 1;
|
|
44073
|
+
if (bPatternIndex === -1)
|
|
44074
|
+
return -1;
|
|
44075
|
+
if (a.length > b.length)
|
|
44076
|
+
return -1;
|
|
44077
|
+
if (b.length > a.length)
|
|
44078
|
+
return 1;
|
|
44079
|
+
return 0;
|
|
44080
|
+
}
|
|
44046
44081
|
function loadModuleFromImportsOrExports(extensions, state, cache, redirectedReference, moduleName, lookupTable, scope, isImports) {
|
|
44047
44082
|
var loadModuleFromTargetImportOrExport = getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirectedReference, moduleName, scope, isImports);
|
|
44048
44083
|
if (!ts.endsWith(moduleName, ts.directorySeparator) && moduleName.indexOf("*") === -1 && ts.hasProperty(lookupTable, moduleName)) {
|
|
44049
44084
|
var target = lookupTable[moduleName];
|
|
44050
44085
|
return loadModuleFromTargetImportOrExport(target, /*subpath*/ "", /*pattern*/ false);
|
|
44051
44086
|
}
|
|
44052
|
-
var expandingKeys = ts.sort(ts.filter(ts.getOwnKeys(lookupTable), function (k) { return k.indexOf("*") !== -1 || ts.endsWith(k, "/"); }),
|
|
44087
|
+
var expandingKeys = ts.sort(ts.filter(ts.getOwnKeys(lookupTable), function (k) { return k.indexOf("*") !== -1 || ts.endsWith(k, "/"); }), comparePatternKeys);
|
|
44053
44088
|
for (var _i = 0, expandingKeys_1 = expandingKeys; _i < expandingKeys_1.length; _i++) {
|
|
44054
44089
|
var potentialTarget = expandingKeys_1[_i];
|
|
44055
44090
|
if (state.features & NodeResolutionFeatures.ExportsPatternTrailers && matchesPatternWithTrailer(potentialTarget, moduleName)) {
|
|
@@ -44368,8 +44403,8 @@ var ts;
|
|
|
44368
44403
|
var pathAndExtension = loadModuleFromFile(extensions, candidate, onlyRecordFailures, state) ||
|
|
44369
44404
|
loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageInfo && packageInfo.packageJsonContent, packageInfo && packageInfo.versionPaths);
|
|
44370
44405
|
if (!pathAndExtension && packageInfo
|
|
44371
|
-
|
|
44372
|
-
&& packageInfo.packageJsonContent.
|
|
44406
|
+
// eslint-disable-next-line no-null/no-null
|
|
44407
|
+
&& (packageInfo.packageJsonContent.exports === undefined || packageInfo.packageJsonContent.exports === null)
|
|
44373
44408
|
&& state.features & NodeResolutionFeatures.EsmMode) {
|
|
44374
44409
|
// EsmMode disables index lookup in `loadNodeModuleFromDirectoryWorker` generally, however non-relative package resolutions still assume
|
|
44375
44410
|
// a default `index.js` entrypoint if no `main` or `exports` are present
|
|
@@ -48034,7 +48069,10 @@ var ts;
|
|
|
48034
48069
|
TypeFacts[TypeFacts["NEUndefinedOrNull"] = 2097152] = "NEUndefinedOrNull";
|
|
48035
48070
|
TypeFacts[TypeFacts["Truthy"] = 4194304] = "Truthy";
|
|
48036
48071
|
TypeFacts[TypeFacts["Falsy"] = 8388608] = "Falsy";
|
|
48037
|
-
TypeFacts[TypeFacts["
|
|
48072
|
+
TypeFacts[TypeFacts["IsUndefined"] = 16777216] = "IsUndefined";
|
|
48073
|
+
TypeFacts[TypeFacts["IsNull"] = 33554432] = "IsNull";
|
|
48074
|
+
TypeFacts[TypeFacts["IsUndefinedOrNull"] = 50331648] = "IsUndefinedOrNull";
|
|
48075
|
+
TypeFacts[TypeFacts["All"] = 134217727] = "All";
|
|
48038
48076
|
// The following members encode facts about particular kinds of types for use in the getTypeFacts function.
|
|
48039
48077
|
// The presence of a particular fact means that the given test is true for some (and possibly all) values
|
|
48040
48078
|
// of that kind of type.
|
|
@@ -48076,14 +48114,16 @@ var ts;
|
|
|
48076
48114
|
TypeFacts[TypeFacts["ObjectFacts"] = 16736160] = "ObjectFacts";
|
|
48077
48115
|
TypeFacts[TypeFacts["FunctionStrictFacts"] = 7880640] = "FunctionStrictFacts";
|
|
48078
48116
|
TypeFacts[TypeFacts["FunctionFacts"] = 16728000] = "FunctionFacts";
|
|
48079
|
-
TypeFacts[TypeFacts["
|
|
48080
|
-
TypeFacts[TypeFacts["
|
|
48081
|
-
TypeFacts[TypeFacts["
|
|
48117
|
+
TypeFacts[TypeFacts["VoidFacts"] = 9830144] = "VoidFacts";
|
|
48118
|
+
TypeFacts[TypeFacts["UndefinedFacts"] = 26607360] = "UndefinedFacts";
|
|
48119
|
+
TypeFacts[TypeFacts["NullFacts"] = 42917664] = "NullFacts";
|
|
48120
|
+
TypeFacts[TypeFacts["EmptyObjectStrictFacts"] = 83427327] = "EmptyObjectStrictFacts";
|
|
48121
|
+
TypeFacts[TypeFacts["EmptyObjectFacts"] = 83886079] = "EmptyObjectFacts";
|
|
48122
|
+
TypeFacts[TypeFacts["UnknownFacts"] = 83886079] = "UnknownFacts";
|
|
48082
48123
|
TypeFacts[TypeFacts["AllTypeofNE"] = 556800] = "AllTypeofNE";
|
|
48083
|
-
TypeFacts[TypeFacts["EmptyObjectFacts"] = 16777215] = "EmptyObjectFacts";
|
|
48084
48124
|
// Masks
|
|
48085
48125
|
TypeFacts[TypeFacts["OrFactsMask"] = 8256] = "OrFactsMask";
|
|
48086
|
-
TypeFacts[TypeFacts["AndFactsMask"] =
|
|
48126
|
+
TypeFacts[TypeFacts["AndFactsMask"] = 134209471] = "AndFactsMask";
|
|
48087
48127
|
})(TypeFacts || (TypeFacts = {}));
|
|
48088
48128
|
var typeofEQFacts = new ts.Map(ts.getEntries({
|
|
48089
48129
|
string: 1 /* TypeofEQString */,
|
|
@@ -50247,7 +50287,12 @@ var ts;
|
|
|
50247
50287
|
function checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning) {
|
|
50248
50288
|
if (meaning & (111551 /* Value */ & ~1024 /* NamespaceModule */)) {
|
|
50249
50289
|
if (isPrimitiveTypeName(name)) {
|
|
50250
|
-
|
|
50290
|
+
if (isExtendedByInterface(errorLocation)) {
|
|
50291
|
+
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));
|
|
50292
|
+
}
|
|
50293
|
+
else {
|
|
50294
|
+
error(errorLocation, ts.Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here, ts.unescapeLeadingUnderscores(name));
|
|
50295
|
+
}
|
|
50251
50296
|
return true;
|
|
50252
50297
|
}
|
|
50253
50298
|
var symbol = resolveSymbol(resolveName(errorLocation, name, 788968 /* Type */ & ~111551 /* Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false));
|
|
@@ -50267,6 +50312,16 @@ var ts;
|
|
|
50267
50312
|
}
|
|
50268
50313
|
return false;
|
|
50269
50314
|
}
|
|
50315
|
+
function isExtendedByInterface(node) {
|
|
50316
|
+
var grandparent = node.parent.parent;
|
|
50317
|
+
var parentOfGrandparent = grandparent.parent;
|
|
50318
|
+
if (grandparent && parentOfGrandparent) {
|
|
50319
|
+
var isExtending = ts.isHeritageClause(grandparent) && grandparent.token === 94 /* ExtendsKeyword */;
|
|
50320
|
+
var isInterface = ts.isInterfaceDeclaration(parentOfGrandparent);
|
|
50321
|
+
return isExtending && isInterface;
|
|
50322
|
+
}
|
|
50323
|
+
return false;
|
|
50324
|
+
}
|
|
50270
50325
|
function maybeMappedType(node, symbol) {
|
|
50271
50326
|
var container = ts.findAncestor(node.parent, function (n) {
|
|
50272
50327
|
return ts.isComputedPropertyName(n) || ts.isPropertySignature(n) ? false : ts.isTypeLiteralNode(n) || "quit";
|
|
@@ -53107,7 +53162,7 @@ var ts;
|
|
|
53107
53162
|
anyType : getNonMissingTypeOfSymbol(propertySymbol);
|
|
53108
53163
|
var saveEnclosingDeclaration = context.enclosingDeclaration;
|
|
53109
53164
|
context.enclosingDeclaration = undefined;
|
|
53110
|
-
if (context.tracker.trackSymbol &&
|
|
53165
|
+
if (context.tracker.trackSymbol && isLateBoundName(propertySymbol.escapedName)) {
|
|
53111
53166
|
if (propertySymbol.declarations) {
|
|
53112
53167
|
var decl = ts.first(propertySymbol.declarations);
|
|
53113
53168
|
if (hasLateBindableName(decl)) {
|
|
@@ -53608,6 +53663,7 @@ var ts;
|
|
|
53608
53663
|
return symbol.parent ? ts.factory.createQualifiedName(symbolToEntityNameNode(symbol.parent), identifier) : identifier;
|
|
53609
53664
|
}
|
|
53610
53665
|
function symbolToTypeNode(symbol, context, meaning, overrideTypeArguments) {
|
|
53666
|
+
var _a, _b, _c, _d;
|
|
53611
53667
|
var chain = lookupSymbolChain(symbol, context, meaning, !(context.flags & 16384 /* UseAliasDefinedOutsideCurrentScope */)); // If we're using aliases outside the current scope, dont bother with the module
|
|
53612
53668
|
var isTypeOf = meaning === 111551 /* Value */;
|
|
53613
53669
|
if (ts.some(chain[0].declarations, hasNonGlobalAugmentationExternalModuleSymbol)) {
|
|
@@ -53625,6 +53681,7 @@ var ts;
|
|
|
53625
53681
|
assertion = ts.factory.createImportTypeAssertionContainer(ts.factory.createAssertClause(ts.factory.createNodeArray([
|
|
53626
53682
|
ts.factory.createAssertEntry(ts.factory.createStringLiteral("resolution-mode"), ts.factory.createStringLiteral("import"))
|
|
53627
53683
|
])));
|
|
53684
|
+
(_b = (_a = context.tracker).reportImportTypeNodeResolutionModeOverride) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
53628
53685
|
}
|
|
53629
53686
|
}
|
|
53630
53687
|
if (!specifier) {
|
|
@@ -53644,6 +53701,7 @@ var ts;
|
|
|
53644
53701
|
assertion = ts.factory.createImportTypeAssertionContainer(ts.factory.createAssertClause(ts.factory.createNodeArray([
|
|
53645
53702
|
ts.factory.createAssertEntry(ts.factory.createStringLiteral("resolution-mode"), ts.factory.createStringLiteral(swappedMode === ts.ModuleKind.ESNext ? "import" : "require"))
|
|
53646
53703
|
])));
|
|
53704
|
+
(_d = (_c = context.tracker).reportImportTypeNodeResolutionModeOverride) === null || _d === void 0 ? void 0 : _d.call(_c);
|
|
53647
53705
|
}
|
|
53648
53706
|
}
|
|
53649
53707
|
if (!assertion) {
|
|
@@ -54791,7 +54849,7 @@ var ts;
|
|
|
54791
54849
|
? getBaseConstructorTypeOfClass(staticType)
|
|
54792
54850
|
: anyType;
|
|
54793
54851
|
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);
|
|
54794
|
-
var symbolProps =
|
|
54852
|
+
var symbolProps = getNonInheritedProperties(classType, baseTypes, getPropertiesOfType(classType));
|
|
54795
54853
|
var publicSymbolProps = ts.filter(symbolProps, function (s) {
|
|
54796
54854
|
// `valueDeclaration` could be undefined if inherited from
|
|
54797
54855
|
// a union/intersection base type, but inherited properties
|
|
@@ -55929,7 +55987,7 @@ var ts;
|
|
|
55929
55987
|
if (ts.getEffectiveTypeAnnotationNode(ts.walkUpBindingElementsAndPatterns(declaration))) {
|
|
55930
55988
|
// In strict null checking mode, if a default value of a non-undefined type is specified, remove
|
|
55931
55989
|
// undefined from the final type.
|
|
55932
|
-
return strictNullChecks && !(
|
|
55990
|
+
return strictNullChecks && !(getTypeFacts(checkDeclarationInitializer(declaration, 0 /* Normal */)) & 16777216 /* IsUndefined */) ? getNonUndefinedType(type) : type;
|
|
55933
55991
|
}
|
|
55934
55992
|
return widenTypeInferredFromInitializer(declaration, getUnionType([getNonUndefinedType(type), checkDeclarationInitializer(declaration, 0 /* Normal */)], 2 /* Subtype */));
|
|
55935
55993
|
}
|
|
@@ -59132,7 +59190,7 @@ var ts;
|
|
|
59132
59190
|
var objectType;
|
|
59133
59191
|
return !!(type.flags & 8388608 /* IndexedAccess */ && ts.getObjectFlags(objectType = type.objectType) & 32 /* Mapped */ &&
|
|
59134
59192
|
!isGenericMappedType(objectType) && isGenericIndexType(type.indexType) &&
|
|
59135
|
-
!objectType
|
|
59193
|
+
!(getMappedTypeModifiers(objectType) & 8 /* ExcludeOptional */) && !objectType.declaration.nameType);
|
|
59136
59194
|
}
|
|
59137
59195
|
/**
|
|
59138
59196
|
* For a type parameter, return the base constraint of the type parameter. For the string, number,
|
|
@@ -64424,7 +64482,7 @@ var ts;
|
|
|
64424
64482
|
var sourceSig = checkMode & 3 /* Callback */ ? undefined : getSingleCallSignature(getNonNullableType(sourceType));
|
|
64425
64483
|
var targetSig = checkMode & 3 /* Callback */ ? undefined : getSingleCallSignature(getNonNullableType(targetType));
|
|
64426
64484
|
var callbacks = sourceSig && targetSig && !getTypePredicateOfSignature(sourceSig) && !getTypePredicateOfSignature(targetSig) &&
|
|
64427
|
-
(
|
|
64485
|
+
(getTypeFacts(sourceType) & 50331648 /* IsUndefinedOrNull */) === (getTypeFacts(targetType) & 50331648 /* IsUndefinedOrNull */);
|
|
64428
64486
|
var related = callbacks ?
|
|
64429
64487
|
compareSignaturesRelated(targetSig, sourceSig, (checkMode & 8 /* StrictArity */) | (strictVariance ? 2 /* StrictCallback */ : 1 /* BivariantCallback */), reportErrors, errorReporter, incompatibleErrorReporter, compareTypes, reportUnreliableMarkers) :
|
|
64430
64488
|
!(checkMode & 3 /* Callback */) && !strictVariance && compareTypes(sourceType, targetType, /*reportErrors*/ false) || compareTypes(targetType, sourceType, reportErrors);
|
|
@@ -67642,30 +67700,8 @@ var ts;
|
|
|
67642
67700
|
var value = _a.value;
|
|
67643
67701
|
return value.base10Value === "0";
|
|
67644
67702
|
}
|
|
67645
|
-
function getFalsyFlagsOfTypes(types) {
|
|
67646
|
-
var result = 0;
|
|
67647
|
-
for (var _i = 0, types_14 = types; _i < types_14.length; _i++) {
|
|
67648
|
-
var t = types_14[_i];
|
|
67649
|
-
result |= getFalsyFlags(t);
|
|
67650
|
-
}
|
|
67651
|
-
return result;
|
|
67652
|
-
}
|
|
67653
|
-
// Returns the String, Number, Boolean, StringLiteral, NumberLiteral, BooleanLiteral, Void, Undefined, or Null
|
|
67654
|
-
// flags for the string, number, boolean, "", 0, false, void, undefined, or null types respectively. Returns
|
|
67655
|
-
// no flags for all other types (including non-falsy literal types).
|
|
67656
|
-
function getFalsyFlags(type) {
|
|
67657
|
-
var t = type.flags & 2097152 /* Intersection */ ? getBaseConstraintOrType(type) : type;
|
|
67658
|
-
return t.flags & 1048576 /* Union */ ? getFalsyFlagsOfTypes(t.types) :
|
|
67659
|
-
t.flags & 128 /* StringLiteral */ ? t.value === "" ? 128 /* StringLiteral */ : 0 :
|
|
67660
|
-
t.flags & 256 /* NumberLiteral */ ? t.value === 0 ? 256 /* NumberLiteral */ : 0 :
|
|
67661
|
-
t.flags & 2048 /* BigIntLiteral */ ? isZeroBigInt(t) ? 2048 /* BigIntLiteral */ : 0 :
|
|
67662
|
-
t.flags & 512 /* BooleanLiteral */ ? (t === falseType || t === regularFalseType) ? 512 /* BooleanLiteral */ : 0 :
|
|
67663
|
-
t.flags & 117724 /* PossiblyFalsy */;
|
|
67664
|
-
}
|
|
67665
67703
|
function removeDefinitelyFalsyTypes(type) {
|
|
67666
|
-
return
|
|
67667
|
-
filterType(type, function (t) { return !(getFalsyFlags(t) & 117632 /* DefinitelyFalsy */); }) :
|
|
67668
|
-
type;
|
|
67704
|
+
return filterType(type, function (t) { return !!(getTypeFacts(t) & 4194304 /* Truthy */); });
|
|
67669
67705
|
}
|
|
67670
67706
|
function extractDefinitelyFalsyTypes(type) {
|
|
67671
67707
|
return mapType(type, getDefinitelyFalsyPartOfType);
|
|
@@ -67708,14 +67744,7 @@ var ts;
|
|
|
67708
67744
|
getIntersectionType([type, emptyObjectType]);
|
|
67709
67745
|
}
|
|
67710
67746
|
function getNonNullableType(type) {
|
|
67711
|
-
|
|
67712
|
-
// First reduce away any constituents that are assignable to 'undefined' or 'null'. This not only eliminates
|
|
67713
|
-
// 'undefined' and 'null', but also higher-order types such as a type parameter 'U extends undefined | null'
|
|
67714
|
-
// that isn't eliminated by a NonNullable<T> instantiation.
|
|
67715
|
-
var reducedType = getTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
|
|
67716
|
-
return maybeTypeOfKind(reducedType, 465829888 /* Instantiable */) ? getGlobalNonNullableTypeInstantiation(reducedType) : reducedType;
|
|
67717
|
-
}
|
|
67718
|
-
return type;
|
|
67747
|
+
return strictNullChecks ? getAdjustedTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */) : type;
|
|
67719
67748
|
}
|
|
67720
67749
|
function addOptionalTypeMarker(type) {
|
|
67721
67750
|
return strictNullChecks ? getUnionType([type, optionalType]) : type;
|
|
@@ -68859,8 +68888,8 @@ var ts;
|
|
|
68859
68888
|
}
|
|
68860
68889
|
function getSingleTypeVariableFromIntersectionTypes(types) {
|
|
68861
68890
|
var typeVariable;
|
|
68862
|
-
for (var _i = 0,
|
|
68863
|
-
var type =
|
|
68891
|
+
for (var _i = 0, types_14 = types; _i < types_14.length; _i++) {
|
|
68892
|
+
var type = types_14[_i];
|
|
68864
68893
|
var t = type.flags & 2097152 /* Intersection */ && ts.find(type.types, function (t) { return !!getInferenceInfoForType(t); });
|
|
68865
68894
|
if (!t || typeVariable && t !== typeVariable) {
|
|
68866
68895
|
return undefined;
|
|
@@ -69613,8 +69642,8 @@ var ts;
|
|
|
69613
69642
|
}
|
|
69614
69643
|
}
|
|
69615
69644
|
};
|
|
69616
|
-
for (var _i = 0,
|
|
69617
|
-
var type =
|
|
69645
|
+
for (var _i = 0, types_15 = types; _i < types_15.length; _i++) {
|
|
69646
|
+
var type = types_15[_i];
|
|
69618
69647
|
var state_9 = _loop_24(type);
|
|
69619
69648
|
if (typeof state_9 === "object")
|
|
69620
69649
|
return state_9.value;
|
|
@@ -69729,14 +69758,16 @@ var ts;
|
|
|
69729
69758
|
return !!(resolved.callSignatures.length || resolved.constructSignatures.length ||
|
|
69730
69759
|
resolved.members.get("bind") && isTypeSubtypeOf(type, globalFunctionType));
|
|
69731
69760
|
}
|
|
69732
|
-
function getTypeFacts(type
|
|
69733
|
-
if (
|
|
69761
|
+
function getTypeFacts(type) {
|
|
69762
|
+
if (type.flags & (2097152 /* Intersection */ | 465829888 /* Instantiable */)) {
|
|
69763
|
+
type = getBaseConstraintOfType(type) || unknownType;
|
|
69764
|
+
}
|
|
69734
69765
|
var flags = type.flags;
|
|
69735
|
-
if (flags & 4 /* String */) {
|
|
69766
|
+
if (flags & (4 /* String */ | 268435456 /* StringMapping */)) {
|
|
69736
69767
|
return strictNullChecks ? 16317953 /* StringStrictFacts */ : 16776705 /* StringFacts */;
|
|
69737
69768
|
}
|
|
69738
|
-
if (flags & 128 /* StringLiteral */) {
|
|
69739
|
-
var isEmpty = type.value === "";
|
|
69769
|
+
if (flags & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */)) {
|
|
69770
|
+
var isEmpty = flags & 128 /* StringLiteral */ && type.value === "";
|
|
69740
69771
|
return strictNullChecks ?
|
|
69741
69772
|
isEmpty ? 12123649 /* EmptyStringStrictFacts */ : 7929345 /* NonEmptyStringStrictFacts */ :
|
|
69742
69773
|
isEmpty ? 12582401 /* EmptyStringFacts */ : 16776705 /* NonEmptyStringFacts */;
|
|
@@ -69768,20 +69799,20 @@ var ts;
|
|
|
69768
69799
|
(type === falseType || type === regularFalseType) ? 12580616 /* FalseFacts */ : 16774920 /* TrueFacts */;
|
|
69769
69800
|
}
|
|
69770
69801
|
if (flags & 524288 /* Object */) {
|
|
69771
|
-
if (ignoreObjects) {
|
|
69772
|
-
return 16768959 /* AndFactsMask */; // This is the identity element for computing type facts of intersection.
|
|
69773
|
-
}
|
|
69774
69802
|
return ts.getObjectFlags(type) & 16 /* Anonymous */ && isEmptyObjectType(type) ?
|
|
69775
|
-
strictNullChecks ?
|
|
69803
|
+
strictNullChecks ? 83427327 /* EmptyObjectStrictFacts */ : 83886079 /* EmptyObjectFacts */ :
|
|
69776
69804
|
isFunctionObjectType(type) ?
|
|
69777
69805
|
strictNullChecks ? 7880640 /* FunctionStrictFacts */ : 16728000 /* FunctionFacts */ :
|
|
69778
69806
|
strictNullChecks ? 7888800 /* ObjectStrictFacts */ : 16736160 /* ObjectFacts */;
|
|
69779
69807
|
}
|
|
69780
|
-
if (flags &
|
|
69781
|
-
return 9830144 /*
|
|
69808
|
+
if (flags & 16384 /* Void */) {
|
|
69809
|
+
return 9830144 /* VoidFacts */;
|
|
69810
|
+
}
|
|
69811
|
+
if (flags & 32768 /* Undefined */) {
|
|
69812
|
+
return 26607360 /* UndefinedFacts */;
|
|
69782
69813
|
}
|
|
69783
69814
|
if (flags & 65536 /* Null */) {
|
|
69784
|
-
return
|
|
69815
|
+
return 42917664 /* NullFacts */;
|
|
69785
69816
|
}
|
|
69786
69817
|
if (flags & 12288 /* ESSymbolLike */) {
|
|
69787
69818
|
return strictNullChecks ? 7925520 /* SymbolStrictFacts */ : 16772880 /* SymbolFacts */;
|
|
@@ -69792,38 +69823,39 @@ var ts;
|
|
|
69792
69823
|
if (flags & 131072 /* Never */) {
|
|
69793
69824
|
return 0 /* None */;
|
|
69794
69825
|
}
|
|
69795
|
-
if (flags & 465829888 /* Instantiable */) {
|
|
69796
|
-
return !isPatternLiteralType(type) ? getTypeFacts(getBaseConstraintOfType(type) || unknownType, ignoreObjects) :
|
|
69797
|
-
strictNullChecks ? 7929345 /* NonEmptyStringStrictFacts */ : 16776705 /* NonEmptyStringFacts */;
|
|
69798
|
-
}
|
|
69799
69826
|
if (flags & 1048576 /* Union */) {
|
|
69800
|
-
return ts.reduceLeft(type.types, function (facts, t) { return facts | getTypeFacts(t
|
|
69827
|
+
return ts.reduceLeft(type.types, function (facts, t) { return facts | getTypeFacts(t); }, 0 /* None */);
|
|
69801
69828
|
}
|
|
69802
69829
|
if (flags & 2097152 /* Intersection */) {
|
|
69803
|
-
|
|
69804
|
-
// presumably type tags. For example, in string & { __kind__: "name" } we ignore the object type.
|
|
69805
|
-
ignoreObjects || (ignoreObjects = maybeTypeOfKind(type, 131068 /* Primitive */));
|
|
69806
|
-
return getIntersectionTypeFacts(type, ignoreObjects);
|
|
69830
|
+
return getIntersectionTypeFacts(type);
|
|
69807
69831
|
}
|
|
69808
|
-
return
|
|
69832
|
+
return 83886079 /* UnknownFacts */;
|
|
69809
69833
|
}
|
|
69810
|
-
function getIntersectionTypeFacts(type
|
|
69834
|
+
function getIntersectionTypeFacts(type) {
|
|
69835
|
+
// When an intersection contains a primitive type we ignore object type constituents as they are
|
|
69836
|
+
// presumably type tags. For example, in string & { __kind__: "name" } we ignore the object type.
|
|
69837
|
+
var ignoreObjects = maybeTypeOfKind(type, 131068 /* Primitive */);
|
|
69811
69838
|
// When computing the type facts of an intersection type, certain type facts are computed as `and`
|
|
69812
69839
|
// and others are computed as `or`.
|
|
69813
69840
|
var oredFacts = 0 /* None */;
|
|
69814
|
-
var andedFacts =
|
|
69841
|
+
var andedFacts = 134217727 /* All */;
|
|
69815
69842
|
for (var _i = 0, _a = type.types; _i < _a.length; _i++) {
|
|
69816
69843
|
var t = _a[_i];
|
|
69817
|
-
|
|
69818
|
-
|
|
69819
|
-
|
|
69844
|
+
if (!(ignoreObjects && t.flags & 524288 /* Object */)) {
|
|
69845
|
+
var f = getTypeFacts(t);
|
|
69846
|
+
oredFacts |= f;
|
|
69847
|
+
andedFacts &= f;
|
|
69848
|
+
}
|
|
69820
69849
|
}
|
|
69821
|
-
return oredFacts & 8256 /* OrFactsMask */ | andedFacts &
|
|
69850
|
+
return oredFacts & 8256 /* OrFactsMask */ | andedFacts & 134209471 /* AndFactsMask */;
|
|
69822
69851
|
}
|
|
69823
69852
|
function getTypeWithFacts(type, include) {
|
|
69824
69853
|
return filterType(type, function (t) { return (getTypeFacts(t) & include) !== 0; });
|
|
69825
69854
|
}
|
|
69826
|
-
function
|
|
69855
|
+
// This function is similar to getTypeWithFacts, except that in strictNullChecks mode it replaces type
|
|
69856
|
+
// unknown with the union {} | null | undefined (and reduces that accordingly), and it intersects remaining
|
|
69857
|
+
// instantiable types with {}, {} | null, or {} | undefined in order to remove null and/or undefined.
|
|
69858
|
+
function getAdjustedTypeWithFacts(type, facts) {
|
|
69827
69859
|
var reduced = recombineUnknownType(getTypeWithFacts(strictNullChecks && type.flags & 2 /* Unknown */ ? unknownUnionType : type, facts));
|
|
69828
69860
|
if (strictNullChecks) {
|
|
69829
69861
|
switch (facts) {
|
|
@@ -70089,8 +70121,8 @@ var ts;
|
|
|
70089
70121
|
var types = origin && origin.flags & 1048576 /* Union */ ? origin.types : type.types;
|
|
70090
70122
|
var mappedTypes;
|
|
70091
70123
|
var changed = false;
|
|
70092
|
-
for (var _i = 0,
|
|
70093
|
-
var t =
|
|
70124
|
+
for (var _i = 0, types_16 = types; _i < types_16.length; _i++) {
|
|
70125
|
+
var t = types_16[_i];
|
|
70094
70126
|
var mapped = t.flags & 1048576 /* Union */ ? mapType(t, mapper, noReductions) : mapper(t);
|
|
70095
70127
|
changed || (changed = t !== mapped);
|
|
70096
70128
|
if (mapped) {
|
|
@@ -70176,8 +70208,8 @@ var ts;
|
|
|
70176
70208
|
}
|
|
70177
70209
|
function isEvolvingArrayTypeList(types) {
|
|
70178
70210
|
var hasEvolvingArrayType = false;
|
|
70179
|
-
for (var _i = 0,
|
|
70180
|
-
var t =
|
|
70211
|
+
for (var _i = 0, types_17 = types; _i < types_17.length; _i++) {
|
|
70212
|
+
var t = types_17[_i];
|
|
70181
70213
|
if (!(t.flags & 131072 /* Never */)) {
|
|
70182
70214
|
if (!(ts.getObjectFlags(t) & 256 /* EvolvingArray */)) {
|
|
70183
70215
|
return false;
|
|
@@ -71000,10 +71032,10 @@ var ts;
|
|
|
71000
71032
|
}
|
|
71001
71033
|
function narrowTypeByTruthiness(type, expr, assumeTrue) {
|
|
71002
71034
|
if (isMatchingReference(reference, expr)) {
|
|
71003
|
-
return
|
|
71035
|
+
return getAdjustedTypeWithFacts(type, assumeTrue ? 4194304 /* Truthy */ : 8388608 /* Falsy */);
|
|
71004
71036
|
}
|
|
71005
71037
|
if (strictNullChecks && assumeTrue && optionalChainContainsReference(expr, reference)) {
|
|
71006
|
-
type =
|
|
71038
|
+
type = getAdjustedTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
|
|
71007
71039
|
}
|
|
71008
71040
|
var access = getDiscriminantPropertyAccess(expr, type);
|
|
71009
71041
|
if (access) {
|
|
@@ -71143,7 +71175,7 @@ var ts;
|
|
|
71143
71175
|
// Note that we include any and unknown in the exclusion test because their domain includes null and undefined.
|
|
71144
71176
|
var removeNullable = equalsOperator !== assumeTrue && everyType(valueType, function (t) { return !!(t.flags & nullableFlags); }) ||
|
|
71145
71177
|
equalsOperator === assumeTrue && everyType(valueType, function (t) { return !(t.flags & (3 /* AnyOrUnknown */ | nullableFlags)); });
|
|
71146
|
-
return removeNullable ?
|
|
71178
|
+
return removeNullable ? getAdjustedTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */) : type;
|
|
71147
71179
|
}
|
|
71148
71180
|
function narrowTypeByEquality(type, operator, value, assumeTrue) {
|
|
71149
71181
|
if (type.flags & 1 /* Any */) {
|
|
@@ -71172,7 +71204,7 @@ var ts;
|
|
|
71172
71204
|
valueType.flags & 65536 /* Null */ ?
|
|
71173
71205
|
assumeTrue ? 131072 /* EQNull */ : 1048576 /* NENull */ :
|
|
71174
71206
|
assumeTrue ? 65536 /* EQUndefined */ : 524288 /* NEUndefined */;
|
|
71175
|
-
return
|
|
71207
|
+
return getAdjustedTypeWithFacts(type, facts);
|
|
71176
71208
|
}
|
|
71177
71209
|
if (assumeTrue) {
|
|
71178
71210
|
var filterFn = operator === 34 /* EqualsEqualsToken */ ?
|
|
@@ -71193,7 +71225,7 @@ var ts;
|
|
|
71193
71225
|
var target = getReferenceCandidate(typeOfExpr.expression);
|
|
71194
71226
|
if (!isMatchingReference(reference, target)) {
|
|
71195
71227
|
if (strictNullChecks && optionalChainContainsReference(target, reference) && assumeTrue === (literal.text !== "undefined")) {
|
|
71196
|
-
return
|
|
71228
|
+
return getAdjustedTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
|
|
71197
71229
|
}
|
|
71198
71230
|
return type;
|
|
71199
71231
|
}
|
|
@@ -71397,7 +71429,7 @@ var ts;
|
|
|
71397
71429
|
var left = getReferenceCandidate(expr.left);
|
|
71398
71430
|
if (!isMatchingReference(reference, left)) {
|
|
71399
71431
|
if (assumeTrue && strictNullChecks && optionalChainContainsReference(left, reference)) {
|
|
71400
|
-
return
|
|
71432
|
+
return getAdjustedTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
|
|
71401
71433
|
}
|
|
71402
71434
|
return type;
|
|
71403
71435
|
}
|
|
@@ -71485,7 +71517,7 @@ var ts;
|
|
|
71485
71517
|
}
|
|
71486
71518
|
if (strictNullChecks && assumeTrue && optionalChainContainsReference(predicateArgument, reference) &&
|
|
71487
71519
|
!(getTypeFacts(predicate.type) & 65536 /* EQUndefined */)) {
|
|
71488
|
-
type =
|
|
71520
|
+
type = getAdjustedTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
|
|
71489
71521
|
}
|
|
71490
71522
|
var access = getDiscriminantPropertyAccess(predicateArgument, type);
|
|
71491
71523
|
if (access) {
|
|
@@ -71542,7 +71574,7 @@ var ts;
|
|
|
71542
71574
|
}
|
|
71543
71575
|
function narrowTypeByOptionality(type, expr, assumePresent) {
|
|
71544
71576
|
if (isMatchingReference(reference, expr)) {
|
|
71545
|
-
return
|
|
71577
|
+
return getAdjustedTypeWithFacts(type, assumePresent ? 2097152 /* NEUndefinedOrNull */ : 262144 /* EQUndefinedOrNull */);
|
|
71546
71578
|
}
|
|
71547
71579
|
var access = getDiscriminantPropertyAccess(expr, type);
|
|
71548
71580
|
if (access) {
|
|
@@ -71628,8 +71660,8 @@ var ts;
|
|
|
71628
71660
|
var annotationIncludesUndefined = strictNullChecks &&
|
|
71629
71661
|
declaration.kind === 164 /* Parameter */ &&
|
|
71630
71662
|
declaration.initializer &&
|
|
71631
|
-
|
|
71632
|
-
!(
|
|
71663
|
+
getTypeFacts(declaredType) & 16777216 /* IsUndefined */ &&
|
|
71664
|
+
!(getTypeFacts(checkExpression(declaration.initializer)) & 16777216 /* IsUndefined */);
|
|
71633
71665
|
popTypeResolution();
|
|
71634
71666
|
return annotationIncludesUndefined ? getTypeWithFacts(declaredType, 524288 /* NEUndefined */) : declaredType;
|
|
71635
71667
|
}
|
|
@@ -71957,7 +71989,7 @@ var ts;
|
|
|
71957
71989
|
return convertAutoToAny(flowType);
|
|
71958
71990
|
}
|
|
71959
71991
|
}
|
|
71960
|
-
else if (!assumeInitialized && !(
|
|
71992
|
+
else if (!assumeInitialized && !(getTypeFacts(type) & 16777216 /* IsUndefined */) && getTypeFacts(flowType) & 16777216 /* IsUndefined */) {
|
|
71961
71993
|
error(node, ts.Diagnostics.Variable_0_is_used_before_being_assigned, symbolToString(symbol));
|
|
71962
71994
|
// Return the declared type to reduce follow-on errors
|
|
71963
71995
|
return type;
|
|
@@ -73486,8 +73518,8 @@ var ts;
|
|
|
73486
73518
|
}
|
|
73487
73519
|
var signatureList;
|
|
73488
73520
|
var types = type.types;
|
|
73489
|
-
for (var _i = 0,
|
|
73490
|
-
var current =
|
|
73521
|
+
for (var _i = 0, types_18 = types; _i < types_18.length; _i++) {
|
|
73522
|
+
var current = types_18[_i];
|
|
73491
73523
|
var signature = getContextualCallSignature(current, node);
|
|
73492
73524
|
if (signature) {
|
|
73493
73525
|
if (!signatureList) {
|
|
@@ -74649,19 +74681,19 @@ var ts;
|
|
|
74649
74681
|
return checkNonNullType(checkExpression(node), node);
|
|
74650
74682
|
}
|
|
74651
74683
|
function isNullableType(type) {
|
|
74652
|
-
return !!((
|
|
74684
|
+
return !!(getTypeFacts(type) & 50331648 /* IsUndefinedOrNull */);
|
|
74653
74685
|
}
|
|
74654
74686
|
function getNonNullableTypeIfNeeded(type) {
|
|
74655
74687
|
return isNullableType(type) ? getNonNullableType(type) : type;
|
|
74656
74688
|
}
|
|
74657
|
-
function reportObjectPossiblyNullOrUndefinedError(node,
|
|
74658
|
-
error(node,
|
|
74689
|
+
function reportObjectPossiblyNullOrUndefinedError(node, facts) {
|
|
74690
|
+
error(node, facts & 16777216 /* IsUndefined */ ? facts & 33554432 /* IsNull */ ?
|
|
74659
74691
|
ts.Diagnostics.Object_is_possibly_null_or_undefined :
|
|
74660
74692
|
ts.Diagnostics.Object_is_possibly_undefined :
|
|
74661
74693
|
ts.Diagnostics.Object_is_possibly_null);
|
|
74662
74694
|
}
|
|
74663
|
-
function reportCannotInvokePossiblyNullOrUndefinedError(node,
|
|
74664
|
-
error(node,
|
|
74695
|
+
function reportCannotInvokePossiblyNullOrUndefinedError(node, facts) {
|
|
74696
|
+
error(node, facts & 16777216 /* IsUndefined */ ? facts & 33554432 /* IsNull */ ?
|
|
74665
74697
|
ts.Diagnostics.Cannot_invoke_an_object_which_is_possibly_null_or_undefined :
|
|
74666
74698
|
ts.Diagnostics.Cannot_invoke_an_object_which_is_possibly_undefined :
|
|
74667
74699
|
ts.Diagnostics.Cannot_invoke_an_object_which_is_possibly_null);
|
|
@@ -74671,9 +74703,9 @@ var ts;
|
|
|
74671
74703
|
error(node, ts.Diagnostics.Object_is_of_type_unknown);
|
|
74672
74704
|
return errorType;
|
|
74673
74705
|
}
|
|
74674
|
-
var
|
|
74675
|
-
if (
|
|
74676
|
-
reportError(node,
|
|
74706
|
+
var facts = getTypeFacts(type);
|
|
74707
|
+
if (facts & 50331648 /* IsUndefinedOrNull */) {
|
|
74708
|
+
reportError(node, facts);
|
|
74677
74709
|
var t = getNonNullableType(type);
|
|
74678
74710
|
return t.flags & (98304 /* Nullable */ | 131072 /* Never */) ? errorType : t;
|
|
74679
74711
|
}
|
|
@@ -74968,7 +75000,7 @@ var ts;
|
|
|
74968
75000
|
assumeUninitialized = true;
|
|
74969
75001
|
}
|
|
74970
75002
|
var flowType = getFlowTypeOfReference(node, propType, assumeUninitialized ? getOptionalType(propType) : propType);
|
|
74971
|
-
if (assumeUninitialized && !(
|
|
75003
|
+
if (assumeUninitialized && !(getTypeFacts(propType) & 16777216 /* IsUndefined */) && getTypeFacts(flowType) & 16777216 /* IsUndefined */) {
|
|
74972
75004
|
error(errorNode, ts.Diagnostics.Property_0_is_used_before_being_assigned, symbolToString(prop)); // TODO: GH#18217
|
|
74973
75005
|
// Return the declared type to reduce follow-on errors
|
|
74974
75006
|
return propType;
|
|
@@ -76884,8 +76916,8 @@ var ts;
|
|
|
76884
76916
|
if (apparentType.flags & 1048576 /* Union */) {
|
|
76885
76917
|
var types = apparentType.types;
|
|
76886
76918
|
var hasSignatures = false;
|
|
76887
|
-
for (var _i = 0,
|
|
76888
|
-
var constituent =
|
|
76919
|
+
for (var _i = 0, types_19 = types; _i < types_19.length; _i++) {
|
|
76920
|
+
var constituent = types_19[_i];
|
|
76889
76921
|
var signatures = getSignaturesOfType(constituent, kind);
|
|
76890
76922
|
if (signatures.length !== 0) {
|
|
76891
76923
|
hasSignatures = true;
|
|
@@ -78576,7 +78608,7 @@ var ts;
|
|
|
78576
78608
|
var type = getTypeOfSymbol(symbol);
|
|
78577
78609
|
if (strictNullChecks &&
|
|
78578
78610
|
!(type.flags & (3 /* AnyOrUnknown */ | 131072 /* Never */)) &&
|
|
78579
|
-
!(exactOptionalPropertyTypes ? symbol.flags & 16777216 /* Optional */ :
|
|
78611
|
+
!(exactOptionalPropertyTypes ? symbol.flags & 16777216 /* Optional */ : getTypeFacts(type) & 16777216 /* IsUndefined */)) {
|
|
78580
78612
|
error(expr, ts.Diagnostics.The_operand_of_a_delete_operator_must_be_optional);
|
|
78581
78613
|
}
|
|
78582
78614
|
}
|
|
@@ -78744,8 +78776,8 @@ var ts;
|
|
|
78744
78776
|
}
|
|
78745
78777
|
if (type.flags & 3145728 /* UnionOrIntersection */) {
|
|
78746
78778
|
var types = type.types;
|
|
78747
|
-
for (var _i = 0,
|
|
78748
|
-
var t =
|
|
78779
|
+
for (var _i = 0, types_20 = types; _i < types_20.length; _i++) {
|
|
78780
|
+
var t = types_20[_i];
|
|
78749
78781
|
if (maybeTypeOfKind(t, kind)) {
|
|
78750
78782
|
return true;
|
|
78751
78783
|
}
|
|
@@ -78972,7 +79004,7 @@ var ts;
|
|
|
78972
79004
|
// In strict null checking mode, if a default value of a non-undefined type is specified, remove
|
|
78973
79005
|
// undefined from the final type.
|
|
78974
79006
|
if (strictNullChecks &&
|
|
78975
|
-
!(
|
|
79007
|
+
!(getTypeFacts(checkExpression(prop.objectAssignmentInitializer)) & 16777216 /* IsUndefined */)) {
|
|
78976
79008
|
sourceType = getTypeWithFacts(sourceType, 524288 /* NEUndefined */);
|
|
78977
79009
|
}
|
|
78978
79010
|
checkBinaryLikeExpression(prop.name, prop.equalsToken, prop.objectAssignmentInitializer, checkMode);
|
|
@@ -78985,6 +79017,10 @@ var ts;
|
|
|
78985
79017
|
if (target.kind === 221 /* BinaryExpression */ && target.operatorToken.kind === 63 /* EqualsToken */) {
|
|
78986
79018
|
checkBinaryExpression(target, checkMode);
|
|
78987
79019
|
target = target.left;
|
|
79020
|
+
// A default value is specified, so remove undefined from the final type.
|
|
79021
|
+
if (strictNullChecks) {
|
|
79022
|
+
sourceType = getTypeWithFacts(sourceType, 524288 /* NEUndefined */);
|
|
79023
|
+
}
|
|
78988
79024
|
}
|
|
78989
79025
|
if (target.kind === 205 /* ObjectLiteralExpression */) {
|
|
78990
79026
|
return checkObjectLiteralAssignment(target, sourceType, rightIsThis);
|
|
@@ -79372,7 +79408,7 @@ var ts;
|
|
|
79372
79408
|
case 56 /* BarBarToken */:
|
|
79373
79409
|
case 75 /* BarBarEqualsToken */: {
|
|
79374
79410
|
var resultType_3 = getTypeFacts(leftType) & 8388608 /* Falsy */ ?
|
|
79375
|
-
getUnionType([removeDefinitelyFalsyTypes(leftType), rightType], 2 /* Subtype */) :
|
|
79411
|
+
getUnionType([getNonNullableType(removeDefinitelyFalsyTypes(leftType)), rightType], 2 /* Subtype */) :
|
|
79376
79412
|
leftType;
|
|
79377
79413
|
if (operator === 75 /* BarBarEqualsToken */) {
|
|
79378
79414
|
checkAssignmentOperator(rightType);
|
|
@@ -81075,8 +81111,11 @@ var ts;
|
|
|
81075
81111
|
if (node.assertions) {
|
|
81076
81112
|
var override = ts.getResolutionModeOverrideForClause(node.assertions.assertClause, grammarErrorOnNode);
|
|
81077
81113
|
if (override) {
|
|
81114
|
+
if (!ts.isNightly()) {
|
|
81115
|
+
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);
|
|
81116
|
+
}
|
|
81078
81117
|
if (ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.Node16 && ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.NodeNext) {
|
|
81079
|
-
grammarErrorOnNode(node.assertions.assertClause, ts.Diagnostics.
|
|
81118
|
+
grammarErrorOnNode(node.assertions.assertClause, ts.Diagnostics.resolution_mode_assertions_are_only_supported_when_moduleResolution_is_node16_or_nodenext);
|
|
81080
81119
|
}
|
|
81081
81120
|
}
|
|
81082
81121
|
}
|
|
@@ -81913,8 +81952,8 @@ var ts;
|
|
|
81913
81952
|
}
|
|
81914
81953
|
function getEntityNameForDecoratorMetadataFromTypeList(types) {
|
|
81915
81954
|
var commonEntityName;
|
|
81916
|
-
for (var _i = 0,
|
|
81917
|
-
var typeNode =
|
|
81955
|
+
for (var _i = 0, types_21 = types; _i < types_21.length; _i++) {
|
|
81956
|
+
var typeNode = types_21[_i];
|
|
81918
81957
|
while (typeNode.kind === 191 /* ParenthesizedType */ || typeNode.kind === 197 /* NamedTupleMember */) {
|
|
81919
81958
|
typeNode = typeNode.type; // Skip parens if need be
|
|
81920
81959
|
}
|
|
@@ -82780,7 +82819,7 @@ var ts;
|
|
|
82780
82819
|
// For a binding pattern, validate the initializer and exit
|
|
82781
82820
|
if (ts.isBindingPattern(node.name)) {
|
|
82782
82821
|
var needCheckInitializer = node.initializer && node.parent.parent.kind !== 243 /* ForInStatement */;
|
|
82783
|
-
var needCheckWidenedType = node.name.elements.
|
|
82822
|
+
var needCheckWidenedType = !ts.some(node.name.elements, ts.not(ts.isOmittedExpression));
|
|
82784
82823
|
if (needCheckInitializer || needCheckWidenedType) {
|
|
82785
82824
|
// Don't validate for-in initializer as it is already an error
|
|
82786
82825
|
var widenedType = getWidenedTypeForVariableLikeDeclaration(node);
|
|
@@ -82933,7 +82972,7 @@ var ts;
|
|
|
82933
82972
|
return;
|
|
82934
82973
|
var type = checkTruthinessExpression(location);
|
|
82935
82974
|
var isPropertyExpressionCast = ts.isPropertyAccessExpression(location) && isTypeAssertion(location.expression);
|
|
82936
|
-
if (
|
|
82975
|
+
if (!(getTypeFacts(type) & 4194304 /* Truthy */) || isPropertyExpressionCast)
|
|
82937
82976
|
return;
|
|
82938
82977
|
// While it technically should be invalid for any known-truthy value
|
|
82939
82978
|
// to be tested, we de-scope to functions and Promises unreferenced in
|
|
@@ -84619,18 +84658,17 @@ var ts;
|
|
|
84619
84658
|
// but not by other kinds of members.
|
|
84620
84659
|
// Base class instance member variables and accessors can be overridden by
|
|
84621
84660
|
// derived class instance member variables and accessors, but not by other kinds of members.
|
|
84622
|
-
var _a, _b;
|
|
84661
|
+
var _a, _b, _c, _d;
|
|
84623
84662
|
// NOTE: assignability is checked in checkClassDeclaration
|
|
84624
84663
|
var baseProperties = getPropertiesOfType(baseType);
|
|
84625
|
-
|
|
84626
|
-
var baseProperty = baseProperties_1[_i];
|
|
84664
|
+
var _loop_33 = function (baseProperty) {
|
|
84627
84665
|
var base = getTargetSymbol(baseProperty);
|
|
84628
84666
|
if (base.flags & 4194304 /* Prototype */) {
|
|
84629
|
-
continue;
|
|
84667
|
+
return "continue";
|
|
84630
84668
|
}
|
|
84631
84669
|
var baseSymbol = getPropertyOfObjectType(type, base.escapedName);
|
|
84632
84670
|
if (!baseSymbol) {
|
|
84633
|
-
continue;
|
|
84671
|
+
return "continue";
|
|
84634
84672
|
}
|
|
84635
84673
|
var derived = getTargetSymbol(baseSymbol);
|
|
84636
84674
|
var baseDeclarationFlags = ts.getDeclarationModifierFlagsFromSymbol(base);
|
|
@@ -84648,14 +84686,14 @@ var ts;
|
|
|
84648
84686
|
// Searches other base types for a declaration that would satisfy the inherited abstract member.
|
|
84649
84687
|
// (The class may have more than one base type via declaration merging with an interface with the
|
|
84650
84688
|
// same name.)
|
|
84651
|
-
for (var
|
|
84652
|
-
var otherBaseType =
|
|
84689
|
+
for (var _e = 0, _f = getBaseTypes(type); _e < _f.length; _e++) {
|
|
84690
|
+
var otherBaseType = _f[_e];
|
|
84653
84691
|
if (otherBaseType === baseType)
|
|
84654
84692
|
continue;
|
|
84655
84693
|
var baseSymbol_1 = getPropertyOfObjectType(otherBaseType, base.escapedName);
|
|
84656
84694
|
var derivedElsewhere = baseSymbol_1 && getTargetSymbol(baseSymbol_1);
|
|
84657
84695
|
if (derivedElsewhere && derivedElsewhere !== base) {
|
|
84658
|
-
continue
|
|
84696
|
+
return "continue-basePropertyCheck";
|
|
84659
84697
|
}
|
|
84660
84698
|
}
|
|
84661
84699
|
if (derivedClassDecl.kind === 226 /* ClassExpression */) {
|
|
@@ -84670,20 +84708,19 @@ var ts;
|
|
|
84670
84708
|
// derived overrides base.
|
|
84671
84709
|
var derivedDeclarationFlags = ts.getDeclarationModifierFlagsFromSymbol(derived);
|
|
84672
84710
|
if (baseDeclarationFlags & 8 /* Private */ || derivedDeclarationFlags & 8 /* Private */) {
|
|
84673
|
-
|
|
84674
|
-
continue;
|
|
84711
|
+
return "continue";
|
|
84675
84712
|
}
|
|
84676
84713
|
var errorMessage = void 0;
|
|
84677
84714
|
var basePropertyFlags = base.flags & 98308 /* PropertyOrAccessor */;
|
|
84678
84715
|
var derivedPropertyFlags = derived.flags & 98308 /* PropertyOrAccessor */;
|
|
84679
84716
|
if (basePropertyFlags && derivedPropertyFlags) {
|
|
84680
84717
|
// property/accessor is overridden with property/accessor
|
|
84681
|
-
if (
|
|
84682
|
-
|
|
84718
|
+
if ((ts.getCheckFlags(base) & 6 /* Synthetic */
|
|
84719
|
+
? (_a = base.declarations) === null || _a === void 0 ? void 0 : _a.some(function (d) { return isPropertyAbstractOrInterface(d, baseDeclarationFlags); })
|
|
84720
|
+
: (_b = base.declarations) === null || _b === void 0 ? void 0 : _b.every(function (d) { return isPropertyAbstractOrInterface(d, baseDeclarationFlags); }))
|
|
84721
|
+
|| ts.getCheckFlags(base) & 262144 /* Mapped */
|
|
84683
84722
|
|| derived.valueDeclaration && ts.isBinaryExpression(derived.valueDeclaration)) {
|
|
84684
|
-
|
|
84685
|
-
// same when the derived property is from an assignment
|
|
84686
|
-
continue;
|
|
84723
|
+
return "continue";
|
|
84687
84724
|
}
|
|
84688
84725
|
var overriddenInstanceProperty = basePropertyFlags !== 4 /* Property */ && derivedPropertyFlags === 4 /* Property */;
|
|
84689
84726
|
var overriddenInstanceAccessor = basePropertyFlags === 4 /* Property */ && derivedPropertyFlags !== 4 /* Property */;
|
|
@@ -84694,12 +84731,12 @@ var ts;
|
|
|
84694
84731
|
error(ts.getNameOfDeclaration(derived.valueDeclaration) || derived.valueDeclaration, errorMessage_1, symbolToString(base), typeToString(baseType), typeToString(type));
|
|
84695
84732
|
}
|
|
84696
84733
|
else if (useDefineForClassFields) {
|
|
84697
|
-
var uninitialized = (
|
|
84734
|
+
var uninitialized = (_c = derived.declarations) === null || _c === void 0 ? void 0 : _c.find(function (d) { return d.kind === 167 /* PropertyDeclaration */ && !d.initializer; });
|
|
84698
84735
|
if (uninitialized
|
|
84699
84736
|
&& !(derived.flags & 33554432 /* Transient */)
|
|
84700
84737
|
&& !(baseDeclarationFlags & 128 /* Abstract */)
|
|
84701
84738
|
&& !(derivedDeclarationFlags & 128 /* Abstract */)
|
|
84702
|
-
&& !((
|
|
84739
|
+
&& !((_d = derived.declarations) === null || _d === void 0 ? void 0 : _d.some(function (d) { return !!(d.flags & 16777216 /* Ambient */); }))) {
|
|
84703
84740
|
var constructor = findConstructorDeclaration(ts.getClassLikeDeclarationOfSymbol(type.symbol));
|
|
84704
84741
|
var propName = uninitialized.name;
|
|
84705
84742
|
if (uninitialized.exclamationToken
|
|
@@ -84712,13 +84749,11 @@ var ts;
|
|
|
84712
84749
|
}
|
|
84713
84750
|
}
|
|
84714
84751
|
}
|
|
84715
|
-
|
|
84716
|
-
continue;
|
|
84752
|
+
return "continue";
|
|
84717
84753
|
}
|
|
84718
84754
|
else if (isPrototypeProperty(base)) {
|
|
84719
84755
|
if (isPrototypeProperty(derived) || derived.flags & 4 /* Property */) {
|
|
84720
|
-
|
|
84721
|
-
continue;
|
|
84756
|
+
return "continue";
|
|
84722
84757
|
}
|
|
84723
84758
|
else {
|
|
84724
84759
|
ts.Debug.assert(!!(derived.flags & 98304 /* Accessor */));
|
|
@@ -84733,9 +84768,20 @@ var ts;
|
|
|
84733
84768
|
}
|
|
84734
84769
|
error(ts.getNameOfDeclaration(derived.valueDeclaration) || derived.valueDeclaration, errorMessage, typeToString(baseType), symbolToString(base), typeToString(type));
|
|
84735
84770
|
}
|
|
84771
|
+
};
|
|
84772
|
+
basePropertyCheck: for (var _i = 0, baseProperties_1 = baseProperties; _i < baseProperties_1.length; _i++) {
|
|
84773
|
+
var baseProperty = baseProperties_1[_i];
|
|
84774
|
+
var state_10 = _loop_33(baseProperty);
|
|
84775
|
+
switch (state_10) {
|
|
84776
|
+
case "continue-basePropertyCheck": continue basePropertyCheck;
|
|
84777
|
+
}
|
|
84736
84778
|
}
|
|
84737
84779
|
}
|
|
84738
|
-
function
|
|
84780
|
+
function isPropertyAbstractOrInterface(declaration, baseDeclarationFlags) {
|
|
84781
|
+
return baseDeclarationFlags & 128 /* Abstract */ && (!ts.isPropertyDeclaration(declaration) || !declaration.initializer)
|
|
84782
|
+
|| ts.isInterfaceDeclaration(declaration.parent);
|
|
84783
|
+
}
|
|
84784
|
+
function getNonInheritedProperties(type, baseTypes, properties) {
|
|
84739
84785
|
if (!ts.length(baseTypes)) {
|
|
84740
84786
|
return properties;
|
|
84741
84787
|
}
|
|
@@ -84804,7 +84850,7 @@ var ts;
|
|
|
84804
84850
|
var propName = member.name;
|
|
84805
84851
|
if (ts.isIdentifier(propName) || ts.isPrivateIdentifier(propName) || ts.isComputedPropertyName(propName)) {
|
|
84806
84852
|
var type = getTypeOfSymbol(getSymbolOfNode(member));
|
|
84807
|
-
if (!(type.flags & 3 /* AnyOrUnknown */ ||
|
|
84853
|
+
if (!(type.flags & 3 /* AnyOrUnknown */ || getTypeFacts(type) & 16777216 /* IsUndefined */)) {
|
|
84808
84854
|
if (!constructor || !isPropertyInitializedInConstructor(propName, type, constructor)) {
|
|
84809
84855
|
error(member.name, ts.Diagnostics.Property_0_has_no_initializer_and_is_not_definitely_assigned_in_the_constructor, ts.declarationNameToString(propName));
|
|
84810
84856
|
}
|
|
@@ -84829,7 +84875,7 @@ var ts;
|
|
|
84829
84875
|
ts.setParent(reference, staticBlock);
|
|
84830
84876
|
reference.flowNode = staticBlock.returnFlowNode;
|
|
84831
84877
|
var flowType = getFlowTypeOfReference(reference, propType, getOptionalType(propType));
|
|
84832
|
-
if (!(
|
|
84878
|
+
if (!(getTypeFacts(flowType) & 16777216 /* IsUndefined */)) {
|
|
84833
84879
|
return true;
|
|
84834
84880
|
}
|
|
84835
84881
|
}
|
|
@@ -84844,7 +84890,7 @@ var ts;
|
|
|
84844
84890
|
ts.setParent(reference, constructor);
|
|
84845
84891
|
reference.flowNode = constructor.returnFlowNode;
|
|
84846
84892
|
var flowType = getFlowTypeOfReference(reference, propType, getOptionalType(propType));
|
|
84847
|
-
return !(
|
|
84893
|
+
return !(getTypeFacts(flowType) & 16777216 /* IsUndefined */);
|
|
84848
84894
|
}
|
|
84849
84895
|
function checkInterfaceDeclaration(node) {
|
|
84850
84896
|
// Grammar checking
|
|
@@ -85475,10 +85521,10 @@ var ts;
|
|
|
85475
85521
|
var override = ts.getResolutionModeOverrideForClause(declaration.assertClause, validForTypeAssertions ? grammarErrorOnNode : undefined);
|
|
85476
85522
|
if (validForTypeAssertions && override) {
|
|
85477
85523
|
if (!ts.isNightly()) {
|
|
85478
|
-
grammarErrorOnNode(declaration.assertClause, ts.Diagnostics.
|
|
85524
|
+
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);
|
|
85479
85525
|
}
|
|
85480
85526
|
if (ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.Node16 && ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.NodeNext) {
|
|
85481
|
-
return grammarErrorOnNode(declaration.assertClause, ts.Diagnostics.
|
|
85527
|
+
return grammarErrorOnNode(declaration.assertClause, ts.Diagnostics.resolution_mode_assertions_are_only_supported_when_moduleResolution_is_node16_or_nodenext);
|
|
85482
85528
|
}
|
|
85483
85529
|
return; // Other grammar checks do not apply to type-only imports with resolution mode assertions
|
|
85484
85530
|
}
|
|
@@ -93134,8 +93180,8 @@ var ts;
|
|
|
93134
93180
|
// Note when updating logic here also update getEntityNameForDecoratorMetadata
|
|
93135
93181
|
// so that aliases can be marked as referenced
|
|
93136
93182
|
var serializedUnion;
|
|
93137
|
-
for (var _i = 0,
|
|
93138
|
-
var typeNode =
|
|
93183
|
+
for (var _i = 0, types_22 = types; _i < types_22.length; _i++) {
|
|
93184
|
+
var typeNode = types_22[_i];
|
|
93139
93185
|
while (typeNode.kind === 191 /* ParenthesizedType */) {
|
|
93140
93186
|
typeNode = typeNode.type; // Skip parens if need be
|
|
93141
93187
|
}
|
|
@@ -108337,7 +108383,8 @@ var ts;
|
|
|
108337
108383
|
trackReferencedAmbientModule: trackReferencedAmbientModule,
|
|
108338
108384
|
trackExternalModuleSymbolOfImportTypeNode: trackExternalModuleSymbolOfImportTypeNode,
|
|
108339
108385
|
reportNonlocalAugmentation: reportNonlocalAugmentation,
|
|
108340
|
-
reportNonSerializableProperty: reportNonSerializableProperty
|
|
108386
|
+
reportNonSerializableProperty: reportNonSerializableProperty,
|
|
108387
|
+
reportImportTypeNodeResolutionModeOverride: reportImportTypeNodeResolutionModeOverride,
|
|
108341
108388
|
};
|
|
108342
108389
|
var errorNameNode;
|
|
108343
108390
|
var errorFallbackNode;
|
|
@@ -108464,6 +108511,11 @@ var ts;
|
|
|
108464
108511
|
context.addDiagnostic(ts.createDiagnosticForNode((errorNameNode || errorFallbackNode), ts.Diagnostics.The_type_of_this_node_cannot_be_serialized_because_its_property_0_cannot_be_serialized, propertyName));
|
|
108465
108512
|
}
|
|
108466
108513
|
}
|
|
108514
|
+
function reportImportTypeNodeResolutionModeOverride() {
|
|
108515
|
+
if (!ts.isNightly() && (errorNameNode || errorFallbackNode)) {
|
|
108516
|
+
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));
|
|
108517
|
+
}
|
|
108518
|
+
}
|
|
108467
108519
|
function transformDeclarationsForJS(sourceFile, bundled) {
|
|
108468
108520
|
var oldDiag = getSymbolAccessibilityDiagnostic;
|
|
108469
108521
|
getSymbolAccessibilityDiagnostic = function (s) { return (s.errorNode && ts.canProduceDiagnostics(s.errorNode) ? ts.createGetSymbolAccessibilityDiagnosticForNode(s.errorNode)(s) : ({
|
|
@@ -108914,7 +108966,7 @@ var ts;
|
|
|
108914
108966
|
var mode = ts.getResolutionModeOverrideForClause(assertClause);
|
|
108915
108967
|
if (mode !== undefined) {
|
|
108916
108968
|
if (!ts.isNightly()) {
|
|
108917
|
-
context.addDiagnostic(ts.createDiagnosticForNode(assertClause, ts.Diagnostics.
|
|
108969
|
+
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));
|
|
108918
108970
|
}
|
|
108919
108971
|
return assertClause;
|
|
108920
108972
|
}
|
|
@@ -113750,8 +113802,8 @@ var ts;
|
|
|
113750
113802
|
bundleFileInfo.sections.push({ pos: pos, end: writer.getTextPos(), kind: "reference" /* Reference */, data: directive.fileName });
|
|
113751
113803
|
writeLine();
|
|
113752
113804
|
}
|
|
113753
|
-
for (var _d = 0,
|
|
113754
|
-
var directive =
|
|
113805
|
+
for (var _d = 0, types_23 = types; _d < types_23.length; _d++) {
|
|
113806
|
+
var directive = types_23[_d];
|
|
113755
113807
|
var pos = writer.getTextPos();
|
|
113756
113808
|
var resolutionMode = directive.resolutionMode && directive.resolutionMode !== (currentSourceFile === null || currentSourceFile === void 0 ? void 0 : currentSourceFile.impliedNodeFormat)
|
|
113757
113809
|
? "resolution-mode=\"" + (directive.resolutionMode === ts.ModuleKind.ESNext ? "import" : "require") + "\""
|
|
@@ -116423,12 +116475,14 @@ var ts;
|
|
|
116423
116475
|
}
|
|
116424
116476
|
ts.loadWithTypeDirectiveCache = loadWithTypeDirectiveCache;
|
|
116425
116477
|
;
|
|
116426
|
-
|
|
116478
|
+
/**
|
|
116479
|
+
* Calculates the resulting resolution mode for some reference in some file - this is generally the explicitly
|
|
116480
|
+
* provided resolution mode in the reference, unless one is not present, in which case it is the mode of the containing file.
|
|
116481
|
+
*/
|
|
116427
116482
|
function getModeForFileReference(ref, containingFileMode) {
|
|
116428
116483
|
return (ts.isString(ref) ? containingFileMode : ref.resolutionMode) || containingFileMode;
|
|
116429
116484
|
}
|
|
116430
116485
|
ts.getModeForFileReference = getModeForFileReference;
|
|
116431
|
-
/* @internal */
|
|
116432
116486
|
function getModeForResolutionAtIndex(file, index) {
|
|
116433
116487
|
if (file.impliedNodeFormat === undefined)
|
|
116434
116488
|
return undefined;
|
|
@@ -116449,7 +116503,15 @@ var ts;
|
|
|
116449
116503
|
return false;
|
|
116450
116504
|
}
|
|
116451
116505
|
ts.isExclusivelyTypeOnlyImportOrExport = isExclusivelyTypeOnlyImportOrExport;
|
|
116452
|
-
|
|
116506
|
+
/**
|
|
116507
|
+
* Calculates the final resolution mode for a given module reference node. This is generally the explicitly provided resolution mode, if
|
|
116508
|
+
* one exists, or the mode of the containing source file. (Excepting import=require, which is always commonjs, and dynamic import, which is always esm).
|
|
116509
|
+
* Notably, this function always returns `undefined` if the containing file has an `undefined` `impliedNodeFormat` - this field is only set when
|
|
116510
|
+
* `moduleResolution` is `node16`+.
|
|
116511
|
+
* @param file The file the import or import-like reference is contained within
|
|
116512
|
+
* @param usage The module reference string
|
|
116513
|
+
* @returns The final resolution mode of the import
|
|
116514
|
+
*/
|
|
116453
116515
|
function getModeForUsageLocation(file, usage) {
|
|
116454
116516
|
var _a, _b;
|
|
116455
116517
|
if (file.impliedNodeFormat === undefined)
|
|
@@ -118685,7 +118747,7 @@ var ts;
|
|
|
118685
118747
|
ts.setResolvedTypeReferenceDirective(file, fileName, resolvedTypeReferenceDirective);
|
|
118686
118748
|
var mode = ref.resolutionMode || file.impliedNodeFormat;
|
|
118687
118749
|
if (mode && ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.Node16 && ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.NodeNext) {
|
|
118688
|
-
programDiagnostics.add(ts.createDiagnosticForRange(file, ref, ts.Diagnostics.
|
|
118750
|
+
programDiagnostics.add(ts.createDiagnosticForRange(file, ref, ts.Diagnostics.resolution_mode_assertions_are_only_supported_when_moduleResolution_is_node16_or_nodenext));
|
|
118689
118751
|
}
|
|
118690
118752
|
processTypeReferenceDirective(fileName, mode, resolvedTypeReferenceDirective, { kind: ts.FileIncludeKind.TypeReferenceDirective, file: file.path, index: index, });
|
|
118691
118753
|
}
|
|
@@ -122519,7 +122581,7 @@ var ts;
|
|
|
122519
122581
|
});
|
|
122520
122582
|
// Sort by paths closest to importing file Name directory
|
|
122521
122583
|
var sortedPaths = [];
|
|
122522
|
-
var
|
|
122584
|
+
var _loop_34 = function (directory) {
|
|
122523
122585
|
var directoryStart = ts.ensureTrailingDirectorySeparator(directory);
|
|
122524
122586
|
var pathsInDirectory;
|
|
122525
122587
|
allFileNames.forEach(function (_a, fileName) {
|
|
@@ -122543,9 +122605,9 @@ var ts;
|
|
|
122543
122605
|
};
|
|
122544
122606
|
var out_directory_1;
|
|
122545
122607
|
for (var directory = ts.getDirectoryPath(importingFileName); allFileNames.size !== 0;) {
|
|
122546
|
-
var
|
|
122608
|
+
var state_11 = _loop_34(directory);
|
|
122547
122609
|
directory = out_directory_1;
|
|
122548
|
-
if (
|
|
122610
|
+
if (state_11 === "break")
|
|
122549
122611
|
break;
|
|
122550
122612
|
}
|
|
122551
122613
|
if (allFileNames.size) {
|
|
@@ -144648,7 +144710,7 @@ var ts;
|
|
|
144648
144710
|
if (!ts.textSpanIntersectsWith(span, node.pos, node.getFullWidth())) {
|
|
144649
144711
|
return;
|
|
144650
144712
|
}
|
|
144651
|
-
if (ts.isTypeNode(node)) {
|
|
144713
|
+
if (ts.isTypeNode(node) && !ts.isExpressionWithTypeArguments(node)) {
|
|
144652
144714
|
return;
|
|
144653
144715
|
}
|
|
144654
144716
|
if (preferences.includeInlayVariableTypeHints && ts.isVariableDeclaration(node)) {
|
|
@@ -147759,7 +147821,6 @@ var ts;
|
|
|
147759
147821
|
case 280 /* JsxOpeningElement */:
|
|
147760
147822
|
case 281 /* JsxClosingElement */:
|
|
147761
147823
|
case 279 /* JsxSelfClosingElement */:
|
|
147762
|
-
case 228 /* ExpressionWithTypeArguments */:
|
|
147763
147824
|
return false;
|
|
147764
147825
|
}
|
|
147765
147826
|
break;
|
|
@@ -147929,7 +147990,7 @@ var ts;
|
|
|
147929
147990
|
var listEndToken = getCloseTokenForOpenToken(listStartToken);
|
|
147930
147991
|
if (listEndToken !== 0 /* Unknown */ && formattingScanner.isOnToken() && formattingScanner.getStartPos() < originalRange.end) {
|
|
147931
147992
|
var tokenInfo = formattingScanner.readTokenInfo(parent);
|
|
147932
|
-
if (tokenInfo.token.kind === 27 /* CommaToken */
|
|
147993
|
+
if (tokenInfo.token.kind === 27 /* CommaToken */) {
|
|
147933
147994
|
// consume the comma
|
|
147934
147995
|
consumeTokenAndAdvanceScanner(tokenInfo, parent, listDynamicIndentation, parent);
|
|
147935
147996
|
tokenInfo = formattingScanner.isOnToken() ? formattingScanner.readTokenInfo(parent) : undefined;
|
|
@@ -148333,6 +148394,12 @@ var ts;
|
|
|
148333
148394
|
case 169 /* MethodDeclaration */:
|
|
148334
148395
|
case 168 /* MethodSignature */:
|
|
148335
148396
|
case 214 /* ArrowFunction */:
|
|
148397
|
+
case 174 /* CallSignature */:
|
|
148398
|
+
case 175 /* ConstructSignature */:
|
|
148399
|
+
case 179 /* FunctionType */:
|
|
148400
|
+
case 180 /* ConstructorType */:
|
|
148401
|
+
case 172 /* GetAccessor */:
|
|
148402
|
+
case 173 /* SetAccessor */:
|
|
148336
148403
|
if (node.typeParameters === list) {
|
|
148337
148404
|
return 29 /* LessThanToken */;
|
|
148338
148405
|
}
|
|
@@ -148349,7 +148416,19 @@ var ts;
|
|
|
148349
148416
|
return 20 /* OpenParenToken */;
|
|
148350
148417
|
}
|
|
148351
148418
|
break;
|
|
148419
|
+
case 257 /* ClassDeclaration */:
|
|
148420
|
+
case 226 /* ClassExpression */:
|
|
148421
|
+
case 258 /* InterfaceDeclaration */:
|
|
148422
|
+
case 259 /* TypeAliasDeclaration */:
|
|
148423
|
+
if (node.typeParameters === list) {
|
|
148424
|
+
return 29 /* LessThanToken */;
|
|
148425
|
+
}
|
|
148426
|
+
break;
|
|
148352
148427
|
case 178 /* TypeReference */:
|
|
148428
|
+
case 210 /* TaggedTemplateExpression */:
|
|
148429
|
+
case 181 /* TypeQuery */:
|
|
148430
|
+
case 228 /* ExpressionWithTypeArguments */:
|
|
148431
|
+
case 200 /* ImportType */:
|
|
148353
148432
|
if (node.typeArguments === list) {
|
|
148354
148433
|
return 29 /* LessThanToken */;
|
|
148355
148434
|
}
|