typescript 5.5.0-dev.20240311 → 5.5.0-dev.20240313
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 +133 -101
- package/lib/tsserver.js +176 -104
- package/lib/typescript.js +176 -104
- package/lib/typingsInstaller.js +6 -3
- package/package.json +2 -2
package/lib/typescript.js
CHANGED
|
@@ -106,6 +106,7 @@ __export(typescript_exports, {
|
|
|
106
106
|
JsxEmit: () => JsxEmit,
|
|
107
107
|
JsxFlags: () => JsxFlags,
|
|
108
108
|
JsxReferenceKind: () => JsxReferenceKind,
|
|
109
|
+
LanguageFeatureMinimumTarget: () => LanguageFeatureMinimumTarget,
|
|
109
110
|
LanguageServiceMode: () => LanguageServiceMode,
|
|
110
111
|
LanguageVariant: () => LanguageVariant,
|
|
111
112
|
LexicalEnvironmentFlags: () => LexicalEnvironmentFlags,
|
|
@@ -2325,7 +2326,7 @@ module.exports = __toCommonJS(typescript_exports);
|
|
|
2325
2326
|
|
|
2326
2327
|
// src/compiler/corePublic.ts
|
|
2327
2328
|
var versionMajorMinor = "5.5";
|
|
2328
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
2329
|
+
var version = `${versionMajorMinor}.0-dev.20240313`;
|
|
2329
2330
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2330
2331
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2331
2332
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -3632,7 +3633,7 @@ var createUIStringComparer = /* @__PURE__ */ (() => {
|
|
|
3632
3633
|
return value < 0 ? -1 /* LessThan */ : value > 0 ? 1 /* GreaterThan */ : 0 /* EqualTo */;
|
|
3633
3634
|
}
|
|
3634
3635
|
function createIntlCollatorStringComparer(locale) {
|
|
3635
|
-
const comparer = new Intl.Collator(locale, { usage: "sort", sensitivity: "variant" }).compare;
|
|
3636
|
+
const comparer = new Intl.Collator(locale, { usage: "sort", sensitivity: "variant", numeric: true }).compare;
|
|
3636
3637
|
return (a, b) => compareWithCallback(a, b, comparer);
|
|
3637
3638
|
}
|
|
3638
3639
|
})();
|
|
@@ -7233,6 +7234,38 @@ var InternalEmitFlags = /* @__PURE__ */ ((InternalEmitFlags3) => {
|
|
|
7233
7234
|
InternalEmitFlags3[InternalEmitFlags3["TransformPrivateStaticElements"] = 32] = "TransformPrivateStaticElements";
|
|
7234
7235
|
return InternalEmitFlags3;
|
|
7235
7236
|
})(InternalEmitFlags || {});
|
|
7237
|
+
var LanguageFeatureMinimumTarget = /* @__PURE__ */ ((LanguageFeatureMinimumTarget2) => {
|
|
7238
|
+
LanguageFeatureMinimumTarget2[LanguageFeatureMinimumTarget2["Classes"] = 2 /* ES2015 */] = "Classes";
|
|
7239
|
+
LanguageFeatureMinimumTarget2[LanguageFeatureMinimumTarget2["ForOf"] = 2 /* ES2015 */] = "ForOf";
|
|
7240
|
+
LanguageFeatureMinimumTarget2[LanguageFeatureMinimumTarget2["Generators"] = 2 /* ES2015 */] = "Generators";
|
|
7241
|
+
LanguageFeatureMinimumTarget2[LanguageFeatureMinimumTarget2["Iteration"] = 2 /* ES2015 */] = "Iteration";
|
|
7242
|
+
LanguageFeatureMinimumTarget2[LanguageFeatureMinimumTarget2["SpreadElements"] = 2 /* ES2015 */] = "SpreadElements";
|
|
7243
|
+
LanguageFeatureMinimumTarget2[LanguageFeatureMinimumTarget2["RestElements"] = 2 /* ES2015 */] = "RestElements";
|
|
7244
|
+
LanguageFeatureMinimumTarget2[LanguageFeatureMinimumTarget2["TaggedTemplates"] = 2 /* ES2015 */] = "TaggedTemplates";
|
|
7245
|
+
LanguageFeatureMinimumTarget2[LanguageFeatureMinimumTarget2["DestructuringAssignment"] = 2 /* ES2015 */] = "DestructuringAssignment";
|
|
7246
|
+
LanguageFeatureMinimumTarget2[LanguageFeatureMinimumTarget2["BindingPatterns"] = 2 /* ES2015 */] = "BindingPatterns";
|
|
7247
|
+
LanguageFeatureMinimumTarget2[LanguageFeatureMinimumTarget2["ArrowFunctions"] = 2 /* ES2015 */] = "ArrowFunctions";
|
|
7248
|
+
LanguageFeatureMinimumTarget2[LanguageFeatureMinimumTarget2["BlockScopedVariables"] = 2 /* ES2015 */] = "BlockScopedVariables";
|
|
7249
|
+
LanguageFeatureMinimumTarget2[LanguageFeatureMinimumTarget2["ObjectAssign"] = 2 /* ES2015 */] = "ObjectAssign";
|
|
7250
|
+
LanguageFeatureMinimumTarget2[LanguageFeatureMinimumTarget2["Exponentiation"] = 3 /* ES2016 */] = "Exponentiation";
|
|
7251
|
+
LanguageFeatureMinimumTarget2[LanguageFeatureMinimumTarget2["AsyncFunctions"] = 4 /* ES2017 */] = "AsyncFunctions";
|
|
7252
|
+
LanguageFeatureMinimumTarget2[LanguageFeatureMinimumTarget2["ForAwaitOf"] = 5 /* ES2018 */] = "ForAwaitOf";
|
|
7253
|
+
LanguageFeatureMinimumTarget2[LanguageFeatureMinimumTarget2["AsyncGenerators"] = 5 /* ES2018 */] = "AsyncGenerators";
|
|
7254
|
+
LanguageFeatureMinimumTarget2[LanguageFeatureMinimumTarget2["AsyncIteration"] = 5 /* ES2018 */] = "AsyncIteration";
|
|
7255
|
+
LanguageFeatureMinimumTarget2[LanguageFeatureMinimumTarget2["ObjectSpreadRest"] = 5 /* ES2018 */] = "ObjectSpreadRest";
|
|
7256
|
+
LanguageFeatureMinimumTarget2[LanguageFeatureMinimumTarget2["BindinglessCatch"] = 6 /* ES2019 */] = "BindinglessCatch";
|
|
7257
|
+
LanguageFeatureMinimumTarget2[LanguageFeatureMinimumTarget2["BigInt"] = 7 /* ES2020 */] = "BigInt";
|
|
7258
|
+
LanguageFeatureMinimumTarget2[LanguageFeatureMinimumTarget2["NullishCoalesce"] = 7 /* ES2020 */] = "NullishCoalesce";
|
|
7259
|
+
LanguageFeatureMinimumTarget2[LanguageFeatureMinimumTarget2["OptionalChaining"] = 7 /* ES2020 */] = "OptionalChaining";
|
|
7260
|
+
LanguageFeatureMinimumTarget2[LanguageFeatureMinimumTarget2["LogicalAssignment"] = 8 /* ES2021 */] = "LogicalAssignment";
|
|
7261
|
+
LanguageFeatureMinimumTarget2[LanguageFeatureMinimumTarget2["TopLevelAwait"] = 9 /* ES2022 */] = "TopLevelAwait";
|
|
7262
|
+
LanguageFeatureMinimumTarget2[LanguageFeatureMinimumTarget2["ClassFields"] = 9 /* ES2022 */] = "ClassFields";
|
|
7263
|
+
LanguageFeatureMinimumTarget2[LanguageFeatureMinimumTarget2["PrivateNamesAndClassStaticBlocks"] = 9 /* ES2022 */] = "PrivateNamesAndClassStaticBlocks";
|
|
7264
|
+
LanguageFeatureMinimumTarget2[LanguageFeatureMinimumTarget2["ShebangComments"] = 99 /* ESNext */] = "ShebangComments";
|
|
7265
|
+
LanguageFeatureMinimumTarget2[LanguageFeatureMinimumTarget2["UsingAndAwaitUsing"] = 99 /* ESNext */] = "UsingAndAwaitUsing";
|
|
7266
|
+
LanguageFeatureMinimumTarget2[LanguageFeatureMinimumTarget2["ClassAndClassElementDecorators"] = 99 /* ESNext */] = "ClassAndClassElementDecorators";
|
|
7267
|
+
return LanguageFeatureMinimumTarget2;
|
|
7268
|
+
})(LanguageFeatureMinimumTarget || {});
|
|
7236
7269
|
var ExternalEmitHelpers = /* @__PURE__ */ ((ExternalEmitHelpers2) => {
|
|
7237
7270
|
ExternalEmitHelpers2[ExternalEmitHelpers2["Extends"] = 1] = "Extends";
|
|
7238
7271
|
ExternalEmitHelpers2[ExternalEmitHelpers2["Assign"] = 2] = "Assign";
|
|
@@ -9888,7 +9921,7 @@ var Diagnostics = {
|
|
|
9888
9921
|
Overload_signatures_must_all_be_abstract_or_non_abstract: diag(2512, 1 /* Error */, "Overload_signatures_must_all_be_abstract_or_non_abstract_2512", "Overload signatures must all be abstract or non-abstract."),
|
|
9889
9922
|
Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression: diag(2513, 1 /* Error */, "Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression_2513", "Abstract method '{0}' in class '{1}' cannot be accessed via super expression."),
|
|
9890
9923
|
A_tuple_type_cannot_be_indexed_with_a_negative_value: diag(2514, 1 /* Error */, "A_tuple_type_cannot_be_indexed_with_a_negative_value_2514", "A tuple type cannot be indexed with a negative value."),
|
|
9891
|
-
Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2: diag(2515, 1 /* Error */, "Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2_2515", "Non-abstract class '{0}' does not implement inherited abstract member
|
|
9924
|
+
Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2: diag(2515, 1 /* Error */, "Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2_2515", "Non-abstract class '{0}' does not implement inherited abstract member {1} from class '{2}'."),
|
|
9892
9925
|
All_declarations_of_an_abstract_method_must_be_consecutive: diag(2516, 1 /* Error */, "All_declarations_of_an_abstract_method_must_be_consecutive_2516", "All declarations of an abstract method must be consecutive."),
|
|
9893
9926
|
Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type: diag(2517, 1 /* Error */, "Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type_2517", "Cannot assign an abstract constructor type to a non-abstract constructor type."),
|
|
9894
9927
|
A_this_based_type_guard_is_not_compatible_with_a_parameter_based_type_guard: diag(2518, 1 /* Error */, "A_this_based_type_guard_is_not_compatible_with_a_parameter_based_type_guard_2518", "A 'this'-based type guard is not compatible with a parameter-based type guard."),
|
|
@@ -9998,9 +10031,13 @@ var Diagnostics = {
|
|
|
9998
10031
|
Type_0_may_represent_a_primitive_value_which_is_not_permitted_as_the_right_operand_of_the_in_operator: diag(2638, 1 /* Error */, "Type_0_may_represent_a_primitive_value_which_is_not_permitted_as_the_right_operand_of_the_in_operato_2638", "Type '{0}' may represent a primitive value, which is not permitted as the right operand of the 'in' operator."),
|
|
9999
10032
|
React_components_cannot_include_JSX_namespace_names: diag(2639, 1 /* Error */, "React_components_cannot_include_JSX_namespace_names_2639", "React components cannot include JSX namespace names"),
|
|
10000
10033
|
Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity: diag(2649, 1 /* Error */, "Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity_2649", "Cannot augment module '{0}' with value exports because it resolves to a non-module entity."),
|
|
10034
|
+
Non_abstract_class_expression_is_missing_implementations_for_the_following_members_of_0_Colon_1_and_2_more: diag(2650, 1 /* Error */, "Non_abstract_class_expression_is_missing_implementations_for_the_following_members_of_0_Colon_1_and__2650", "Non-abstract class expression is missing implementations for the following members of '{0}': {1} and {2} more."),
|
|
10001
10035
|
A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums: diag(2651, 1 /* Error */, "A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_memb_2651", "A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums."),
|
|
10002
10036
|
Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead: diag(2652, 1 /* Error */, "Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_d_2652", "Merged declaration '{0}' cannot include a default export declaration. Consider adding a separate 'export default {0}' declaration instead."),
|
|
10003
10037
|
Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1: diag(2653, 1 /* Error */, "Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1_2653", "Non-abstract class expression does not implement inherited abstract member '{0}' from class '{1}'."),
|
|
10038
|
+
Non_abstract_class_0_is_missing_implementations_for_the_following_members_of_1_Colon_2: diag(2654, 1 /* Error */, "Non_abstract_class_0_is_missing_implementations_for_the_following_members_of_1_Colon_2_2654", "Non-abstract class '{0}' is missing implementations for the following members of '{1}': {2}."),
|
|
10039
|
+
Non_abstract_class_0_is_missing_implementations_for_the_following_members_of_1_Colon_2_and_3_more: diag(2655, 1 /* Error */, "Non_abstract_class_0_is_missing_implementations_for_the_following_members_of_1_Colon_2_and_3_more_2655", "Non-abstract class '{0}' is missing implementations for the following members of '{1}': {2} and {3} more."),
|
|
10040
|
+
Non_abstract_class_expression_is_missing_implementations_for_the_following_members_of_0_Colon_1: diag(2656, 1 /* Error */, "Non_abstract_class_expression_is_missing_implementations_for_the_following_members_of_0_Colon_1_2656", "Non-abstract class expression is missing implementations for the following members of '{0}': {1}."),
|
|
10004
10041
|
JSX_expressions_must_have_one_parent_element: diag(2657, 1 /* Error */, "JSX_expressions_must_have_one_parent_element_2657", "JSX expressions must have one parent element."),
|
|
10005
10042
|
Type_0_provides_no_match_for_the_signature_1: diag(2658, 1 /* Error */, "Type_0_provides_no_match_for_the_signature_1_2658", "Type '{0}' provides no match for the signature '{1}'."),
|
|
10006
10043
|
super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_higher: diag(2659, 1 /* Error */, "super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_highe_2659", "'super' is only allowed in members of object literal expressions when option 'target' is 'ES2015' or higher."),
|
|
@@ -11329,7 +11366,6 @@ var Diagnostics = {
|
|
|
11329
11366
|
_0_is_possibly_null_or_undefined: diag(18049, 1 /* Error */, "_0_is_possibly_null_or_undefined_18049", "'{0}' is possibly 'null' or 'undefined'."),
|
|
11330
11367
|
The_value_0_cannot_be_used_here: diag(18050, 1 /* Error */, "The_value_0_cannot_be_used_here_18050", "The value '{0}' cannot be used here."),
|
|
11331
11368
|
Compiler_option_0_cannot_be_given_an_empty_string: diag(18051, 1 /* Error */, "Compiler_option_0_cannot_be_given_an_empty_string_18051", "Compiler option '{0}' cannot be given an empty string."),
|
|
11332
|
-
Non_abstract_class_0_does_not_implement_all_abstract_members_of_1: diag(18052, 1 /* Error */, "Non_abstract_class_0_does_not_implement_all_abstract_members_of_1_18052", "Non-abstract class '{0}' does not implement all abstract members of '{1}'"),
|
|
11333
11369
|
Its_type_0_is_not_a_valid_JSX_element_type: diag(18053, 1 /* Error */, "Its_type_0_is_not_a_valid_JSX_element_type_18053", "Its type '{0}' is not a valid JSX element type."),
|
|
11334
11370
|
await_using_statements_cannot_be_used_inside_a_class_static_block: diag(18054, 1 /* Error */, "await_using_statements_cannot_be_used_inside_a_class_static_block_18054", "'await using' statements cannot be used inside a class static block.")
|
|
11335
11371
|
};
|
|
@@ -21797,7 +21833,7 @@ function hasTabstop(node) {
|
|
|
21797
21833
|
}
|
|
21798
21834
|
function isJSDocOptionalParameter(node) {
|
|
21799
21835
|
return isInJSFile(node) && // node.type should only be a JSDocOptionalType when node is a parameter of a JSDocFunctionType
|
|
21800
|
-
(node.type && node.type.kind === 316 /* JSDocOptionalType */ || getJSDocParameterTags(node).some(
|
|
21836
|
+
(node.type && node.type.kind === 316 /* JSDocOptionalType */ || getJSDocParameterTags(node).some(isOptionalJSDocPropertyLikeTag));
|
|
21801
21837
|
}
|
|
21802
21838
|
function isOptionalDeclaration(declaration) {
|
|
21803
21839
|
switch (declaration.kind) {
|
|
@@ -48898,8 +48934,6 @@ function createTypeChecker(host) {
|
|
|
48898
48934
|
var comparableRelation = /* @__PURE__ */ new Map();
|
|
48899
48935
|
var identityRelation = /* @__PURE__ */ new Map();
|
|
48900
48936
|
var enumRelation = /* @__PURE__ */ new Map();
|
|
48901
|
-
var builtinGlobals = createSymbolTable();
|
|
48902
|
-
builtinGlobals.set(undefinedSymbol.escapedName, undefinedSymbol);
|
|
48903
48937
|
var suggestedExtensions = [
|
|
48904
48938
|
[".mts", ".mjs"],
|
|
48905
48939
|
[".ts", ".js"],
|
|
@@ -49317,17 +49351,17 @@ function createTypeChecker(host) {
|
|
|
49317
49351
|
}
|
|
49318
49352
|
}
|
|
49319
49353
|
}
|
|
49320
|
-
function
|
|
49321
|
-
|
|
49322
|
-
|
|
49323
|
-
|
|
49324
|
-
|
|
49325
|
-
|
|
49326
|
-
|
|
49327
|
-
|
|
49328
|
-
|
|
49329
|
-
|
|
49330
|
-
|
|
49354
|
+
function addUndefinedToGlobalsOrErrorOnRedeclaration() {
|
|
49355
|
+
const name = undefinedSymbol.escapedName;
|
|
49356
|
+
const targetSymbol = globals.get(name);
|
|
49357
|
+
if (targetSymbol) {
|
|
49358
|
+
forEach(targetSymbol.declarations, (declaration) => {
|
|
49359
|
+
if (!isTypeDeclaration(declaration)) {
|
|
49360
|
+
diagnostics.add(createDiagnosticForNode(declaration, Diagnostics.Declaration_name_conflicts_with_built_in_global_identifier_0, unescapeLeadingUnderscores(name)));
|
|
49361
|
+
}
|
|
49362
|
+
});
|
|
49363
|
+
} else {
|
|
49364
|
+
globals.set(name, undefinedSymbol);
|
|
49331
49365
|
}
|
|
49332
49366
|
}
|
|
49333
49367
|
function getSymbolLinks(symbol) {
|
|
@@ -49397,7 +49431,14 @@ function createTypeChecker(host) {
|
|
|
49397
49431
|
} else if (declaration.kind === 260 /* VariableDeclaration */) {
|
|
49398
49432
|
return !isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage);
|
|
49399
49433
|
} else if (isClassLike(declaration)) {
|
|
49400
|
-
|
|
49434
|
+
const container = findAncestor(usage, (n) => n === declaration ? "quit" : isComputedPropertyName(n) ? n.parent.parent === declaration : isDecorator(n) && (n.parent === declaration || isMethodDeclaration(n.parent) && n.parent.parent === declaration || isGetOrSetAccessorDeclaration(n.parent) && n.parent.parent === declaration || isPropertyDeclaration(n.parent) && n.parent.parent === declaration || isParameter(n.parent) && n.parent.parent.parent === declaration));
|
|
49435
|
+
if (!container) {
|
|
49436
|
+
return true;
|
|
49437
|
+
}
|
|
49438
|
+
if (isDecorator(container)) {
|
|
49439
|
+
return !!findAncestor(usage, (n) => n === container ? "quit" : isFunctionLike(n) && !getImmediatelyInvokedFunctionExpression(n));
|
|
49440
|
+
}
|
|
49441
|
+
return false;
|
|
49401
49442
|
} else if (isPropertyDeclaration(declaration)) {
|
|
49402
49443
|
return !isPropertyImmediatelyReferencedWithinDeclaration(
|
|
49403
49444
|
declaration,
|
|
@@ -60070,10 +60111,16 @@ function createTypeChecker(host) {
|
|
|
60070
60111
|
const symbol = getSymbol2(globals, '"' + moduleName + '"', 512 /* ValueModule */);
|
|
60071
60112
|
return symbol && withAugmentations ? getMergedSymbol(symbol) : symbol;
|
|
60072
60113
|
}
|
|
60114
|
+
function hasEffectiveQuestionToken(node) {
|
|
60115
|
+
return hasQuestionToken(node) || isOptionalJSDocPropertyLikeTag(node) || isParameter(node) && isJSDocOptionalParameter(node);
|
|
60116
|
+
}
|
|
60073
60117
|
function isOptionalParameter(node) {
|
|
60074
|
-
if (
|
|
60118
|
+
if (hasEffectiveQuestionToken(node)) {
|
|
60075
60119
|
return true;
|
|
60076
60120
|
}
|
|
60121
|
+
if (!isParameter(node)) {
|
|
60122
|
+
return false;
|
|
60123
|
+
}
|
|
60077
60124
|
if (node.initializer) {
|
|
60078
60125
|
const signature = getSignatureFromDeclaration(node.parent);
|
|
60079
60126
|
const parameterIndex = node.parent.parameters.indexOf(node);
|
|
@@ -60173,7 +60220,7 @@ function createTypeChecker(host) {
|
|
|
60173
60220
|
if (type && type.kind === 201 /* LiteralType */) {
|
|
60174
60221
|
flags |= 2 /* HasLiteralTypes */;
|
|
60175
60222
|
}
|
|
60176
|
-
const isOptionalParameter2 =
|
|
60223
|
+
const isOptionalParameter2 = hasEffectiveQuestionToken(param) || isParameter(param) && param.initializer || isRestParameter(param) || iife && parameters.length > iife.arguments.length && !type;
|
|
60177
60224
|
if (!isOptionalParameter2) {
|
|
60178
60225
|
minArgumentCount = parameters.length;
|
|
60179
60226
|
}
|
|
@@ -65291,7 +65338,7 @@ function createTypeChecker(host) {
|
|
|
65291
65338
|
if (reduced !== type) {
|
|
65292
65339
|
return reduced;
|
|
65293
65340
|
}
|
|
65294
|
-
if (type.flags & 2097152 /* Intersection */ &&
|
|
65341
|
+
if (type.flags & 2097152 /* Intersection */ && shouldNormalizeIntersection(type)) {
|
|
65295
65342
|
const normalizedTypes = sameMap(type.types, (t) => getNormalizedType(t, writing));
|
|
65296
65343
|
if (normalizedTypes !== type.types) {
|
|
65297
65344
|
return getIntersectionType(normalizedTypes);
|
|
@@ -65299,6 +65346,17 @@ function createTypeChecker(host) {
|
|
|
65299
65346
|
}
|
|
65300
65347
|
return type;
|
|
65301
65348
|
}
|
|
65349
|
+
function shouldNormalizeIntersection(type) {
|
|
65350
|
+
let hasInstantiable = false;
|
|
65351
|
+
let hasNullableOrEmpty = false;
|
|
65352
|
+
for (const t of type.types) {
|
|
65353
|
+
hasInstantiable || (hasInstantiable = !!(t.flags & 465829888 /* Instantiable */));
|
|
65354
|
+
hasNullableOrEmpty || (hasNullableOrEmpty = !!(t.flags & 98304 /* Nullable */) || isEmptyAnonymousObjectType(t));
|
|
65355
|
+
if (hasInstantiable && hasNullableOrEmpty)
|
|
65356
|
+
return true;
|
|
65357
|
+
}
|
|
65358
|
+
return false;
|
|
65359
|
+
}
|
|
65302
65360
|
function getNormalizedTupleType(type, writing) {
|
|
65303
65361
|
const elements = getElementTypes(type);
|
|
65304
65362
|
const normalizedElements = sameMap(elements, (t) => t.flags & 25165824 /* Simplifiable */ ? getSimplifiedType(t, writing) : t);
|
|
@@ -70149,9 +70207,9 @@ function createTypeChecker(host) {
|
|
|
70149
70207
|
if (strictNullChecks) {
|
|
70150
70208
|
switch (facts) {
|
|
70151
70209
|
case 524288 /* NEUndefined */:
|
|
70152
|
-
return
|
|
70210
|
+
return removeNullableByIntersection(reduced, 65536 /* EQUndefined */, 131072 /* EQNull */, 33554432 /* IsNull */, nullType);
|
|
70153
70211
|
case 1048576 /* NENull */:
|
|
70154
|
-
return
|
|
70212
|
+
return removeNullableByIntersection(reduced, 131072 /* EQNull */, 65536 /* EQUndefined */, 16777216 /* IsUndefined */, undefinedType);
|
|
70155
70213
|
case 2097152 /* NEUndefinedOrNull */:
|
|
70156
70214
|
case 4194304 /* Truthy */:
|
|
70157
70215
|
return mapType(reduced, (t) => hasTypeFacts(t, 262144 /* EQUndefinedOrNull */) ? getGlobalNonNullableTypeInstantiation(t) : t);
|
|
@@ -70159,6 +70217,14 @@ function createTypeChecker(host) {
|
|
|
70159
70217
|
}
|
|
70160
70218
|
return reduced;
|
|
70161
70219
|
}
|
|
70220
|
+
function removeNullableByIntersection(type, targetFacts, otherFacts, otherIncludesFacts, otherType) {
|
|
70221
|
+
const facts = getTypeFacts(type, 65536 /* EQUndefined */ | 131072 /* EQNull */ | 16777216 /* IsUndefined */ | 33554432 /* IsNull */);
|
|
70222
|
+
if (!(facts & targetFacts)) {
|
|
70223
|
+
return type;
|
|
70224
|
+
}
|
|
70225
|
+
const emptyAndOtherUnion = getUnionType([emptyObjectType, otherType]);
|
|
70226
|
+
return mapType(type, (t) => hasTypeFacts(t, targetFacts) ? getIntersectionType([t, !(facts & otherIncludesFacts) && hasTypeFacts(t, otherFacts) ? emptyAndOtherUnion : emptyObjectType]) : t);
|
|
70227
|
+
}
|
|
70162
70228
|
function recombineUnknownType(type) {
|
|
70163
70229
|
return type === unknownUnionType ? unknownType : type;
|
|
70164
70230
|
}
|
|
@@ -73726,7 +73792,7 @@ function createTypeChecker(host) {
|
|
|
73726
73792
|
}
|
|
73727
73793
|
}
|
|
73728
73794
|
function checkSpreadExpression(node, checkMode) {
|
|
73729
|
-
if (languageVersion < 2 /*
|
|
73795
|
+
if (languageVersion < 2 /* SpreadElements */) {
|
|
73730
73796
|
checkExternalEmitHelpers(node, compilerOptions.downlevelIteration ? 1536 /* SpreadIncludes */ : 1024 /* SpreadArray */);
|
|
73731
73797
|
}
|
|
73732
73798
|
const arrayOrIterableType = checkExpression(node.expression, checkMode);
|
|
@@ -73760,7 +73826,7 @@ function createTypeChecker(host) {
|
|
|
73760
73826
|
for (let i = 0; i < elementCount; i++) {
|
|
73761
73827
|
const e = elements[i];
|
|
73762
73828
|
if (e.kind === 230 /* SpreadElement */) {
|
|
73763
|
-
if (languageVersion < 2 /*
|
|
73829
|
+
if (languageVersion < 2 /* SpreadElements */) {
|
|
73764
73830
|
checkExternalEmitHelpers(e, compilerOptions.downlevelIteration ? 1536 /* SpreadIncludes */ : 1024 /* SpreadArray */);
|
|
73765
73831
|
}
|
|
73766
73832
|
const spreadType = checkExpression(e.expression, checkMode, forceTuple);
|
|
@@ -73990,7 +74056,7 @@ function createTypeChecker(host) {
|
|
|
73990
74056
|
addIntraExpressionInferenceSite(inferenceContext, inferenceNode, type);
|
|
73991
74057
|
}
|
|
73992
74058
|
} else if (memberDecl.kind === 305 /* SpreadAssignment */) {
|
|
73993
|
-
if (languageVersion < 2 /*
|
|
74059
|
+
if (languageVersion < 2 /* ObjectAssign */) {
|
|
73994
74060
|
checkExternalEmitHelpers(memberDecl, 2 /* Assign */);
|
|
73995
74061
|
}
|
|
73996
74062
|
if (propertiesArray.length > 0) {
|
|
@@ -75015,7 +75081,7 @@ function createTypeChecker(host) {
|
|
|
75015
75081
|
const isAnyLike = isTypeAny(apparentType) || apparentType === silentNeverType;
|
|
75016
75082
|
let prop;
|
|
75017
75083
|
if (isPrivateIdentifier(right)) {
|
|
75018
|
-
if (languageVersion < 99 /*
|
|
75084
|
+
if (languageVersion < 9 /* PrivateNamesAndClassStaticBlocks */ || languageVersion < 99 /* ClassAndClassElementDecorators */ || !useDefineForClassFields) {
|
|
75019
75085
|
if (assignmentKind !== 0 /* None */) {
|
|
75020
75086
|
checkExternalEmitHelpers(node, 1048576 /* ClassPrivateFieldSet */);
|
|
75021
75087
|
}
|
|
@@ -76842,7 +76908,7 @@ function createTypeChecker(host) {
|
|
|
76842
76908
|
}
|
|
76843
76909
|
return resolveErrorCall(node);
|
|
76844
76910
|
}
|
|
76845
|
-
if (checkMode & 8 /* SkipGenericFunctions */ && !node.typeArguments && callSignatures.some(
|
|
76911
|
+
if (checkMode & 8 /* SkipGenericFunctions */ && !node.typeArguments && callSignatures.some(isGenericFunctionReturningFunction)) {
|
|
76846
76912
|
skippedGenericFunction(node, checkMode);
|
|
76847
76913
|
return resolvingSignature;
|
|
76848
76914
|
}
|
|
@@ -76852,12 +76918,8 @@ function createTypeChecker(host) {
|
|
|
76852
76918
|
}
|
|
76853
76919
|
return resolveCall(node, callSignatures, candidatesOutArray, checkMode, callChainFlags);
|
|
76854
76920
|
}
|
|
76855
|
-
function
|
|
76856
|
-
|
|
76857
|
-
return false;
|
|
76858
|
-
}
|
|
76859
|
-
const returnType = getReturnTypeOfSignature(signature);
|
|
76860
|
-
return isFunctionType(returnType) || isConstructorType(returnType);
|
|
76921
|
+
function isGenericFunctionReturningFunction(signature) {
|
|
76922
|
+
return !!(signature.typeParameters && isFunctionType(getReturnTypeOfSignature(signature)));
|
|
76861
76923
|
}
|
|
76862
76924
|
function isUntypedFunctionCall(funcType, apparentFuncType, numCallSignatures, numConstructSignatures) {
|
|
76863
76925
|
return isTypeAny(funcType) || isTypeAny(apparentFuncType) && !!(funcType.flags & 262144 /* TypeParameter */) || !numCallSignatures && !numConstructSignatures && !(apparentFuncType.flags & 1048576 /* Union */) && !(getReducedType(apparentFuncType).flags & 131072 /* Never */) && isTypeAssignableTo(funcType, globalFunctionType);
|
|
@@ -77628,7 +77690,7 @@ function createTypeChecker(host) {
|
|
|
77628
77690
|
function checkTaggedTemplateExpression(node) {
|
|
77629
77691
|
if (!checkGrammarTaggedTemplateChain(node))
|
|
77630
77692
|
checkGrammarTypeArguments(node, node.typeArguments);
|
|
77631
|
-
if (languageVersion < 2 /*
|
|
77693
|
+
if (languageVersion < 2 /* TaggedTemplates */) {
|
|
77632
77694
|
checkExternalEmitHelpers(node, 262144 /* MakeTemplateObject */);
|
|
77633
77695
|
}
|
|
77634
77696
|
const signature = getResolvedSignature(node);
|
|
@@ -79275,7 +79337,7 @@ function createTypeChecker(host) {
|
|
|
79275
79337
|
return silentNeverType;
|
|
79276
79338
|
}
|
|
79277
79339
|
if (isPrivateIdentifier(left)) {
|
|
79278
|
-
if (languageVersion < 99 /*
|
|
79340
|
+
if (languageVersion < 9 /* PrivateNamesAndClassStaticBlocks */ || languageVersion < 99 /* ClassAndClassElementDecorators */ || !useDefineForClassFields) {
|
|
79279
79341
|
checkExternalEmitHelpers(left, 2097152 /* ClassPrivateFieldIn */);
|
|
79280
79342
|
}
|
|
79281
79343
|
if (!getNodeLinks(left).resolvedSymbol && getContainingClass(left)) {
|
|
@@ -79336,7 +79398,7 @@ function createTypeChecker(host) {
|
|
|
79336
79398
|
if (propertyIndex < properties.length - 1) {
|
|
79337
79399
|
error2(property, Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern);
|
|
79338
79400
|
} else {
|
|
79339
|
-
if (languageVersion <
|
|
79401
|
+
if (languageVersion < 5 /* ObjectSpreadRest */) {
|
|
79340
79402
|
checkExternalEmitHelpers(property, 4 /* Rest */);
|
|
79341
79403
|
}
|
|
79342
79404
|
const nonRestNames = [];
|
|
@@ -79357,7 +79419,7 @@ function createTypeChecker(host) {
|
|
|
79357
79419
|
}
|
|
79358
79420
|
function checkArrayLiteralAssignment(node, sourceType, checkMode) {
|
|
79359
79421
|
const elements = node.elements;
|
|
79360
|
-
if (languageVersion < 2 /*
|
|
79422
|
+
if (languageVersion < 2 /* DestructuringAssignment */ && compilerOptions.downlevelIteration) {
|
|
79361
79423
|
checkExternalEmitHelpers(node, 512 /* Read */);
|
|
79362
79424
|
}
|
|
79363
79425
|
const possiblyOutOfBoundsType = checkIteratedTypeOrElementType(65 /* Destructuring */ | 128 /* PossiblyOutOfBounds */, sourceType, undefinedType, node) || errorType;
|
|
@@ -80059,10 +80121,10 @@ function createTypeChecker(host) {
|
|
|
80059
80121
|
}
|
|
80060
80122
|
const isAsync = (functionFlags & 2 /* Async */) !== 0;
|
|
80061
80123
|
if (node.asteriskToken) {
|
|
80062
|
-
if (isAsync && languageVersion <
|
|
80124
|
+
if (isAsync && languageVersion < 5 /* AsyncGenerators */) {
|
|
80063
80125
|
checkExternalEmitHelpers(node, 26624 /* AsyncDelegatorIncludes */);
|
|
80064
80126
|
}
|
|
80065
|
-
if (!isAsync && languageVersion < 2 /*
|
|
80127
|
+
if (!isAsync && languageVersion < 2 /* Generators */ && compilerOptions.downlevelIteration) {
|
|
80066
80128
|
checkExternalEmitHelpers(node, 256 /* Values */);
|
|
80067
80129
|
}
|
|
80068
80130
|
}
|
|
@@ -80834,13 +80896,13 @@ function createTypeChecker(host) {
|
|
|
80834
80896
|
}
|
|
80835
80897
|
const functionFlags = getFunctionFlags(node);
|
|
80836
80898
|
if (!(functionFlags & 4 /* Invalid */)) {
|
|
80837
|
-
if ((functionFlags & 3 /* AsyncGenerator */) === 3 /* AsyncGenerator */ && languageVersion <
|
|
80899
|
+
if ((functionFlags & 3 /* AsyncGenerator */) === 3 /* AsyncGenerator */ && languageVersion < 5 /* AsyncGenerators */) {
|
|
80838
80900
|
checkExternalEmitHelpers(node, 6144 /* AsyncGeneratorIncludes */);
|
|
80839
80901
|
}
|
|
80840
|
-
if ((functionFlags & 3 /* AsyncGenerator */) === 2 /* Async */ && languageVersion < 4 /*
|
|
80902
|
+
if ((functionFlags & 3 /* AsyncGenerator */) === 2 /* Async */ && languageVersion < 4 /* AsyncFunctions */) {
|
|
80841
80903
|
checkExternalEmitHelpers(node, 64 /* Awaiter */);
|
|
80842
80904
|
}
|
|
80843
|
-
if ((functionFlags & 3 /* AsyncGenerator */) !== 0 /* Normal */ && languageVersion < 2 /*
|
|
80905
|
+
if ((functionFlags & 3 /* AsyncGenerator */) !== 0 /* Normal */ && languageVersion < 2 /* Generators */) {
|
|
80844
80906
|
checkExternalEmitHelpers(node, 128 /* Generator */);
|
|
80845
80907
|
}
|
|
80846
80908
|
}
|
|
@@ -81073,15 +81135,17 @@ function createTypeChecker(host) {
|
|
|
81073
81135
|
setNodeLinksForPrivateIdentifierScope(node);
|
|
81074
81136
|
}
|
|
81075
81137
|
function setNodeLinksForPrivateIdentifierScope(node) {
|
|
81076
|
-
if (isPrivateIdentifier(node.name)
|
|
81077
|
-
|
|
81078
|
-
|
|
81079
|
-
|
|
81080
|
-
|
|
81081
|
-
|
|
81082
|
-
|
|
81083
|
-
|
|
81084
|
-
|
|
81138
|
+
if (isPrivateIdentifier(node.name)) {
|
|
81139
|
+
if (languageVersion < 9 /* PrivateNamesAndClassStaticBlocks */ || languageVersion < 99 /* ClassAndClassElementDecorators */ || !useDefineForClassFields) {
|
|
81140
|
+
for (let lexicalScope = getEnclosingBlockScopeContainer(node); !!lexicalScope; lexicalScope = getEnclosingBlockScopeContainer(lexicalScope)) {
|
|
81141
|
+
getNodeLinks(lexicalScope).flags |= 1048576 /* ContainsClassWithPrivateIdentifiers */;
|
|
81142
|
+
}
|
|
81143
|
+
if (isClassExpression(node.parent)) {
|
|
81144
|
+
const enclosingIterationStatement = getEnclosingIterationStatement(node.parent);
|
|
81145
|
+
if (enclosingIterationStatement) {
|
|
81146
|
+
getNodeLinks(node.name).flags |= 32768 /* BlockScopedBindingInLoop */;
|
|
81147
|
+
getNodeLinks(enclosingIterationStatement).flags |= 4096 /* LoopWithCapturedBlockScopedBinding */;
|
|
81148
|
+
}
|
|
81085
81149
|
}
|
|
81086
81150
|
}
|
|
81087
81151
|
}
|
|
@@ -82206,7 +82270,7 @@ function createTypeChecker(host) {
|
|
|
82206
82270
|
if (node.kind === 169 /* Parameter */) {
|
|
82207
82271
|
checkExternalEmitHelpers(firstDecorator, 32 /* Param */);
|
|
82208
82272
|
}
|
|
82209
|
-
} else if (languageVersion < 99 /*
|
|
82273
|
+
} else if (languageVersion < 99 /* ClassAndClassElementDecorators */) {
|
|
82210
82274
|
checkExternalEmitHelpers(firstDecorator, 8 /* ESDecorateAndRunInitializers */);
|
|
82211
82275
|
if (isClassDeclaration(node)) {
|
|
82212
82276
|
if (!node.name) {
|
|
@@ -82911,7 +82975,7 @@ function createTypeChecker(host) {
|
|
|
82911
82975
|
potentialUnusedRenamedBindingElementsInTypes.push(node);
|
|
82912
82976
|
return;
|
|
82913
82977
|
}
|
|
82914
|
-
if (isObjectBindingPattern(node.parent) && node.dotDotDotToken && languageVersion < 5 /*
|
|
82978
|
+
if (isObjectBindingPattern(node.parent) && node.dotDotDotToken && languageVersion < 5 /* ObjectSpreadRest */) {
|
|
82915
82979
|
checkExternalEmitHelpers(node, 4 /* Rest */);
|
|
82916
82980
|
}
|
|
82917
82981
|
if (node.propertyName && node.propertyName.kind === 167 /* ComputedPropertyName */) {
|
|
@@ -82947,7 +83011,7 @@ function createTypeChecker(host) {
|
|
|
82947
83011
|
}
|
|
82948
83012
|
}
|
|
82949
83013
|
if (isBindingPattern(node.name)) {
|
|
82950
|
-
if (node.name.kind === 207 /* ArrayBindingPattern */ && languageVersion < 2 /*
|
|
83014
|
+
if (node.name.kind === 207 /* ArrayBindingPattern */ && languageVersion < 2 /* BindingPatterns */ && compilerOptions.downlevelIteration) {
|
|
82951
83015
|
checkExternalEmitHelpers(node, 512 /* Read */);
|
|
82952
83016
|
}
|
|
82953
83017
|
forEach(node.name.elements, checkSourceElement);
|
|
@@ -83098,7 +83162,7 @@ function createTypeChecker(host) {
|
|
|
83098
83162
|
}
|
|
83099
83163
|
function checkVariableDeclarationList(node) {
|
|
83100
83164
|
const blockScopeKind = getCombinedNodeFlags(node) & 7 /* BlockScoped */;
|
|
83101
|
-
if (blockScopeKind === 4 /* Using */ || blockScopeKind === 6 /* AwaitUsing */) {
|
|
83165
|
+
if ((blockScopeKind === 4 /* Using */ || blockScopeKind === 6 /* AwaitUsing */) && languageVersion < 99 /* UsingAndAwaitUsing */) {
|
|
83102
83166
|
checkExternalEmitHelpers(node, 16777216 /* AddDisposableResourceAndDisposeResources */);
|
|
83103
83167
|
}
|
|
83104
83168
|
forEach(node.declarations, checkSourceElement);
|
|
@@ -83271,11 +83335,11 @@ function createTypeChecker(host) {
|
|
|
83271
83335
|
grammarErrorOnNode(node.awaitModifier, Diagnostics.for_await_loops_cannot_be_used_inside_a_class_static_block);
|
|
83272
83336
|
} else {
|
|
83273
83337
|
const functionFlags = getFunctionFlags(container);
|
|
83274
|
-
if ((functionFlags & (4 /* Invalid */ | 2 /* Async */)) === 2 /* Async */ && languageVersion <
|
|
83338
|
+
if ((functionFlags & (4 /* Invalid */ | 2 /* Async */)) === 2 /* Async */ && languageVersion < 5 /* ForAwaitOf */) {
|
|
83275
83339
|
checkExternalEmitHelpers(node, 16384 /* ForAwaitOfIncludes */);
|
|
83276
83340
|
}
|
|
83277
83341
|
}
|
|
83278
|
-
} else if (compilerOptions.downlevelIteration && languageVersion < 2 /*
|
|
83342
|
+
} else if (compilerOptions.downlevelIteration && languageVersion < 2 /* ForOf */) {
|
|
83279
83343
|
checkExternalEmitHelpers(node, 256 /* ForOfIncludes */);
|
|
83280
83344
|
}
|
|
83281
83345
|
if (node.initializer.kind === 261 /* VariableDeclarationList */) {
|
|
@@ -84199,6 +84263,7 @@ function createTypeChecker(host) {
|
|
|
84199
84263
|
case "symbol":
|
|
84200
84264
|
case "void":
|
|
84201
84265
|
case "object":
|
|
84266
|
+
case "undefined":
|
|
84202
84267
|
error2(name, message, name.escapedText);
|
|
84203
84268
|
}
|
|
84204
84269
|
}
|
|
@@ -84338,12 +84403,12 @@ function createTypeChecker(host) {
|
|
|
84338
84403
|
return true;
|
|
84339
84404
|
}
|
|
84340
84405
|
function getFirstTransformableStaticClassElement(node) {
|
|
84341
|
-
const willTransformStaticElementsOfDecoratedClass = !legacyDecorators && languageVersion < 99 /*
|
|
84406
|
+
const willTransformStaticElementsOfDecoratedClass = !legacyDecorators && languageVersion < 99 /* ClassAndClassElementDecorators */ && classOrConstructorParameterIsDecorated(
|
|
84342
84407
|
/*useLegacyDecorators*/
|
|
84343
84408
|
false,
|
|
84344
84409
|
node
|
|
84345
84410
|
);
|
|
84346
|
-
const willTransformPrivateElementsOrClassStaticBlocks = languageVersion
|
|
84411
|
+
const willTransformPrivateElementsOrClassStaticBlocks = languageVersion < 9 /* PrivateNamesAndClassStaticBlocks */ || languageVersion < 99 /* ClassAndClassElementDecorators */;
|
|
84347
84412
|
const willTransformInitializers = !emitStandardClassFields;
|
|
84348
84413
|
if (willTransformStaticElementsOfDecoratedClass || willTransformPrivateElementsOrClassStaticBlocks) {
|
|
84349
84414
|
for (const member of node.members) {
|
|
@@ -84372,7 +84437,7 @@ function createTypeChecker(host) {
|
|
|
84372
84437
|
const parent2 = walkUpOuterExpressions(node);
|
|
84373
84438
|
if (!isNamedEvaluationSource(parent2))
|
|
84374
84439
|
return;
|
|
84375
|
-
const willTransformESDecorators = !legacyDecorators && languageVersion < 99 /*
|
|
84440
|
+
const willTransformESDecorators = !legacyDecorators && languageVersion < 99 /* ClassAndClassElementDecorators */;
|
|
84376
84441
|
let location;
|
|
84377
84442
|
if (willTransformESDecorators && classOrConstructorParameterIsDecorated(
|
|
84378
84443
|
/*useLegacyDecorators*/
|
|
@@ -84432,7 +84497,7 @@ function createTypeChecker(host) {
|
|
|
84432
84497
|
const baseTypeNode = getEffectiveBaseTypeNode(node);
|
|
84433
84498
|
if (baseTypeNode) {
|
|
84434
84499
|
forEach(baseTypeNode.typeArguments, checkSourceElement);
|
|
84435
|
-
if (languageVersion < 2 /*
|
|
84500
|
+
if (languageVersion < 2 /* Classes */) {
|
|
84436
84501
|
checkExternalEmitHelpers(baseTypeNode.parent, 1 /* Extends */);
|
|
84437
84502
|
}
|
|
84438
84503
|
const extendsNode = getClassExtendsHeritageElement(node);
|
|
@@ -84728,9 +84793,9 @@ function createTypeChecker(host) {
|
|
|
84728
84793
|
return filter(symbol.declarations, (d) => d.kind === 263 /* ClassDeclaration */ || d.kind === 264 /* InterfaceDeclaration */);
|
|
84729
84794
|
}
|
|
84730
84795
|
function checkKindsOfPropertyMemberOverrides(type, baseType) {
|
|
84731
|
-
var _a, _b, _c, _d;
|
|
84796
|
+
var _a, _b, _c, _d, _e;
|
|
84732
84797
|
const baseProperties = getPropertiesOfType(baseType);
|
|
84733
|
-
|
|
84798
|
+
const notImplementedInfo = /* @__PURE__ */ new Map();
|
|
84734
84799
|
basePropertyCheck:
|
|
84735
84800
|
for (const baseProperty of baseProperties) {
|
|
84736
84801
|
const base = getTargetSymbol(baseProperty);
|
|
@@ -84756,36 +84821,11 @@ function createTypeChecker(host) {
|
|
|
84756
84821
|
continue basePropertyCheck;
|
|
84757
84822
|
}
|
|
84758
84823
|
}
|
|
84759
|
-
|
|
84760
|
-
|
|
84761
|
-
|
|
84762
|
-
|
|
84763
|
-
|
|
84764
|
-
typeToString(baseType)
|
|
84765
|
-
);
|
|
84766
|
-
}
|
|
84767
|
-
if (derivedClassDecl.kind === 231 /* ClassExpression */) {
|
|
84768
|
-
addRelatedInfo(
|
|
84769
|
-
inheritedAbstractMemberNotImplementedError,
|
|
84770
|
-
createDiagnosticForNode(
|
|
84771
|
-
baseProperty.valueDeclaration ?? (baseProperty.declarations && first(baseProperty.declarations)) ?? derivedClassDecl,
|
|
84772
|
-
Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1,
|
|
84773
|
-
symbolToString(baseProperty),
|
|
84774
|
-
typeToString(baseType)
|
|
84775
|
-
)
|
|
84776
|
-
);
|
|
84777
|
-
} else {
|
|
84778
|
-
addRelatedInfo(
|
|
84779
|
-
inheritedAbstractMemberNotImplementedError,
|
|
84780
|
-
createDiagnosticForNode(
|
|
84781
|
-
baseProperty.valueDeclaration ?? (baseProperty.declarations && first(baseProperty.declarations)) ?? derivedClassDecl,
|
|
84782
|
-
Diagnostics.Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2,
|
|
84783
|
-
typeToString(type),
|
|
84784
|
-
symbolToString(baseProperty),
|
|
84785
|
-
typeToString(baseType)
|
|
84786
|
-
)
|
|
84787
|
-
);
|
|
84788
|
-
}
|
|
84824
|
+
const baseTypeName = typeToString(baseType);
|
|
84825
|
+
const typeName = typeToString(type);
|
|
84826
|
+
const basePropertyName = symbolToString(baseProperty);
|
|
84827
|
+
const missedProperties = append((_a = notImplementedInfo.get(derivedClassDecl)) == null ? void 0 : _a.missedProperties, basePropertyName);
|
|
84828
|
+
notImplementedInfo.set(derivedClassDecl, { baseTypeName, typeName, missedProperties });
|
|
84789
84829
|
}
|
|
84790
84830
|
} else {
|
|
84791
84831
|
const derivedDeclarationFlags = getDeclarationModifierFlagsFromSymbol(derived);
|
|
@@ -84796,7 +84836,7 @@ function createTypeChecker(host) {
|
|
|
84796
84836
|
const basePropertyFlags = base.flags & 98308 /* PropertyOrAccessor */;
|
|
84797
84837
|
const derivedPropertyFlags = derived.flags & 98308 /* PropertyOrAccessor */;
|
|
84798
84838
|
if (basePropertyFlags && derivedPropertyFlags) {
|
|
84799
|
-
if ((getCheckFlags(base) & 6 /* Synthetic */ ? (
|
|
84839
|
+
if ((getCheckFlags(base) & 6 /* Synthetic */ ? (_b = base.declarations) == null ? void 0 : _b.some((d) => isPropertyAbstractOrInterface(d, baseDeclarationFlags)) : (_c = base.declarations) == null ? void 0 : _c.every((d) => isPropertyAbstractOrInterface(d, baseDeclarationFlags))) || getCheckFlags(base) & 262144 /* Mapped */ || derived.valueDeclaration && isBinaryExpression(derived.valueDeclaration)) {
|
|
84800
84840
|
continue;
|
|
84801
84841
|
}
|
|
84802
84842
|
const overriddenInstanceProperty = basePropertyFlags !== 4 /* Property */ && derivedPropertyFlags === 4 /* Property */;
|
|
@@ -84805,8 +84845,8 @@ function createTypeChecker(host) {
|
|
|
84805
84845
|
const errorMessage2 = overriddenInstanceProperty ? Diagnostics._0_is_defined_as_an_accessor_in_class_1_but_is_overridden_here_in_2_as_an_instance_property : Diagnostics._0_is_defined_as_a_property_in_class_1_but_is_overridden_here_in_2_as_an_accessor;
|
|
84806
84846
|
error2(getNameOfDeclaration(derived.valueDeclaration) || derived.valueDeclaration, errorMessage2, symbolToString(base), typeToString(baseType), typeToString(type));
|
|
84807
84847
|
} else if (useDefineForClassFields) {
|
|
84808
|
-
const uninitialized = (
|
|
84809
|
-
if (uninitialized && !(derived.flags & 33554432 /* Transient */) && !(baseDeclarationFlags & 64 /* Abstract */) && !(derivedDeclarationFlags & 64 /* Abstract */) && !((
|
|
84848
|
+
const uninitialized = (_d = derived.declarations) == null ? void 0 : _d.find((d) => d.kind === 172 /* PropertyDeclaration */ && !d.initializer);
|
|
84849
|
+
if (uninitialized && !(derived.flags & 33554432 /* Transient */) && !(baseDeclarationFlags & 64 /* Abstract */) && !(derivedDeclarationFlags & 64 /* Abstract */) && !((_e = derived.declarations) == null ? void 0 : _e.some((d) => !!(d.flags & 33554432 /* Ambient */)))) {
|
|
84810
84850
|
const constructor = findConstructorDeclaration(getClassLikeDeclarationOfSymbol(type.symbol));
|
|
84811
84851
|
const propName = uninitialized.name;
|
|
84812
84852
|
if (uninitialized.exclamationToken || !constructor || !isIdentifier(propName) || !strictNullChecks || !isPropertyInitializedInConstructor(propName, type, constructor)) {
|
|
@@ -84831,6 +84871,30 @@ function createTypeChecker(host) {
|
|
|
84831
84871
|
error2(getNameOfDeclaration(derived.valueDeclaration) || derived.valueDeclaration, errorMessage, typeToString(baseType), symbolToString(base), typeToString(type));
|
|
84832
84872
|
}
|
|
84833
84873
|
}
|
|
84874
|
+
for (const [errorNode, memberInfo] of notImplementedInfo) {
|
|
84875
|
+
if (length(memberInfo.missedProperties) === 1) {
|
|
84876
|
+
if (isClassExpression(errorNode)) {
|
|
84877
|
+
error2(errorNode, Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1, first(memberInfo.missedProperties), memberInfo.baseTypeName);
|
|
84878
|
+
} else {
|
|
84879
|
+
error2(errorNode, Diagnostics.Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2, memberInfo.typeName, first(memberInfo.missedProperties), memberInfo.baseTypeName);
|
|
84880
|
+
}
|
|
84881
|
+
} else if (length(memberInfo.missedProperties) > 5) {
|
|
84882
|
+
const missedProperties = map(memberInfo.missedProperties.slice(0, 4), (prop) => `'${prop}'`).join(", ");
|
|
84883
|
+
const remainingMissedProperties = length(memberInfo.missedProperties) - 4;
|
|
84884
|
+
if (isClassExpression(errorNode)) {
|
|
84885
|
+
error2(errorNode, Diagnostics.Non_abstract_class_expression_is_missing_implementations_for_the_following_members_of_0_Colon_1_and_2_more, memberInfo.baseTypeName, missedProperties, remainingMissedProperties);
|
|
84886
|
+
} else {
|
|
84887
|
+
error2(errorNode, Diagnostics.Non_abstract_class_0_is_missing_implementations_for_the_following_members_of_1_Colon_2_and_3_more, memberInfo.typeName, memberInfo.baseTypeName, missedProperties, remainingMissedProperties);
|
|
84888
|
+
}
|
|
84889
|
+
} else {
|
|
84890
|
+
const missedProperties = map(memberInfo.missedProperties, (prop) => `'${prop}'`).join(", ");
|
|
84891
|
+
if (isClassExpression(errorNode)) {
|
|
84892
|
+
error2(errorNode, Diagnostics.Non_abstract_class_expression_is_missing_implementations_for_the_following_members_of_0_Colon_1, memberInfo.baseTypeName, missedProperties);
|
|
84893
|
+
} else {
|
|
84894
|
+
error2(errorNode, Diagnostics.Non_abstract_class_0_is_missing_implementations_for_the_following_members_of_1_Colon_2, memberInfo.typeName, memberInfo.baseTypeName, missedProperties);
|
|
84895
|
+
}
|
|
84896
|
+
}
|
|
84897
|
+
}
|
|
84834
84898
|
}
|
|
84835
84899
|
function isPropertyAbstractOrInterface(declaration, baseDeclarationFlags) {
|
|
84836
84900
|
return baseDeclarationFlags & 64 /* Abstract */ && (!isPropertyDeclaration(declaration) || !declaration.initializer) || isInterfaceDeclaration(declaration.parent);
|
|
@@ -87901,7 +87965,7 @@ function createTypeChecker(host) {
|
|
|
87901
87965
|
}
|
|
87902
87966
|
}
|
|
87903
87967
|
}
|
|
87904
|
-
|
|
87968
|
+
addUndefinedToGlobalsOrErrorOnRedeclaration();
|
|
87905
87969
|
getSymbolLinks(undefinedSymbol).type = undefinedWideningType;
|
|
87906
87970
|
getSymbolLinks(argumentsSymbol).type = getGlobalType(
|
|
87907
87971
|
"IArguments",
|
|
@@ -88555,7 +88619,7 @@ function createTypeChecker(host) {
|
|
|
88555
88619
|
if (parameter.initializer) {
|
|
88556
88620
|
return grammarErrorOnNode(parameter.name, Diagnostics.A_rest_parameter_cannot_have_an_initializer);
|
|
88557
88621
|
}
|
|
88558
|
-
} else if (
|
|
88622
|
+
} else if (hasEffectiveQuestionToken(parameter)) {
|
|
88559
88623
|
seenOptionalParameter = true;
|
|
88560
88624
|
if (parameter.questionToken && parameter.initializer) {
|
|
88561
88625
|
return grammarErrorOnNode(parameter.name, Diagnostics.Parameter_cannot_have_question_mark_and_initializer);
|
|
@@ -91666,12 +91730,12 @@ function getOriginalNodeId(node) {
|
|
|
91666
91730
|
function containsDefaultReference(node) {
|
|
91667
91731
|
if (!node)
|
|
91668
91732
|
return false;
|
|
91669
|
-
if (!isNamedImports(node))
|
|
91733
|
+
if (!isNamedImports(node) && !isNamedExports(node))
|
|
91670
91734
|
return false;
|
|
91671
91735
|
return some(node.elements, isNamedDefaultReference);
|
|
91672
91736
|
}
|
|
91673
91737
|
function isNamedDefaultReference(e) {
|
|
91674
|
-
return e.propertyName !== void 0
|
|
91738
|
+
return e.propertyName !== void 0 ? e.propertyName.escapedText === "default" /* Default */ : e.name.escapedText === "default" /* Default */;
|
|
91675
91739
|
}
|
|
91676
91740
|
function chainBundle(context, transformSourceFile) {
|
|
91677
91741
|
return transformSourceFileOrBundle;
|
|
@@ -91745,6 +91809,7 @@ function collectExternalModuleInfo(context, sourceFile) {
|
|
|
91745
91809
|
externalImports.push(node);
|
|
91746
91810
|
if (isNamedExports(node.exportClause)) {
|
|
91747
91811
|
addExportedNamesForExportDeclaration(node);
|
|
91812
|
+
hasImportDefault || (hasImportDefault = containsDefaultReference(node.exportClause));
|
|
91748
91813
|
} else {
|
|
91749
91814
|
const name = node.exportClause.name;
|
|
91750
91815
|
if (!uniqueExports.get(idText(name))) {
|
|
@@ -153463,7 +153528,12 @@ function getTypesPackageNameToInstall(packageName, host, diagCode) {
|
|
|
153463
153528
|
|
|
153464
153529
|
// src/services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts
|
|
153465
153530
|
var errorCodes31 = [
|
|
153466
|
-
Diagnostics.
|
|
153531
|
+
Diagnostics.Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2.code,
|
|
153532
|
+
Diagnostics.Non_abstract_class_0_is_missing_implementations_for_the_following_members_of_1_Colon_2.code,
|
|
153533
|
+
Diagnostics.Non_abstract_class_0_is_missing_implementations_for_the_following_members_of_1_Colon_2_and_3_more.code,
|
|
153534
|
+
Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1.code,
|
|
153535
|
+
Diagnostics.Non_abstract_class_expression_is_missing_implementations_for_the_following_members_of_0_Colon_1.code,
|
|
153536
|
+
Diagnostics.Non_abstract_class_expression_is_missing_implementations_for_the_following_members_of_0_Colon_1_and_2_more.code
|
|
153467
153537
|
];
|
|
153468
153538
|
var fixId25 = "fixClassDoesntImplementInheritedAbstractMember";
|
|
153469
153539
|
registerCodeFix({
|
|
@@ -165492,7 +165562,7 @@ function provideInlayHints(context) {
|
|
|
165492
165562
|
return type.symbol && type.symbol.flags & 1536 /* Module */;
|
|
165493
165563
|
}
|
|
165494
165564
|
function visitVariableLikeDeclaration(decl) {
|
|
165495
|
-
if (
|
|
165565
|
+
if (decl.initializer === void 0 && !(isPropertyDeclaration(decl) && !(checker.getTypeAtLocation(decl).flags & 1 /* Any */)) || isBindingPattern(decl.name) || isVariableDeclaration(decl) && !isHintableDeclaration(decl)) {
|
|
165496
165566
|
return;
|
|
165497
165567
|
}
|
|
165498
165568
|
const effectiveTypeAnnotation = getEffectiveTypeAnnotationNode(decl);
|
|
@@ -173293,6 +173363,7 @@ __export(ts_exports2, {
|
|
|
173293
173363
|
JsxEmit: () => JsxEmit,
|
|
173294
173364
|
JsxFlags: () => JsxFlags,
|
|
173295
173365
|
JsxReferenceKind: () => JsxReferenceKind,
|
|
173366
|
+
LanguageFeatureMinimumTarget: () => LanguageFeatureMinimumTarget,
|
|
173296
173367
|
LanguageServiceMode: () => LanguageServiceMode,
|
|
173297
173368
|
LanguageVariant: () => LanguageVariant,
|
|
173298
173369
|
LexicalEnvironmentFlags: () => LexicalEnvironmentFlags,
|
|
@@ -187493,6 +187564,7 @@ if (typeof console !== "undefined") {
|
|
|
187493
187564
|
JsxEmit,
|
|
187494
187565
|
JsxFlags,
|
|
187495
187566
|
JsxReferenceKind,
|
|
187567
|
+
LanguageFeatureMinimumTarget,
|
|
187496
187568
|
LanguageServiceMode,
|
|
187497
187569
|
LanguageVariant,
|
|
187498
187570
|
LexicalEnvironmentFlags,
|