@typescript-deploys/pr-build 5.1.0-pr-53300-9 → 5.1.0-pr-53323-7
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 +30 -51
- package/lib/tsserver.js +32 -51
- package/lib/tsserverlibrary.d.ts +0 -1
- package/lib/tsserverlibrary.js +32 -51
- package/lib/typescript.d.ts +0 -1
- package/lib/typescript.js +32 -51
- package/lib/typingsInstaller.js +4 -13
- package/package.json +3 -3
package/lib/tsc.js
CHANGED
|
@@ -23,7 +23,7 @@ var __export = (target, all) => {
|
|
|
23
23
|
|
|
24
24
|
// src/compiler/corePublic.ts
|
|
25
25
|
var versionMajorMinor = "5.1";
|
|
26
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
26
|
+
var version = `${versionMajorMinor}.0-insiders.20230317`;
|
|
27
27
|
|
|
28
28
|
// src/compiler/core.ts
|
|
29
29
|
var emptyArray = [];
|
|
@@ -3721,7 +3721,7 @@ var TypeFlags = /* @__PURE__ */ ((TypeFlags2) => {
|
|
|
3721
3721
|
TypeFlags2[TypeFlags2["IncludesWildcard"] = 8388608 /* IndexedAccess */] = "IncludesWildcard";
|
|
3722
3722
|
TypeFlags2[TypeFlags2["IncludesEmptyObject"] = 16777216 /* Conditional */] = "IncludesEmptyObject";
|
|
3723
3723
|
TypeFlags2[TypeFlags2["IncludesInstantiable"] = 33554432 /* Substitution */] = "IncludesInstantiable";
|
|
3724
|
-
TypeFlags2[TypeFlags2["NotPrimitiveUnion"] =
|
|
3724
|
+
TypeFlags2[TypeFlags2["NotPrimitiveUnion"] = 36323331] = "NotPrimitiveUnion";
|
|
3725
3725
|
return TypeFlags2;
|
|
3726
3726
|
})(TypeFlags || {});
|
|
3727
3727
|
var ObjectFlags = /* @__PURE__ */ ((ObjectFlags3) => {
|
|
@@ -6656,6 +6656,8 @@ var Diagnostics = {
|
|
|
6656
6656
|
Type_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: diag(2844, 1 /* Error */, "Type_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2844", "Type of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor."),
|
|
6657
6657
|
This_condition_will_always_return_0: diag(2845, 1 /* Error */, "This_condition_will_always_return_0_2845", "This condition will always return '{0}'."),
|
|
6658
6658
|
A_declaration_file_cannot_be_imported_without_import_type_Did_you_mean_to_import_an_implementation_file_0_instead: diag(2846, 1 /* Error */, "A_declaration_file_cannot_be_imported_without_import_type_Did_you_mean_to_import_an_implementation_f_2846", "A declaration file cannot be imported without 'import type'. Did you mean to import an implementation file '{0}' instead?"),
|
|
6659
|
+
A_function_whose_declared_type_is_neither_undefined_void_nor_any_must_return_a_value: diag(2847, 1 /* Error */, "A_function_whose_declared_type_is_neither_undefined_void_nor_any_must_return_a_value_2847", "A function whose declared type is neither 'undefined', 'void', nor 'any' must return a value."),
|
|
6660
|
+
The_right_hand_side_of_an_instanceof_expression_must_not_be_an_instantiation_expression: diag(2848, 1 /* Error */, "The_right_hand_side_of_an_instanceof_expression_must_not_be_an_instantiation_expression_2848", "The right-hand side of an 'instanceof' expression must not be an instantiation expression."),
|
|
6659
6661
|
Import_declaration_0_is_using_private_name_1: diag(4e3, 1 /* Error */, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."),
|
|
6660
6662
|
Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, 1 /* 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}'."),
|
|
6661
6663
|
Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, 1 /* 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}'."),
|
|
@@ -7333,7 +7335,6 @@ var Diagnostics = {
|
|
|
7333
7335
|
Specify_emit_Slashchecking_behavior_for_imports_that_are_only_used_for_types: diag(6718, 3 /* Message */, "Specify_emit_Slashchecking_behavior_for_imports_that_are_only_used_for_types_6718", "Specify emit/checking behavior for imports that are only used for types."),
|
|
7334
7336
|
Default_catch_clause_variables_as_unknown_instead_of_any: diag(6803, 3 /* Message */, "Default_catch_clause_variables_as_unknown_instead_of_any_6803", "Default catch clause variables as 'unknown' instead of 'any'."),
|
|
7335
7337
|
Do_not_transform_or_elide_any_imports_or_exports_not_marked_as_type_only_ensuring_they_are_written_in_the_output_file_s_format_based_on_the_module_setting: diag(6804, 3 /* Message */, "Do_not_transform_or_elide_any_imports_or_exports_not_marked_as_type_only_ensuring_they_are_written_i_6804", "Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting."),
|
|
7336
|
-
Default_type_arguments_to_parameter_constraint_or_unknown_instead_of_any_for_instance_checks: diag(6805, 3 /* Message */, "Default_type_arguments_to_parameter_constraint_or_unknown_instead_of_any_for_instance_checks_6805", "Default type arguments to parameter constraint or 'unknown' instead of 'any' for instance checks."),
|
|
7337
7338
|
one_of_Colon: diag(6900, 3 /* Message */, "one_of_Colon_6900", "one of:"),
|
|
7338
7339
|
one_or_more_Colon: diag(6901, 3 /* Message */, "one_or_more_Colon_6901", "one or more:"),
|
|
7339
7340
|
type_Colon: diag(6902, 3 /* Message */, "type_Colon_6902", "type:"),
|
|
@@ -33859,16 +33860,6 @@ var commandOptionsWithoutBuild = [
|
|
|
33859
33860
|
description: Diagnostics.Default_catch_clause_variables_as_unknown_instead_of_any,
|
|
33860
33861
|
defaultValueDescription: false
|
|
33861
33862
|
},
|
|
33862
|
-
{
|
|
33863
|
-
name: "strictInstanceOfTypeParameters",
|
|
33864
|
-
type: "boolean",
|
|
33865
|
-
affectsSemanticDiagnostics: true,
|
|
33866
|
-
affectsBuildInfo: true,
|
|
33867
|
-
strictFlag: true,
|
|
33868
|
-
category: Diagnostics.Type_Checking,
|
|
33869
|
-
description: Diagnostics.Default_type_arguments_to_parameter_constraint_or_unknown_instead_of_any_for_instance_checks,
|
|
33870
|
-
defaultValueDescription: false
|
|
33871
|
-
},
|
|
33872
33863
|
{
|
|
33873
33864
|
name: "alwaysStrict",
|
|
33874
33865
|
type: "boolean",
|
|
@@ -42672,7 +42663,6 @@ function createTypeChecker(host) {
|
|
|
42672
42663
|
var noImplicitAny = getStrictOptionValue(compilerOptions, "noImplicitAny");
|
|
42673
42664
|
var noImplicitThis = getStrictOptionValue(compilerOptions, "noImplicitThis");
|
|
42674
42665
|
var useUnknownInCatchVariables = getStrictOptionValue(compilerOptions, "useUnknownInCatchVariables");
|
|
42675
|
-
var strictInstanceOfTypeParameters = true;
|
|
42676
42666
|
var keyofStringsOnly = !!compilerOptions.keyofStringsOnly;
|
|
42677
42667
|
var defaultIndexFlags = keyofStringsOnly ? 1 /* StringsOnly */ : 0 /* None */;
|
|
42678
42668
|
var freshObjectLiteralFlag = compilerOptions.suppressExcessPropertyErrors ? 0 : 8192 /* FreshLiteral */;
|
|
@@ -50639,32 +50629,9 @@ function createTypeChecker(host) {
|
|
|
50639
50629
|
}
|
|
50640
50630
|
}).parent;
|
|
50641
50631
|
}
|
|
50642
|
-
function getInstanceTypeOfClassSymbol(classSymbol) {
|
|
50643
|
-
const classType = getDeclaredTypeOfSymbol(classSymbol);
|
|
50644
|
-
const objectFlags = getObjectFlags(classType);
|
|
50645
|
-
if (!(objectFlags & 3 /* ClassOrInterface */) || !classType.typeParameters) {
|
|
50646
|
-
return classType;
|
|
50647
|
-
}
|
|
50648
|
-
const variances = getVariances(classType);
|
|
50649
|
-
const typeArguments = map(classType.typeParameters, (typeParameter, i) => {
|
|
50650
|
-
if (!strictInstanceOfTypeParameters) {
|
|
50651
|
-
return anyType;
|
|
50652
|
-
}
|
|
50653
|
-
const variance = variances[i];
|
|
50654
|
-
switch (variance & 7 /* VarianceMask */) {
|
|
50655
|
-
case 4 /* Independent */:
|
|
50656
|
-
case 3 /* Bivariant */:
|
|
50657
|
-
return anyType;
|
|
50658
|
-
case 0 /* Invariant */:
|
|
50659
|
-
return unknownType;
|
|
50660
|
-
}
|
|
50661
|
-
return getBaseConstraintOfType(typeParameter) || unknownType;
|
|
50662
|
-
});
|
|
50663
|
-
return createTypeReference(classType, typeArguments);
|
|
50664
|
-
}
|
|
50665
50632
|
function getTypeOfPrototypeProperty(prototype) {
|
|
50666
|
-
const
|
|
50667
|
-
return
|
|
50633
|
+
const classType = getDeclaredTypeOfSymbol(getParentOfSymbol(prototype));
|
|
50634
|
+
return classType.typeParameters ? createTypeReference(classType, map(classType.typeParameters, (_) => anyType)) : classType;
|
|
50668
50635
|
}
|
|
50669
50636
|
function getTypeOfPropertyOfType(type, name) {
|
|
50670
50637
|
const prop = getPropertyOfType(type, name);
|
|
@@ -56035,7 +56002,7 @@ function createTypeChecker(host) {
|
|
|
56035
56002
|
origin = createOriginUnionOrIntersectionType(1048576 /* Union */, reducedTypes);
|
|
56036
56003
|
}
|
|
56037
56004
|
}
|
|
56038
|
-
const objectFlags = (includes &
|
|
56005
|
+
const objectFlags = (includes & 36323331 /* NotPrimitiveUnion */ ? 0 : 32768 /* PrimitiveUnion */) | (includes & 2097152 /* Intersection */ ? 16777216 /* ContainsIntersections */ : 0);
|
|
56039
56006
|
return getUnionTypeFromSortedList(typeSet, objectFlags, aliasSymbol, aliasTypeArguments, origin);
|
|
56040
56007
|
}
|
|
56041
56008
|
function getUnionOrIntersectionTypePredicate(signatures, kind) {
|
|
@@ -56160,7 +56127,7 @@ function createTypeChecker(host) {
|
|
|
56160
56127
|
function eachUnionContains(unionTypes2, type) {
|
|
56161
56128
|
for (const u of unionTypes2) {
|
|
56162
56129
|
if (!containsType(u.types, type)) {
|
|
56163
|
-
const primitive = type.flags & 128 /* StringLiteral */ ? stringType : type.flags & 256 /* NumberLiteral */ ? numberType : type.flags & 2048 /* BigIntLiteral */ ? bigintType : type.flags & 8192 /* UniqueESSymbol */ ? esSymbolType : void 0;
|
|
56130
|
+
const primitive = type.flags & 128 /* StringLiteral */ ? stringType : type.flags & (32 /* Enum */ | 256 /* NumberLiteral */) ? numberType : type.flags & 2048 /* BigIntLiteral */ ? bigintType : type.flags & 8192 /* UniqueESSymbol */ ? esSymbolType : void 0;
|
|
56164
56131
|
if (!primitive || !containsType(u.types, primitive)) {
|
|
56165
56132
|
return false;
|
|
56166
56133
|
}
|
|
@@ -56187,9 +56154,6 @@ function createTypeChecker(host) {
|
|
|
56187
56154
|
}
|
|
56188
56155
|
return false;
|
|
56189
56156
|
}
|
|
56190
|
-
function eachIsUnionContaining(types, flag) {
|
|
56191
|
-
return every(types, (t) => !!(t.flags & 1048576 /* Union */) && some(t.types, (tt) => !!(tt.flags & flag)));
|
|
56192
|
-
}
|
|
56193
56157
|
function removeFromEach(types, flag) {
|
|
56194
56158
|
for (let i = 0; i < types.length; i++) {
|
|
56195
56159
|
types[i] = filterType(types[i], (t) => !(t.flags & flag));
|
|
@@ -56278,11 +56242,11 @@ function createTypeChecker(host) {
|
|
|
56278
56242
|
if (includes & 1048576 /* Union */) {
|
|
56279
56243
|
if (intersectUnionsOfPrimitiveTypes(typeSet)) {
|
|
56280
56244
|
result = getIntersectionType(typeSet, aliasSymbol, aliasTypeArguments);
|
|
56281
|
-
} else if (
|
|
56245
|
+
} else if (every(typeSet, (t) => !!(t.flags & 1048576 /* Union */ && t.types[0].flags & 32768 /* Undefined */))) {
|
|
56282
56246
|
const containedUndefinedType = some(typeSet, containsMissingType) ? missingType : undefinedType;
|
|
56283
56247
|
removeFromEach(typeSet, 32768 /* Undefined */);
|
|
56284
56248
|
result = getUnionType([getIntersectionType(typeSet), containedUndefinedType], 1 /* Literal */, aliasSymbol, aliasTypeArguments);
|
|
56285
|
-
} else if (
|
|
56249
|
+
} else if (every(typeSet, (t) => !!(t.flags & 1048576 /* Union */ && (t.types[0].flags & 65536 /* Null */ || t.types[1].flags & 65536 /* Null */)))) {
|
|
56286
56250
|
removeFromEach(typeSet, 65536 /* Null */);
|
|
56287
56251
|
result = getUnionType([getIntersectionType(typeSet), nullType], 1 /* Literal */, aliasSymbol, aliasTypeArguments);
|
|
56288
56252
|
} else {
|
|
@@ -59807,6 +59771,11 @@ function createTypeChecker(host) {
|
|
|
59807
59771
|
if (containsType(targetTypes, source2)) {
|
|
59808
59772
|
return -1 /* True */;
|
|
59809
59773
|
}
|
|
59774
|
+
if (getObjectFlags(target2) & 32768 /* PrimitiveUnion */ && !(source2.flags & 1024 /* EnumLiteral */) && (source2.flags & (128 /* StringLiteral */ | 512 /* BooleanLiteral */ | 2048 /* BigIntLiteral */) || (relation === subtypeRelation || relation === strictSubtypeRelation) && source2.flags & 256 /* NumberLiteral */)) {
|
|
59775
|
+
const alternateForm = source2 === source2.regularType ? source2.freshType : source2.regularType;
|
|
59776
|
+
const primitive = source2.flags & 128 /* StringLiteral */ ? stringType : source2.flags & 256 /* NumberLiteral */ ? numberType : source2.flags & 2048 /* BigIntLiteral */ ? bigintType : void 0;
|
|
59777
|
+
return primitive && containsType(targetTypes, primitive) || alternateForm && containsType(targetTypes, alternateForm) ? -1 /* True */ : 0 /* False */;
|
|
59778
|
+
}
|
|
59810
59779
|
const match = getMatchingUnionConstituentForType(target2, source2);
|
|
59811
59780
|
if (match) {
|
|
59812
59781
|
const related = isRelatedTo(
|
|
@@ -65108,8 +65077,8 @@ function createTypeChecker(host) {
|
|
|
65108
65077
|
if (symbol === void 0) {
|
|
65109
65078
|
return type;
|
|
65110
65079
|
}
|
|
65111
|
-
const classSymbol =
|
|
65112
|
-
const targetType = hasStaticModifier(Debug.checkDefined(symbol.valueDeclaration, "should always have a declaration")) ? getTypeOfSymbol(classSymbol) :
|
|
65080
|
+
const classSymbol = symbol.parent;
|
|
65081
|
+
const targetType = hasStaticModifier(Debug.checkDefined(symbol.valueDeclaration, "should always have a declaration")) ? getTypeOfSymbol(classSymbol) : getDeclaredTypeOfSymbol(classSymbol);
|
|
65113
65082
|
return getNarrowedType(
|
|
65114
65083
|
type,
|
|
65115
65084
|
targetType,
|
|
@@ -71164,6 +71133,12 @@ function createTypeChecker(host) {
|
|
|
71164
71133
|
function checkExpressionWithTypeArguments(node) {
|
|
71165
71134
|
checkGrammarExpressionWithTypeArguments(node);
|
|
71166
71135
|
forEach(node.typeArguments, checkSourceElement);
|
|
71136
|
+
if (node.kind === 231 /* ExpressionWithTypeArguments */) {
|
|
71137
|
+
const parent = walkUpParenthesizedExpressions(node.parent);
|
|
71138
|
+
if (parent.kind === 224 /* BinaryExpression */ && parent.operatorToken.kind === 103 /* InstanceOfKeyword */ && isNodeDescendantOf(node, parent.right)) {
|
|
71139
|
+
error(node, Diagnostics.The_right_hand_side_of_an_instanceof_expression_must_not_be_an_instantiation_expression);
|
|
71140
|
+
}
|
|
71141
|
+
}
|
|
71167
71142
|
const exprType = node.kind === 231 /* ExpressionWithTypeArguments */ ? checkExpression(node.expression) : isThisIdentifier(node.exprName) ? checkThisExpression(node.exprName) : checkExpression(node.exprName);
|
|
71168
71143
|
return getInstantiationExpressionType(exprType, node);
|
|
71169
71144
|
}
|
|
@@ -72121,7 +72096,7 @@ function createTypeChecker(host) {
|
|
|
72121
72096
|
function checkAllCodePathsInNonVoidFunctionReturnOrThrowDiagnostics() {
|
|
72122
72097
|
const functionFlags = getFunctionFlags(func);
|
|
72123
72098
|
const type = returnType && unwrapReturnType(returnType, functionFlags);
|
|
72124
|
-
if (type && maybeTypeOfKind(type,
|
|
72099
|
+
if (type && maybeTypeOfKind(type, 32768 /* Undefined */ | 16384 /* Void */ | 1 /* Any */)) {
|
|
72125
72100
|
return;
|
|
72126
72101
|
}
|
|
72127
72102
|
if (func.kind === 171 /* MethodSignature */ || nodeIsMissing(func.body) || func.body.kind !== 239 /* Block */ || !functionHasImplicitReturn(func)) {
|
|
@@ -72132,8 +72107,12 @@ function createTypeChecker(host) {
|
|
|
72132
72107
|
if (type && type.flags & 131072 /* Never */) {
|
|
72133
72108
|
error(errorNode, Diagnostics.A_function_returning_never_cannot_have_a_reachable_end_point);
|
|
72134
72109
|
} else if (type && !hasExplicitReturn) {
|
|
72135
|
-
|
|
72136
|
-
|
|
72110
|
+
if (strictNullChecks) {
|
|
72111
|
+
error(errorNode, Diagnostics.A_function_whose_declared_type_is_neither_undefined_void_nor_any_must_return_a_value);
|
|
72112
|
+
} else {
|
|
72113
|
+
error(errorNode, Diagnostics.A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value);
|
|
72114
|
+
}
|
|
72115
|
+
} else if (type && strictNullChecks) {
|
|
72137
72116
|
error(errorNode, Diagnostics.Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined);
|
|
72138
72117
|
} else if (compilerOptions.noImplicitReturns) {
|
|
72139
72118
|
if (!type) {
|
package/lib/tsserver.js
CHANGED
|
@@ -2285,7 +2285,7 @@ module.exports = __toCommonJS(server_exports);
|
|
|
2285
2285
|
|
|
2286
2286
|
// src/compiler/corePublic.ts
|
|
2287
2287
|
var versionMajorMinor = "5.1";
|
|
2288
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
2288
|
+
var version = `${versionMajorMinor}.0-insiders.20230317`;
|
|
2289
2289
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2290
2290
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2291
2291
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -6642,7 +6642,7 @@ var TypeFlags = /* @__PURE__ */ ((TypeFlags2) => {
|
|
|
6642
6642
|
TypeFlags2[TypeFlags2["IncludesWildcard"] = 8388608 /* IndexedAccess */] = "IncludesWildcard";
|
|
6643
6643
|
TypeFlags2[TypeFlags2["IncludesEmptyObject"] = 16777216 /* Conditional */] = "IncludesEmptyObject";
|
|
6644
6644
|
TypeFlags2[TypeFlags2["IncludesInstantiable"] = 33554432 /* Substitution */] = "IncludesInstantiable";
|
|
6645
|
-
TypeFlags2[TypeFlags2["NotPrimitiveUnion"] =
|
|
6645
|
+
TypeFlags2[TypeFlags2["NotPrimitiveUnion"] = 36323331] = "NotPrimitiveUnion";
|
|
6646
6646
|
return TypeFlags2;
|
|
6647
6647
|
})(TypeFlags || {});
|
|
6648
6648
|
var ObjectFlags = /* @__PURE__ */ ((ObjectFlags3) => {
|
|
@@ -10118,6 +10118,8 @@ var Diagnostics = {
|
|
|
10118
10118
|
Type_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: diag(2844, 1 /* Error */, "Type_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2844", "Type of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor."),
|
|
10119
10119
|
This_condition_will_always_return_0: diag(2845, 1 /* Error */, "This_condition_will_always_return_0_2845", "This condition will always return '{0}'."),
|
|
10120
10120
|
A_declaration_file_cannot_be_imported_without_import_type_Did_you_mean_to_import_an_implementation_file_0_instead: diag(2846, 1 /* Error */, "A_declaration_file_cannot_be_imported_without_import_type_Did_you_mean_to_import_an_implementation_f_2846", "A declaration file cannot be imported without 'import type'. Did you mean to import an implementation file '{0}' instead?"),
|
|
10121
|
+
A_function_whose_declared_type_is_neither_undefined_void_nor_any_must_return_a_value: diag(2847, 1 /* Error */, "A_function_whose_declared_type_is_neither_undefined_void_nor_any_must_return_a_value_2847", "A function whose declared type is neither 'undefined', 'void', nor 'any' must return a value."),
|
|
10122
|
+
The_right_hand_side_of_an_instanceof_expression_must_not_be_an_instantiation_expression: diag(2848, 1 /* Error */, "The_right_hand_side_of_an_instanceof_expression_must_not_be_an_instantiation_expression_2848", "The right-hand side of an 'instanceof' expression must not be an instantiation expression."),
|
|
10121
10123
|
Import_declaration_0_is_using_private_name_1: diag(4e3, 1 /* Error */, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."),
|
|
10122
10124
|
Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, 1 /* 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}'."),
|
|
10123
10125
|
Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, 1 /* 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}'."),
|
|
@@ -10795,7 +10797,6 @@ var Diagnostics = {
|
|
|
10795
10797
|
Specify_emit_Slashchecking_behavior_for_imports_that_are_only_used_for_types: diag(6718, 3 /* Message */, "Specify_emit_Slashchecking_behavior_for_imports_that_are_only_used_for_types_6718", "Specify emit/checking behavior for imports that are only used for types."),
|
|
10796
10798
|
Default_catch_clause_variables_as_unknown_instead_of_any: diag(6803, 3 /* Message */, "Default_catch_clause_variables_as_unknown_instead_of_any_6803", "Default catch clause variables as 'unknown' instead of 'any'."),
|
|
10797
10799
|
Do_not_transform_or_elide_any_imports_or_exports_not_marked_as_type_only_ensuring_they_are_written_in_the_output_file_s_format_based_on_the_module_setting: diag(6804, 3 /* Message */, "Do_not_transform_or_elide_any_imports_or_exports_not_marked_as_type_only_ensuring_they_are_written_i_6804", "Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting."),
|
|
10798
|
-
Default_type_arguments_to_parameter_constraint_or_unknown_instead_of_any_for_instance_checks: diag(6805, 3 /* Message */, "Default_type_arguments_to_parameter_constraint_or_unknown_instead_of_any_for_instance_checks_6805", "Default type arguments to parameter constraint or 'unknown' instead of 'any' for instance checks."),
|
|
10799
10800
|
one_of_Colon: diag(6900, 3 /* Message */, "one_of_Colon_6900", "one of:"),
|
|
10800
10801
|
one_or_more_Colon: diag(6901, 3 /* Message */, "one_or_more_Colon_6901", "one or more:"),
|
|
10801
10802
|
type_Colon: diag(6902, 3 /* Message */, "type_Colon_6902", "type:"),
|
|
@@ -38195,16 +38196,6 @@ var commandOptionsWithoutBuild = [
|
|
|
38195
38196
|
description: Diagnostics.Default_catch_clause_variables_as_unknown_instead_of_any,
|
|
38196
38197
|
defaultValueDescription: false
|
|
38197
38198
|
},
|
|
38198
|
-
{
|
|
38199
|
-
name: "strictInstanceOfTypeParameters",
|
|
38200
|
-
type: "boolean",
|
|
38201
|
-
affectsSemanticDiagnostics: true,
|
|
38202
|
-
affectsBuildInfo: true,
|
|
38203
|
-
strictFlag: true,
|
|
38204
|
-
category: Diagnostics.Type_Checking,
|
|
38205
|
-
description: Diagnostics.Default_type_arguments_to_parameter_constraint_or_unknown_instead_of_any_for_instance_checks,
|
|
38206
|
-
defaultValueDescription: false
|
|
38207
|
-
},
|
|
38208
38199
|
{
|
|
38209
38200
|
name: "alwaysStrict",
|
|
38210
38201
|
type: "boolean",
|
|
@@ -47269,7 +47260,6 @@ function createTypeChecker(host) {
|
|
|
47269
47260
|
var noImplicitAny = getStrictOptionValue(compilerOptions, "noImplicitAny");
|
|
47270
47261
|
var noImplicitThis = getStrictOptionValue(compilerOptions, "noImplicitThis");
|
|
47271
47262
|
var useUnknownInCatchVariables = getStrictOptionValue(compilerOptions, "useUnknownInCatchVariables");
|
|
47272
|
-
var strictInstanceOfTypeParameters = true;
|
|
47273
47263
|
var keyofStringsOnly = !!compilerOptions.keyofStringsOnly;
|
|
47274
47264
|
var defaultIndexFlags = keyofStringsOnly ? 1 /* StringsOnly */ : 0 /* None */;
|
|
47275
47265
|
var freshObjectLiteralFlag = compilerOptions.suppressExcessPropertyErrors ? 0 : 8192 /* FreshLiteral */;
|
|
@@ -55236,32 +55226,9 @@ function createTypeChecker(host) {
|
|
|
55236
55226
|
}
|
|
55237
55227
|
}).parent;
|
|
55238
55228
|
}
|
|
55239
|
-
function getInstanceTypeOfClassSymbol(classSymbol) {
|
|
55240
|
-
const classType = getDeclaredTypeOfSymbol(classSymbol);
|
|
55241
|
-
const objectFlags = getObjectFlags(classType);
|
|
55242
|
-
if (!(objectFlags & 3 /* ClassOrInterface */) || !classType.typeParameters) {
|
|
55243
|
-
return classType;
|
|
55244
|
-
}
|
|
55245
|
-
const variances = getVariances(classType);
|
|
55246
|
-
const typeArguments = map(classType.typeParameters, (typeParameter, i) => {
|
|
55247
|
-
if (!strictInstanceOfTypeParameters) {
|
|
55248
|
-
return anyType;
|
|
55249
|
-
}
|
|
55250
|
-
const variance = variances[i];
|
|
55251
|
-
switch (variance & 7 /* VarianceMask */) {
|
|
55252
|
-
case 4 /* Independent */:
|
|
55253
|
-
case 3 /* Bivariant */:
|
|
55254
|
-
return anyType;
|
|
55255
|
-
case 0 /* Invariant */:
|
|
55256
|
-
return unknownType;
|
|
55257
|
-
}
|
|
55258
|
-
return getBaseConstraintOfType(typeParameter) || unknownType;
|
|
55259
|
-
});
|
|
55260
|
-
return createTypeReference(classType, typeArguments);
|
|
55261
|
-
}
|
|
55262
55229
|
function getTypeOfPrototypeProperty(prototype) {
|
|
55263
|
-
const
|
|
55264
|
-
return
|
|
55230
|
+
const classType = getDeclaredTypeOfSymbol(getParentOfSymbol(prototype));
|
|
55231
|
+
return classType.typeParameters ? createTypeReference(classType, map(classType.typeParameters, (_) => anyType)) : classType;
|
|
55265
55232
|
}
|
|
55266
55233
|
function getTypeOfPropertyOfType(type, name) {
|
|
55267
55234
|
const prop = getPropertyOfType(type, name);
|
|
@@ -60632,7 +60599,7 @@ function createTypeChecker(host) {
|
|
|
60632
60599
|
origin = createOriginUnionOrIntersectionType(1048576 /* Union */, reducedTypes);
|
|
60633
60600
|
}
|
|
60634
60601
|
}
|
|
60635
|
-
const objectFlags = (includes &
|
|
60602
|
+
const objectFlags = (includes & 36323331 /* NotPrimitiveUnion */ ? 0 : 32768 /* PrimitiveUnion */) | (includes & 2097152 /* Intersection */ ? 16777216 /* ContainsIntersections */ : 0);
|
|
60636
60603
|
return getUnionTypeFromSortedList(typeSet, objectFlags, aliasSymbol, aliasTypeArguments, origin);
|
|
60637
60604
|
}
|
|
60638
60605
|
function getUnionOrIntersectionTypePredicate(signatures, kind) {
|
|
@@ -60757,7 +60724,7 @@ function createTypeChecker(host) {
|
|
|
60757
60724
|
function eachUnionContains(unionTypes2, type) {
|
|
60758
60725
|
for (const u of unionTypes2) {
|
|
60759
60726
|
if (!containsType(u.types, type)) {
|
|
60760
|
-
const primitive = type.flags & 128 /* StringLiteral */ ? stringType : type.flags & 256 /* NumberLiteral */ ? numberType : type.flags & 2048 /* BigIntLiteral */ ? bigintType : type.flags & 8192 /* UniqueESSymbol */ ? esSymbolType : void 0;
|
|
60727
|
+
const primitive = type.flags & 128 /* StringLiteral */ ? stringType : type.flags & (32 /* Enum */ | 256 /* NumberLiteral */) ? numberType : type.flags & 2048 /* BigIntLiteral */ ? bigintType : type.flags & 8192 /* UniqueESSymbol */ ? esSymbolType : void 0;
|
|
60761
60728
|
if (!primitive || !containsType(u.types, primitive)) {
|
|
60762
60729
|
return false;
|
|
60763
60730
|
}
|
|
@@ -60784,9 +60751,6 @@ function createTypeChecker(host) {
|
|
|
60784
60751
|
}
|
|
60785
60752
|
return false;
|
|
60786
60753
|
}
|
|
60787
|
-
function eachIsUnionContaining(types, flag) {
|
|
60788
|
-
return every(types, (t) => !!(t.flags & 1048576 /* Union */) && some(t.types, (tt) => !!(tt.flags & flag)));
|
|
60789
|
-
}
|
|
60790
60754
|
function removeFromEach(types, flag) {
|
|
60791
60755
|
for (let i = 0; i < types.length; i++) {
|
|
60792
60756
|
types[i] = filterType(types[i], (t) => !(t.flags & flag));
|
|
@@ -60875,11 +60839,11 @@ function createTypeChecker(host) {
|
|
|
60875
60839
|
if (includes & 1048576 /* Union */) {
|
|
60876
60840
|
if (intersectUnionsOfPrimitiveTypes(typeSet)) {
|
|
60877
60841
|
result = getIntersectionType(typeSet, aliasSymbol, aliasTypeArguments);
|
|
60878
|
-
} else if (
|
|
60842
|
+
} else if (every(typeSet, (t) => !!(t.flags & 1048576 /* Union */ && t.types[0].flags & 32768 /* Undefined */))) {
|
|
60879
60843
|
const containedUndefinedType = some(typeSet, containsMissingType) ? missingType : undefinedType;
|
|
60880
60844
|
removeFromEach(typeSet, 32768 /* Undefined */);
|
|
60881
60845
|
result = getUnionType([getIntersectionType(typeSet), containedUndefinedType], 1 /* Literal */, aliasSymbol, aliasTypeArguments);
|
|
60882
|
-
} else if (
|
|
60846
|
+
} else if (every(typeSet, (t) => !!(t.flags & 1048576 /* Union */ && (t.types[0].flags & 65536 /* Null */ || t.types[1].flags & 65536 /* Null */)))) {
|
|
60883
60847
|
removeFromEach(typeSet, 65536 /* Null */);
|
|
60884
60848
|
result = getUnionType([getIntersectionType(typeSet), nullType], 1 /* Literal */, aliasSymbol, aliasTypeArguments);
|
|
60885
60849
|
} else {
|
|
@@ -64404,6 +64368,11 @@ function createTypeChecker(host) {
|
|
|
64404
64368
|
if (containsType(targetTypes, source2)) {
|
|
64405
64369
|
return -1 /* True */;
|
|
64406
64370
|
}
|
|
64371
|
+
if (getObjectFlags(target2) & 32768 /* PrimitiveUnion */ && !(source2.flags & 1024 /* EnumLiteral */) && (source2.flags & (128 /* StringLiteral */ | 512 /* BooleanLiteral */ | 2048 /* BigIntLiteral */) || (relation === subtypeRelation || relation === strictSubtypeRelation) && source2.flags & 256 /* NumberLiteral */)) {
|
|
64372
|
+
const alternateForm = source2 === source2.regularType ? source2.freshType : source2.regularType;
|
|
64373
|
+
const primitive = source2.flags & 128 /* StringLiteral */ ? stringType : source2.flags & 256 /* NumberLiteral */ ? numberType : source2.flags & 2048 /* BigIntLiteral */ ? bigintType : void 0;
|
|
64374
|
+
return primitive && containsType(targetTypes, primitive) || alternateForm && containsType(targetTypes, alternateForm) ? -1 /* True */ : 0 /* False */;
|
|
64375
|
+
}
|
|
64407
64376
|
const match = getMatchingUnionConstituentForType(target2, source2);
|
|
64408
64377
|
if (match) {
|
|
64409
64378
|
const related = isRelatedTo(
|
|
@@ -69705,8 +69674,8 @@ function createTypeChecker(host) {
|
|
|
69705
69674
|
if (symbol === void 0) {
|
|
69706
69675
|
return type;
|
|
69707
69676
|
}
|
|
69708
|
-
const classSymbol =
|
|
69709
|
-
const targetType = hasStaticModifier(Debug.checkDefined(symbol.valueDeclaration, "should always have a declaration")) ? getTypeOfSymbol(classSymbol) :
|
|
69677
|
+
const classSymbol = symbol.parent;
|
|
69678
|
+
const targetType = hasStaticModifier(Debug.checkDefined(symbol.valueDeclaration, "should always have a declaration")) ? getTypeOfSymbol(classSymbol) : getDeclaredTypeOfSymbol(classSymbol);
|
|
69710
69679
|
return getNarrowedType(
|
|
69711
69680
|
type,
|
|
69712
69681
|
targetType,
|
|
@@ -75761,6 +75730,12 @@ function createTypeChecker(host) {
|
|
|
75761
75730
|
function checkExpressionWithTypeArguments(node) {
|
|
75762
75731
|
checkGrammarExpressionWithTypeArguments(node);
|
|
75763
75732
|
forEach(node.typeArguments, checkSourceElement);
|
|
75733
|
+
if (node.kind === 231 /* ExpressionWithTypeArguments */) {
|
|
75734
|
+
const parent2 = walkUpParenthesizedExpressions(node.parent);
|
|
75735
|
+
if (parent2.kind === 224 /* BinaryExpression */ && parent2.operatorToken.kind === 103 /* InstanceOfKeyword */ && isNodeDescendantOf(node, parent2.right)) {
|
|
75736
|
+
error(node, Diagnostics.The_right_hand_side_of_an_instanceof_expression_must_not_be_an_instantiation_expression);
|
|
75737
|
+
}
|
|
75738
|
+
}
|
|
75764
75739
|
const exprType = node.kind === 231 /* ExpressionWithTypeArguments */ ? checkExpression(node.expression) : isThisIdentifier(node.exprName) ? checkThisExpression(node.exprName) : checkExpression(node.exprName);
|
|
75765
75740
|
return getInstantiationExpressionType(exprType, node);
|
|
75766
75741
|
}
|
|
@@ -76718,7 +76693,7 @@ function createTypeChecker(host) {
|
|
|
76718
76693
|
function checkAllCodePathsInNonVoidFunctionReturnOrThrowDiagnostics() {
|
|
76719
76694
|
const functionFlags = getFunctionFlags(func);
|
|
76720
76695
|
const type = returnType && unwrapReturnType(returnType, functionFlags);
|
|
76721
|
-
if (type && maybeTypeOfKind(type,
|
|
76696
|
+
if (type && maybeTypeOfKind(type, 32768 /* Undefined */ | 16384 /* Void */ | 1 /* Any */)) {
|
|
76722
76697
|
return;
|
|
76723
76698
|
}
|
|
76724
76699
|
if (func.kind === 171 /* MethodSignature */ || nodeIsMissing(func.body) || func.body.kind !== 239 /* Block */ || !functionHasImplicitReturn(func)) {
|
|
@@ -76729,8 +76704,12 @@ function createTypeChecker(host) {
|
|
|
76729
76704
|
if (type && type.flags & 131072 /* Never */) {
|
|
76730
76705
|
error(errorNode, Diagnostics.A_function_returning_never_cannot_have_a_reachable_end_point);
|
|
76731
76706
|
} else if (type && !hasExplicitReturn) {
|
|
76732
|
-
|
|
76733
|
-
|
|
76707
|
+
if (strictNullChecks) {
|
|
76708
|
+
error(errorNode, Diagnostics.A_function_whose_declared_type_is_neither_undefined_void_nor_any_must_return_a_value);
|
|
76709
|
+
} else {
|
|
76710
|
+
error(errorNode, Diagnostics.A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value);
|
|
76711
|
+
}
|
|
76712
|
+
} else if (type && strictNullChecks) {
|
|
76734
76713
|
error(errorNode, Diagnostics.Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined);
|
|
76735
76714
|
} else if (compilerOptions.noImplicitReturns) {
|
|
76736
76715
|
if (!type) {
|
|
@@ -143658,6 +143637,7 @@ var fixRemoveBracesFromArrowFunctionBody = "fixRemoveBracesFromArrowFunctionBody
|
|
|
143658
143637
|
var fixIdWrapTheBlockWithParen = "fixWrapTheBlockWithParen";
|
|
143659
143638
|
var errorCodes26 = [
|
|
143660
143639
|
Diagnostics.A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value.code,
|
|
143640
|
+
Diagnostics.A_function_whose_declared_type_is_neither_undefined_void_nor_any_must_return_a_value.code,
|
|
143661
143641
|
Diagnostics.Type_0_is_not_assignable_to_type_1.code,
|
|
143662
143642
|
Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1.code
|
|
143663
143643
|
];
|
|
@@ -143809,6 +143789,7 @@ function getInfo6(checker, sourceFile, position, errorCode) {
|
|
|
143809
143789
|
const declaration = findAncestor(node.parent, isFunctionLikeDeclaration);
|
|
143810
143790
|
switch (errorCode) {
|
|
143811
143791
|
case Diagnostics.A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value.code:
|
|
143792
|
+
case Diagnostics.A_function_whose_declared_type_is_neither_undefined_void_nor_any_must_return_a_value.code:
|
|
143812
143793
|
if (!declaration || !declaration.body || !declaration.type || !rangeContainsRange(declaration.type, node))
|
|
143813
143794
|
return void 0;
|
|
143814
143795
|
return getFixInfo(
|
package/lib/tsserverlibrary.d.ts
CHANGED
|
@@ -7141,7 +7141,6 @@ declare namespace ts {
|
|
|
7141
7141
|
strictBindCallApply?: boolean;
|
|
7142
7142
|
strictNullChecks?: boolean;
|
|
7143
7143
|
strictPropertyInitialization?: boolean;
|
|
7144
|
-
strictInstanceOfTypeParameters?: boolean;
|
|
7145
7144
|
stripInternal?: boolean;
|
|
7146
7145
|
suppressExcessPropertyErrors?: boolean;
|
|
7147
7146
|
suppressImplicitAnyIndexErrors?: boolean;
|
package/lib/tsserverlibrary.js
CHANGED
|
@@ -35,7 +35,7 @@ var ts = (() => {
|
|
|
35
35
|
"src/compiler/corePublic.ts"() {
|
|
36
36
|
"use strict";
|
|
37
37
|
versionMajorMinor = "5.1";
|
|
38
|
-
version = `${versionMajorMinor}.0-insiders.
|
|
38
|
+
version = `${versionMajorMinor}.0-insiders.20230317`;
|
|
39
39
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
40
40
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
41
41
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -4449,7 +4449,7 @@ ${lanes.join("\n")}
|
|
|
4449
4449
|
TypeFlags2[TypeFlags2["IncludesWildcard"] = 8388608 /* IndexedAccess */] = "IncludesWildcard";
|
|
4450
4450
|
TypeFlags2[TypeFlags2["IncludesEmptyObject"] = 16777216 /* Conditional */] = "IncludesEmptyObject";
|
|
4451
4451
|
TypeFlags2[TypeFlags2["IncludesInstantiable"] = 33554432 /* Substitution */] = "IncludesInstantiable";
|
|
4452
|
-
TypeFlags2[TypeFlags2["NotPrimitiveUnion"] =
|
|
4452
|
+
TypeFlags2[TypeFlags2["NotPrimitiveUnion"] = 36323331] = "NotPrimitiveUnion";
|
|
4453
4453
|
return TypeFlags2;
|
|
4454
4454
|
})(TypeFlags || {});
|
|
4455
4455
|
ObjectFlags = /* @__PURE__ */ ((ObjectFlags3) => {
|
|
@@ -7942,6 +7942,8 @@ ${lanes.join("\n")}
|
|
|
7942
7942
|
Type_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: diag(2844, 1 /* Error */, "Type_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2844", "Type of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor."),
|
|
7943
7943
|
This_condition_will_always_return_0: diag(2845, 1 /* Error */, "This_condition_will_always_return_0_2845", "This condition will always return '{0}'."),
|
|
7944
7944
|
A_declaration_file_cannot_be_imported_without_import_type_Did_you_mean_to_import_an_implementation_file_0_instead: diag(2846, 1 /* Error */, "A_declaration_file_cannot_be_imported_without_import_type_Did_you_mean_to_import_an_implementation_f_2846", "A declaration file cannot be imported without 'import type'. Did you mean to import an implementation file '{0}' instead?"),
|
|
7945
|
+
A_function_whose_declared_type_is_neither_undefined_void_nor_any_must_return_a_value: diag(2847, 1 /* Error */, "A_function_whose_declared_type_is_neither_undefined_void_nor_any_must_return_a_value_2847", "A function whose declared type is neither 'undefined', 'void', nor 'any' must return a value."),
|
|
7946
|
+
The_right_hand_side_of_an_instanceof_expression_must_not_be_an_instantiation_expression: diag(2848, 1 /* Error */, "The_right_hand_side_of_an_instanceof_expression_must_not_be_an_instantiation_expression_2848", "The right-hand side of an 'instanceof' expression must not be an instantiation expression."),
|
|
7945
7947
|
Import_declaration_0_is_using_private_name_1: diag(4e3, 1 /* Error */, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."),
|
|
7946
7948
|
Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, 1 /* 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}'."),
|
|
7947
7949
|
Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, 1 /* 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}'."),
|
|
@@ -8619,7 +8621,6 @@ ${lanes.join("\n")}
|
|
|
8619
8621
|
Specify_emit_Slashchecking_behavior_for_imports_that_are_only_used_for_types: diag(6718, 3 /* Message */, "Specify_emit_Slashchecking_behavior_for_imports_that_are_only_used_for_types_6718", "Specify emit/checking behavior for imports that are only used for types."),
|
|
8620
8622
|
Default_catch_clause_variables_as_unknown_instead_of_any: diag(6803, 3 /* Message */, "Default_catch_clause_variables_as_unknown_instead_of_any_6803", "Default catch clause variables as 'unknown' instead of 'any'."),
|
|
8621
8623
|
Do_not_transform_or_elide_any_imports_or_exports_not_marked_as_type_only_ensuring_they_are_written_in_the_output_file_s_format_based_on_the_module_setting: diag(6804, 3 /* Message */, "Do_not_transform_or_elide_any_imports_or_exports_not_marked_as_type_only_ensuring_they_are_written_i_6804", "Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting."),
|
|
8622
|
-
Default_type_arguments_to_parameter_constraint_or_unknown_instead_of_any_for_instance_checks: diag(6805, 3 /* Message */, "Default_type_arguments_to_parameter_constraint_or_unknown_instead_of_any_for_instance_checks_6805", "Default type arguments to parameter constraint or 'unknown' instead of 'any' for instance checks."),
|
|
8623
8624
|
one_of_Colon: diag(6900, 3 /* Message */, "one_of_Colon_6900", "one of:"),
|
|
8624
8625
|
one_or_more_Colon: diag(6901, 3 /* Message */, "one_or_more_Colon_6901", "one or more:"),
|
|
8625
8626
|
type_Colon: diag(6902, 3 /* Message */, "type_Colon_6902", "type:"),
|
|
@@ -37849,16 +37850,6 @@ ${lanes.join("\n")}
|
|
|
37849
37850
|
description: Diagnostics.Default_catch_clause_variables_as_unknown_instead_of_any,
|
|
37850
37851
|
defaultValueDescription: false
|
|
37851
37852
|
},
|
|
37852
|
-
{
|
|
37853
|
-
name: "strictInstanceOfTypeParameters",
|
|
37854
|
-
type: "boolean",
|
|
37855
|
-
affectsSemanticDiagnostics: true,
|
|
37856
|
-
affectsBuildInfo: true,
|
|
37857
|
-
strictFlag: true,
|
|
37858
|
-
category: Diagnostics.Type_Checking,
|
|
37859
|
-
description: Diagnostics.Default_type_arguments_to_parameter_constraint_or_unknown_instead_of_any_for_instance_checks,
|
|
37860
|
-
defaultValueDescription: false
|
|
37861
|
-
},
|
|
37862
37853
|
{
|
|
37863
37854
|
name: "alwaysStrict",
|
|
37864
37855
|
type: "boolean",
|
|
@@ -45079,7 +45070,6 @@ ${lanes.join("\n")}
|
|
|
45079
45070
|
var noImplicitAny = getStrictOptionValue(compilerOptions, "noImplicitAny");
|
|
45080
45071
|
var noImplicitThis = getStrictOptionValue(compilerOptions, "noImplicitThis");
|
|
45081
45072
|
var useUnknownInCatchVariables = getStrictOptionValue(compilerOptions, "useUnknownInCatchVariables");
|
|
45082
|
-
var strictInstanceOfTypeParameters = true;
|
|
45083
45073
|
var keyofStringsOnly = !!compilerOptions.keyofStringsOnly;
|
|
45084
45074
|
var defaultIndexFlags = keyofStringsOnly ? 1 /* StringsOnly */ : 0 /* None */;
|
|
45085
45075
|
var freshObjectLiteralFlag = compilerOptions.suppressExcessPropertyErrors ? 0 : 8192 /* FreshLiteral */;
|
|
@@ -53046,32 +53036,9 @@ ${lanes.join("\n")}
|
|
|
53046
53036
|
}
|
|
53047
53037
|
}).parent;
|
|
53048
53038
|
}
|
|
53049
|
-
function getInstanceTypeOfClassSymbol(classSymbol) {
|
|
53050
|
-
const classType = getDeclaredTypeOfSymbol(classSymbol);
|
|
53051
|
-
const objectFlags = getObjectFlags(classType);
|
|
53052
|
-
if (!(objectFlags & 3 /* ClassOrInterface */) || !classType.typeParameters) {
|
|
53053
|
-
return classType;
|
|
53054
|
-
}
|
|
53055
|
-
const variances = getVariances(classType);
|
|
53056
|
-
const typeArguments = map(classType.typeParameters, (typeParameter, i) => {
|
|
53057
|
-
if (!strictInstanceOfTypeParameters) {
|
|
53058
|
-
return anyType;
|
|
53059
|
-
}
|
|
53060
|
-
const variance = variances[i];
|
|
53061
|
-
switch (variance & 7 /* VarianceMask */) {
|
|
53062
|
-
case 4 /* Independent */:
|
|
53063
|
-
case 3 /* Bivariant */:
|
|
53064
|
-
return anyType;
|
|
53065
|
-
case 0 /* Invariant */:
|
|
53066
|
-
return unknownType;
|
|
53067
|
-
}
|
|
53068
|
-
return getBaseConstraintOfType(typeParameter) || unknownType;
|
|
53069
|
-
});
|
|
53070
|
-
return createTypeReference(classType, typeArguments);
|
|
53071
|
-
}
|
|
53072
53039
|
function getTypeOfPrototypeProperty(prototype) {
|
|
53073
|
-
const
|
|
53074
|
-
return
|
|
53040
|
+
const classType = getDeclaredTypeOfSymbol(getParentOfSymbol(prototype));
|
|
53041
|
+
return classType.typeParameters ? createTypeReference(classType, map(classType.typeParameters, (_) => anyType)) : classType;
|
|
53075
53042
|
}
|
|
53076
53043
|
function getTypeOfPropertyOfType(type, name) {
|
|
53077
53044
|
const prop = getPropertyOfType(type, name);
|
|
@@ -58442,7 +58409,7 @@ ${lanes.join("\n")}
|
|
|
58442
58409
|
origin = createOriginUnionOrIntersectionType(1048576 /* Union */, reducedTypes);
|
|
58443
58410
|
}
|
|
58444
58411
|
}
|
|
58445
|
-
const objectFlags = (includes &
|
|
58412
|
+
const objectFlags = (includes & 36323331 /* NotPrimitiveUnion */ ? 0 : 32768 /* PrimitiveUnion */) | (includes & 2097152 /* Intersection */ ? 16777216 /* ContainsIntersections */ : 0);
|
|
58446
58413
|
return getUnionTypeFromSortedList(typeSet, objectFlags, aliasSymbol, aliasTypeArguments, origin);
|
|
58447
58414
|
}
|
|
58448
58415
|
function getUnionOrIntersectionTypePredicate(signatures, kind) {
|
|
@@ -58567,7 +58534,7 @@ ${lanes.join("\n")}
|
|
|
58567
58534
|
function eachUnionContains(unionTypes2, type) {
|
|
58568
58535
|
for (const u of unionTypes2) {
|
|
58569
58536
|
if (!containsType(u.types, type)) {
|
|
58570
|
-
const primitive = type.flags & 128 /* StringLiteral */ ? stringType : type.flags & 256 /* NumberLiteral */ ? numberType : type.flags & 2048 /* BigIntLiteral */ ? bigintType : type.flags & 8192 /* UniqueESSymbol */ ? esSymbolType : void 0;
|
|
58537
|
+
const primitive = type.flags & 128 /* StringLiteral */ ? stringType : type.flags & (32 /* Enum */ | 256 /* NumberLiteral */) ? numberType : type.flags & 2048 /* BigIntLiteral */ ? bigintType : type.flags & 8192 /* UniqueESSymbol */ ? esSymbolType : void 0;
|
|
58571
58538
|
if (!primitive || !containsType(u.types, primitive)) {
|
|
58572
58539
|
return false;
|
|
58573
58540
|
}
|
|
@@ -58594,9 +58561,6 @@ ${lanes.join("\n")}
|
|
|
58594
58561
|
}
|
|
58595
58562
|
return false;
|
|
58596
58563
|
}
|
|
58597
|
-
function eachIsUnionContaining(types, flag) {
|
|
58598
|
-
return every(types, (t) => !!(t.flags & 1048576 /* Union */) && some(t.types, (tt) => !!(tt.flags & flag)));
|
|
58599
|
-
}
|
|
58600
58564
|
function removeFromEach(types, flag) {
|
|
58601
58565
|
for (let i = 0; i < types.length; i++) {
|
|
58602
58566
|
types[i] = filterType(types[i], (t) => !(t.flags & flag));
|
|
@@ -58685,11 +58649,11 @@ ${lanes.join("\n")}
|
|
|
58685
58649
|
if (includes & 1048576 /* Union */) {
|
|
58686
58650
|
if (intersectUnionsOfPrimitiveTypes(typeSet)) {
|
|
58687
58651
|
result = getIntersectionType(typeSet, aliasSymbol, aliasTypeArguments);
|
|
58688
|
-
} else if (
|
|
58652
|
+
} else if (every(typeSet, (t) => !!(t.flags & 1048576 /* Union */ && t.types[0].flags & 32768 /* Undefined */))) {
|
|
58689
58653
|
const containedUndefinedType = some(typeSet, containsMissingType) ? missingType : undefinedType;
|
|
58690
58654
|
removeFromEach(typeSet, 32768 /* Undefined */);
|
|
58691
58655
|
result = getUnionType([getIntersectionType(typeSet), containedUndefinedType], 1 /* Literal */, aliasSymbol, aliasTypeArguments);
|
|
58692
|
-
} else if (
|
|
58656
|
+
} else if (every(typeSet, (t) => !!(t.flags & 1048576 /* Union */ && (t.types[0].flags & 65536 /* Null */ || t.types[1].flags & 65536 /* Null */)))) {
|
|
58693
58657
|
removeFromEach(typeSet, 65536 /* Null */);
|
|
58694
58658
|
result = getUnionType([getIntersectionType(typeSet), nullType], 1 /* Literal */, aliasSymbol, aliasTypeArguments);
|
|
58695
58659
|
} else {
|
|
@@ -62214,6 +62178,11 @@ ${lanes.join("\n")}
|
|
|
62214
62178
|
if (containsType(targetTypes, source2)) {
|
|
62215
62179
|
return -1 /* True */;
|
|
62216
62180
|
}
|
|
62181
|
+
if (getObjectFlags(target2) & 32768 /* PrimitiveUnion */ && !(source2.flags & 1024 /* EnumLiteral */) && (source2.flags & (128 /* StringLiteral */ | 512 /* BooleanLiteral */ | 2048 /* BigIntLiteral */) || (relation === subtypeRelation || relation === strictSubtypeRelation) && source2.flags & 256 /* NumberLiteral */)) {
|
|
62182
|
+
const alternateForm = source2 === source2.regularType ? source2.freshType : source2.regularType;
|
|
62183
|
+
const primitive = source2.flags & 128 /* StringLiteral */ ? stringType : source2.flags & 256 /* NumberLiteral */ ? numberType : source2.flags & 2048 /* BigIntLiteral */ ? bigintType : void 0;
|
|
62184
|
+
return primitive && containsType(targetTypes, primitive) || alternateForm && containsType(targetTypes, alternateForm) ? -1 /* True */ : 0 /* False */;
|
|
62185
|
+
}
|
|
62217
62186
|
const match = getMatchingUnionConstituentForType(target2, source2);
|
|
62218
62187
|
if (match) {
|
|
62219
62188
|
const related = isRelatedTo(
|
|
@@ -67515,8 +67484,8 @@ ${lanes.join("\n")}
|
|
|
67515
67484
|
if (symbol === void 0) {
|
|
67516
67485
|
return type;
|
|
67517
67486
|
}
|
|
67518
|
-
const classSymbol =
|
|
67519
|
-
const targetType = hasStaticModifier(Debug.checkDefined(symbol.valueDeclaration, "should always have a declaration")) ? getTypeOfSymbol(classSymbol) :
|
|
67487
|
+
const classSymbol = symbol.parent;
|
|
67488
|
+
const targetType = hasStaticModifier(Debug.checkDefined(symbol.valueDeclaration, "should always have a declaration")) ? getTypeOfSymbol(classSymbol) : getDeclaredTypeOfSymbol(classSymbol);
|
|
67520
67489
|
return getNarrowedType(
|
|
67521
67490
|
type,
|
|
67522
67491
|
targetType,
|
|
@@ -73571,6 +73540,12 @@ ${lanes.join("\n")}
|
|
|
73571
73540
|
function checkExpressionWithTypeArguments(node) {
|
|
73572
73541
|
checkGrammarExpressionWithTypeArguments(node);
|
|
73573
73542
|
forEach(node.typeArguments, checkSourceElement);
|
|
73543
|
+
if (node.kind === 231 /* ExpressionWithTypeArguments */) {
|
|
73544
|
+
const parent2 = walkUpParenthesizedExpressions(node.parent);
|
|
73545
|
+
if (parent2.kind === 224 /* BinaryExpression */ && parent2.operatorToken.kind === 103 /* InstanceOfKeyword */ && isNodeDescendantOf(node, parent2.right)) {
|
|
73546
|
+
error(node, Diagnostics.The_right_hand_side_of_an_instanceof_expression_must_not_be_an_instantiation_expression);
|
|
73547
|
+
}
|
|
73548
|
+
}
|
|
73574
73549
|
const exprType = node.kind === 231 /* ExpressionWithTypeArguments */ ? checkExpression(node.expression) : isThisIdentifier(node.exprName) ? checkThisExpression(node.exprName) : checkExpression(node.exprName);
|
|
73575
73550
|
return getInstantiationExpressionType(exprType, node);
|
|
73576
73551
|
}
|
|
@@ -74528,7 +74503,7 @@ ${lanes.join("\n")}
|
|
|
74528
74503
|
function checkAllCodePathsInNonVoidFunctionReturnOrThrowDiagnostics() {
|
|
74529
74504
|
const functionFlags = getFunctionFlags(func);
|
|
74530
74505
|
const type = returnType && unwrapReturnType(returnType, functionFlags);
|
|
74531
|
-
if (type && maybeTypeOfKind(type,
|
|
74506
|
+
if (type && maybeTypeOfKind(type, 32768 /* Undefined */ | 16384 /* Void */ | 1 /* Any */)) {
|
|
74532
74507
|
return;
|
|
74533
74508
|
}
|
|
74534
74509
|
if (func.kind === 171 /* MethodSignature */ || nodeIsMissing(func.body) || func.body.kind !== 239 /* Block */ || !functionHasImplicitReturn(func)) {
|
|
@@ -74539,8 +74514,12 @@ ${lanes.join("\n")}
|
|
|
74539
74514
|
if (type && type.flags & 131072 /* Never */) {
|
|
74540
74515
|
error(errorNode, Diagnostics.A_function_returning_never_cannot_have_a_reachable_end_point);
|
|
74541
74516
|
} else if (type && !hasExplicitReturn) {
|
|
74542
|
-
|
|
74543
|
-
|
|
74517
|
+
if (strictNullChecks) {
|
|
74518
|
+
error(errorNode, Diagnostics.A_function_whose_declared_type_is_neither_undefined_void_nor_any_must_return_a_value);
|
|
74519
|
+
} else {
|
|
74520
|
+
error(errorNode, Diagnostics.A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value);
|
|
74521
|
+
}
|
|
74522
|
+
} else if (type && strictNullChecks) {
|
|
74544
74523
|
error(errorNode, Diagnostics.Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined);
|
|
74545
74524
|
} else if (compilerOptions.noImplicitReturns) {
|
|
74546
74525
|
if (!type) {
|
|
@@ -142428,6 +142407,7 @@ ${lanes.join("\n")}
|
|
|
142428
142407
|
const declaration = findAncestor(node.parent, isFunctionLikeDeclaration);
|
|
142429
142408
|
switch (errorCode) {
|
|
142430
142409
|
case Diagnostics.A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value.code:
|
|
142410
|
+
case Diagnostics.A_function_whose_declared_type_is_neither_undefined_void_nor_any_must_return_a_value.code:
|
|
142431
142411
|
if (!declaration || !declaration.body || !declaration.type || !rangeContainsRange(declaration.type, node))
|
|
142432
142412
|
return void 0;
|
|
142433
142413
|
return getFixInfo(
|
|
@@ -142535,6 +142515,7 @@ ${lanes.join("\n")}
|
|
|
142535
142515
|
fixIdWrapTheBlockWithParen = "fixWrapTheBlockWithParen";
|
|
142536
142516
|
errorCodes26 = [
|
|
142537
142517
|
Diagnostics.A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value.code,
|
|
142518
|
+
Diagnostics.A_function_whose_declared_type_is_neither_undefined_void_nor_any_must_return_a_value.code,
|
|
142538
142519
|
Diagnostics.Type_0_is_not_assignable_to_type_1.code,
|
|
142539
142520
|
Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1.code
|
|
142540
142521
|
];
|
package/lib/typescript.d.ts
CHANGED
|
@@ -3198,7 +3198,6 @@ declare namespace ts {
|
|
|
3198
3198
|
strictBindCallApply?: boolean;
|
|
3199
3199
|
strictNullChecks?: boolean;
|
|
3200
3200
|
strictPropertyInitialization?: boolean;
|
|
3201
|
-
strictInstanceOfTypeParameters?: boolean;
|
|
3202
3201
|
stripInternal?: boolean;
|
|
3203
3202
|
suppressExcessPropertyErrors?: boolean;
|
|
3204
3203
|
suppressImplicitAnyIndexErrors?: boolean;
|
package/lib/typescript.js
CHANGED
|
@@ -35,7 +35,7 @@ var ts = (() => {
|
|
|
35
35
|
"src/compiler/corePublic.ts"() {
|
|
36
36
|
"use strict";
|
|
37
37
|
versionMajorMinor = "5.1";
|
|
38
|
-
version = `${versionMajorMinor}.0-insiders.
|
|
38
|
+
version = `${versionMajorMinor}.0-insiders.20230317`;
|
|
39
39
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
40
40
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
41
41
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -4449,7 +4449,7 @@ ${lanes.join("\n")}
|
|
|
4449
4449
|
TypeFlags2[TypeFlags2["IncludesWildcard"] = 8388608 /* IndexedAccess */] = "IncludesWildcard";
|
|
4450
4450
|
TypeFlags2[TypeFlags2["IncludesEmptyObject"] = 16777216 /* Conditional */] = "IncludesEmptyObject";
|
|
4451
4451
|
TypeFlags2[TypeFlags2["IncludesInstantiable"] = 33554432 /* Substitution */] = "IncludesInstantiable";
|
|
4452
|
-
TypeFlags2[TypeFlags2["NotPrimitiveUnion"] =
|
|
4452
|
+
TypeFlags2[TypeFlags2["NotPrimitiveUnion"] = 36323331] = "NotPrimitiveUnion";
|
|
4453
4453
|
return TypeFlags2;
|
|
4454
4454
|
})(TypeFlags || {});
|
|
4455
4455
|
ObjectFlags = /* @__PURE__ */ ((ObjectFlags3) => {
|
|
@@ -7942,6 +7942,8 @@ ${lanes.join("\n")}
|
|
|
7942
7942
|
Type_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: diag(2844, 1 /* Error */, "Type_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2844", "Type of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor."),
|
|
7943
7943
|
This_condition_will_always_return_0: diag(2845, 1 /* Error */, "This_condition_will_always_return_0_2845", "This condition will always return '{0}'."),
|
|
7944
7944
|
A_declaration_file_cannot_be_imported_without_import_type_Did_you_mean_to_import_an_implementation_file_0_instead: diag(2846, 1 /* Error */, "A_declaration_file_cannot_be_imported_without_import_type_Did_you_mean_to_import_an_implementation_f_2846", "A declaration file cannot be imported without 'import type'. Did you mean to import an implementation file '{0}' instead?"),
|
|
7945
|
+
A_function_whose_declared_type_is_neither_undefined_void_nor_any_must_return_a_value: diag(2847, 1 /* Error */, "A_function_whose_declared_type_is_neither_undefined_void_nor_any_must_return_a_value_2847", "A function whose declared type is neither 'undefined', 'void', nor 'any' must return a value."),
|
|
7946
|
+
The_right_hand_side_of_an_instanceof_expression_must_not_be_an_instantiation_expression: diag(2848, 1 /* Error */, "The_right_hand_side_of_an_instanceof_expression_must_not_be_an_instantiation_expression_2848", "The right-hand side of an 'instanceof' expression must not be an instantiation expression."),
|
|
7945
7947
|
Import_declaration_0_is_using_private_name_1: diag(4e3, 1 /* Error */, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."),
|
|
7946
7948
|
Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, 1 /* 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}'."),
|
|
7947
7949
|
Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, 1 /* 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}'."),
|
|
@@ -8619,7 +8621,6 @@ ${lanes.join("\n")}
|
|
|
8619
8621
|
Specify_emit_Slashchecking_behavior_for_imports_that_are_only_used_for_types: diag(6718, 3 /* Message */, "Specify_emit_Slashchecking_behavior_for_imports_that_are_only_used_for_types_6718", "Specify emit/checking behavior for imports that are only used for types."),
|
|
8620
8622
|
Default_catch_clause_variables_as_unknown_instead_of_any: diag(6803, 3 /* Message */, "Default_catch_clause_variables_as_unknown_instead_of_any_6803", "Default catch clause variables as 'unknown' instead of 'any'."),
|
|
8621
8623
|
Do_not_transform_or_elide_any_imports_or_exports_not_marked_as_type_only_ensuring_they_are_written_in_the_output_file_s_format_based_on_the_module_setting: diag(6804, 3 /* Message */, "Do_not_transform_or_elide_any_imports_or_exports_not_marked_as_type_only_ensuring_they_are_written_i_6804", "Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting."),
|
|
8622
|
-
Default_type_arguments_to_parameter_constraint_or_unknown_instead_of_any_for_instance_checks: diag(6805, 3 /* Message */, "Default_type_arguments_to_parameter_constraint_or_unknown_instead_of_any_for_instance_checks_6805", "Default type arguments to parameter constraint or 'unknown' instead of 'any' for instance checks."),
|
|
8623
8624
|
one_of_Colon: diag(6900, 3 /* Message */, "one_of_Colon_6900", "one of:"),
|
|
8624
8625
|
one_or_more_Colon: diag(6901, 3 /* Message */, "one_or_more_Colon_6901", "one or more:"),
|
|
8625
8626
|
type_Colon: diag(6902, 3 /* Message */, "type_Colon_6902", "type:"),
|
|
@@ -37849,16 +37850,6 @@ ${lanes.join("\n")}
|
|
|
37849
37850
|
description: Diagnostics.Default_catch_clause_variables_as_unknown_instead_of_any,
|
|
37850
37851
|
defaultValueDescription: false
|
|
37851
37852
|
},
|
|
37852
|
-
{
|
|
37853
|
-
name: "strictInstanceOfTypeParameters",
|
|
37854
|
-
type: "boolean",
|
|
37855
|
-
affectsSemanticDiagnostics: true,
|
|
37856
|
-
affectsBuildInfo: true,
|
|
37857
|
-
strictFlag: true,
|
|
37858
|
-
category: Diagnostics.Type_Checking,
|
|
37859
|
-
description: Diagnostics.Default_type_arguments_to_parameter_constraint_or_unknown_instead_of_any_for_instance_checks,
|
|
37860
|
-
defaultValueDescription: false
|
|
37861
|
-
},
|
|
37862
37853
|
{
|
|
37863
37854
|
name: "alwaysStrict",
|
|
37864
37855
|
type: "boolean",
|
|
@@ -45079,7 +45070,6 @@ ${lanes.join("\n")}
|
|
|
45079
45070
|
var noImplicitAny = getStrictOptionValue(compilerOptions, "noImplicitAny");
|
|
45080
45071
|
var noImplicitThis = getStrictOptionValue(compilerOptions, "noImplicitThis");
|
|
45081
45072
|
var useUnknownInCatchVariables = getStrictOptionValue(compilerOptions, "useUnknownInCatchVariables");
|
|
45082
|
-
var strictInstanceOfTypeParameters = true;
|
|
45083
45073
|
var keyofStringsOnly = !!compilerOptions.keyofStringsOnly;
|
|
45084
45074
|
var defaultIndexFlags = keyofStringsOnly ? 1 /* StringsOnly */ : 0 /* None */;
|
|
45085
45075
|
var freshObjectLiteralFlag = compilerOptions.suppressExcessPropertyErrors ? 0 : 8192 /* FreshLiteral */;
|
|
@@ -53046,32 +53036,9 @@ ${lanes.join("\n")}
|
|
|
53046
53036
|
}
|
|
53047
53037
|
}).parent;
|
|
53048
53038
|
}
|
|
53049
|
-
function getInstanceTypeOfClassSymbol(classSymbol) {
|
|
53050
|
-
const classType = getDeclaredTypeOfSymbol(classSymbol);
|
|
53051
|
-
const objectFlags = getObjectFlags(classType);
|
|
53052
|
-
if (!(objectFlags & 3 /* ClassOrInterface */) || !classType.typeParameters) {
|
|
53053
|
-
return classType;
|
|
53054
|
-
}
|
|
53055
|
-
const variances = getVariances(classType);
|
|
53056
|
-
const typeArguments = map(classType.typeParameters, (typeParameter, i) => {
|
|
53057
|
-
if (!strictInstanceOfTypeParameters) {
|
|
53058
|
-
return anyType;
|
|
53059
|
-
}
|
|
53060
|
-
const variance = variances[i];
|
|
53061
|
-
switch (variance & 7 /* VarianceMask */) {
|
|
53062
|
-
case 4 /* Independent */:
|
|
53063
|
-
case 3 /* Bivariant */:
|
|
53064
|
-
return anyType;
|
|
53065
|
-
case 0 /* Invariant */:
|
|
53066
|
-
return unknownType;
|
|
53067
|
-
}
|
|
53068
|
-
return getBaseConstraintOfType(typeParameter) || unknownType;
|
|
53069
|
-
});
|
|
53070
|
-
return createTypeReference(classType, typeArguments);
|
|
53071
|
-
}
|
|
53072
53039
|
function getTypeOfPrototypeProperty(prototype) {
|
|
53073
|
-
const
|
|
53074
|
-
return
|
|
53040
|
+
const classType = getDeclaredTypeOfSymbol(getParentOfSymbol(prototype));
|
|
53041
|
+
return classType.typeParameters ? createTypeReference(classType, map(classType.typeParameters, (_) => anyType)) : classType;
|
|
53075
53042
|
}
|
|
53076
53043
|
function getTypeOfPropertyOfType(type, name) {
|
|
53077
53044
|
const prop = getPropertyOfType(type, name);
|
|
@@ -58442,7 +58409,7 @@ ${lanes.join("\n")}
|
|
|
58442
58409
|
origin = createOriginUnionOrIntersectionType(1048576 /* Union */, reducedTypes);
|
|
58443
58410
|
}
|
|
58444
58411
|
}
|
|
58445
|
-
const objectFlags = (includes &
|
|
58412
|
+
const objectFlags = (includes & 36323331 /* NotPrimitiveUnion */ ? 0 : 32768 /* PrimitiveUnion */) | (includes & 2097152 /* Intersection */ ? 16777216 /* ContainsIntersections */ : 0);
|
|
58446
58413
|
return getUnionTypeFromSortedList(typeSet, objectFlags, aliasSymbol, aliasTypeArguments, origin);
|
|
58447
58414
|
}
|
|
58448
58415
|
function getUnionOrIntersectionTypePredicate(signatures, kind) {
|
|
@@ -58567,7 +58534,7 @@ ${lanes.join("\n")}
|
|
|
58567
58534
|
function eachUnionContains(unionTypes2, type) {
|
|
58568
58535
|
for (const u of unionTypes2) {
|
|
58569
58536
|
if (!containsType(u.types, type)) {
|
|
58570
|
-
const primitive = type.flags & 128 /* StringLiteral */ ? stringType : type.flags & 256 /* NumberLiteral */ ? numberType : type.flags & 2048 /* BigIntLiteral */ ? bigintType : type.flags & 8192 /* UniqueESSymbol */ ? esSymbolType : void 0;
|
|
58537
|
+
const primitive = type.flags & 128 /* StringLiteral */ ? stringType : type.flags & (32 /* Enum */ | 256 /* NumberLiteral */) ? numberType : type.flags & 2048 /* BigIntLiteral */ ? bigintType : type.flags & 8192 /* UniqueESSymbol */ ? esSymbolType : void 0;
|
|
58571
58538
|
if (!primitive || !containsType(u.types, primitive)) {
|
|
58572
58539
|
return false;
|
|
58573
58540
|
}
|
|
@@ -58594,9 +58561,6 @@ ${lanes.join("\n")}
|
|
|
58594
58561
|
}
|
|
58595
58562
|
return false;
|
|
58596
58563
|
}
|
|
58597
|
-
function eachIsUnionContaining(types, flag) {
|
|
58598
|
-
return every(types, (t) => !!(t.flags & 1048576 /* Union */) && some(t.types, (tt) => !!(tt.flags & flag)));
|
|
58599
|
-
}
|
|
58600
58564
|
function removeFromEach(types, flag) {
|
|
58601
58565
|
for (let i = 0; i < types.length; i++) {
|
|
58602
58566
|
types[i] = filterType(types[i], (t) => !(t.flags & flag));
|
|
@@ -58685,11 +58649,11 @@ ${lanes.join("\n")}
|
|
|
58685
58649
|
if (includes & 1048576 /* Union */) {
|
|
58686
58650
|
if (intersectUnionsOfPrimitiveTypes(typeSet)) {
|
|
58687
58651
|
result = getIntersectionType(typeSet, aliasSymbol, aliasTypeArguments);
|
|
58688
|
-
} else if (
|
|
58652
|
+
} else if (every(typeSet, (t) => !!(t.flags & 1048576 /* Union */ && t.types[0].flags & 32768 /* Undefined */))) {
|
|
58689
58653
|
const containedUndefinedType = some(typeSet, containsMissingType) ? missingType : undefinedType;
|
|
58690
58654
|
removeFromEach(typeSet, 32768 /* Undefined */);
|
|
58691
58655
|
result = getUnionType([getIntersectionType(typeSet), containedUndefinedType], 1 /* Literal */, aliasSymbol, aliasTypeArguments);
|
|
58692
|
-
} else if (
|
|
58656
|
+
} else if (every(typeSet, (t) => !!(t.flags & 1048576 /* Union */ && (t.types[0].flags & 65536 /* Null */ || t.types[1].flags & 65536 /* Null */)))) {
|
|
58693
58657
|
removeFromEach(typeSet, 65536 /* Null */);
|
|
58694
58658
|
result = getUnionType([getIntersectionType(typeSet), nullType], 1 /* Literal */, aliasSymbol, aliasTypeArguments);
|
|
58695
58659
|
} else {
|
|
@@ -62214,6 +62178,11 @@ ${lanes.join("\n")}
|
|
|
62214
62178
|
if (containsType(targetTypes, source2)) {
|
|
62215
62179
|
return -1 /* True */;
|
|
62216
62180
|
}
|
|
62181
|
+
if (getObjectFlags(target2) & 32768 /* PrimitiveUnion */ && !(source2.flags & 1024 /* EnumLiteral */) && (source2.flags & (128 /* StringLiteral */ | 512 /* BooleanLiteral */ | 2048 /* BigIntLiteral */) || (relation === subtypeRelation || relation === strictSubtypeRelation) && source2.flags & 256 /* NumberLiteral */)) {
|
|
62182
|
+
const alternateForm = source2 === source2.regularType ? source2.freshType : source2.regularType;
|
|
62183
|
+
const primitive = source2.flags & 128 /* StringLiteral */ ? stringType : source2.flags & 256 /* NumberLiteral */ ? numberType : source2.flags & 2048 /* BigIntLiteral */ ? bigintType : void 0;
|
|
62184
|
+
return primitive && containsType(targetTypes, primitive) || alternateForm && containsType(targetTypes, alternateForm) ? -1 /* True */ : 0 /* False */;
|
|
62185
|
+
}
|
|
62217
62186
|
const match = getMatchingUnionConstituentForType(target2, source2);
|
|
62218
62187
|
if (match) {
|
|
62219
62188
|
const related = isRelatedTo(
|
|
@@ -67515,8 +67484,8 @@ ${lanes.join("\n")}
|
|
|
67515
67484
|
if (symbol === void 0) {
|
|
67516
67485
|
return type;
|
|
67517
67486
|
}
|
|
67518
|
-
const classSymbol =
|
|
67519
|
-
const targetType = hasStaticModifier(Debug.checkDefined(symbol.valueDeclaration, "should always have a declaration")) ? getTypeOfSymbol(classSymbol) :
|
|
67487
|
+
const classSymbol = symbol.parent;
|
|
67488
|
+
const targetType = hasStaticModifier(Debug.checkDefined(symbol.valueDeclaration, "should always have a declaration")) ? getTypeOfSymbol(classSymbol) : getDeclaredTypeOfSymbol(classSymbol);
|
|
67520
67489
|
return getNarrowedType(
|
|
67521
67490
|
type,
|
|
67522
67491
|
targetType,
|
|
@@ -73571,6 +73540,12 @@ ${lanes.join("\n")}
|
|
|
73571
73540
|
function checkExpressionWithTypeArguments(node) {
|
|
73572
73541
|
checkGrammarExpressionWithTypeArguments(node);
|
|
73573
73542
|
forEach(node.typeArguments, checkSourceElement);
|
|
73543
|
+
if (node.kind === 231 /* ExpressionWithTypeArguments */) {
|
|
73544
|
+
const parent2 = walkUpParenthesizedExpressions(node.parent);
|
|
73545
|
+
if (parent2.kind === 224 /* BinaryExpression */ && parent2.operatorToken.kind === 103 /* InstanceOfKeyword */ && isNodeDescendantOf(node, parent2.right)) {
|
|
73546
|
+
error(node, Diagnostics.The_right_hand_side_of_an_instanceof_expression_must_not_be_an_instantiation_expression);
|
|
73547
|
+
}
|
|
73548
|
+
}
|
|
73574
73549
|
const exprType = node.kind === 231 /* ExpressionWithTypeArguments */ ? checkExpression(node.expression) : isThisIdentifier(node.exprName) ? checkThisExpression(node.exprName) : checkExpression(node.exprName);
|
|
73575
73550
|
return getInstantiationExpressionType(exprType, node);
|
|
73576
73551
|
}
|
|
@@ -74528,7 +74503,7 @@ ${lanes.join("\n")}
|
|
|
74528
74503
|
function checkAllCodePathsInNonVoidFunctionReturnOrThrowDiagnostics() {
|
|
74529
74504
|
const functionFlags = getFunctionFlags(func);
|
|
74530
74505
|
const type = returnType && unwrapReturnType(returnType, functionFlags);
|
|
74531
|
-
if (type && maybeTypeOfKind(type,
|
|
74506
|
+
if (type && maybeTypeOfKind(type, 32768 /* Undefined */ | 16384 /* Void */ | 1 /* Any */)) {
|
|
74532
74507
|
return;
|
|
74533
74508
|
}
|
|
74534
74509
|
if (func.kind === 171 /* MethodSignature */ || nodeIsMissing(func.body) || func.body.kind !== 239 /* Block */ || !functionHasImplicitReturn(func)) {
|
|
@@ -74539,8 +74514,12 @@ ${lanes.join("\n")}
|
|
|
74539
74514
|
if (type && type.flags & 131072 /* Never */) {
|
|
74540
74515
|
error(errorNode, Diagnostics.A_function_returning_never_cannot_have_a_reachable_end_point);
|
|
74541
74516
|
} else if (type && !hasExplicitReturn) {
|
|
74542
|
-
|
|
74543
|
-
|
|
74517
|
+
if (strictNullChecks) {
|
|
74518
|
+
error(errorNode, Diagnostics.A_function_whose_declared_type_is_neither_undefined_void_nor_any_must_return_a_value);
|
|
74519
|
+
} else {
|
|
74520
|
+
error(errorNode, Diagnostics.A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value);
|
|
74521
|
+
}
|
|
74522
|
+
} else if (type && strictNullChecks) {
|
|
74544
74523
|
error(errorNode, Diagnostics.Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined);
|
|
74545
74524
|
} else if (compilerOptions.noImplicitReturns) {
|
|
74546
74525
|
if (!type) {
|
|
@@ -142442,6 +142421,7 @@ ${lanes.join("\n")}
|
|
|
142442
142421
|
const declaration = findAncestor(node.parent, isFunctionLikeDeclaration);
|
|
142443
142422
|
switch (errorCode) {
|
|
142444
142423
|
case Diagnostics.A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value.code:
|
|
142424
|
+
case Diagnostics.A_function_whose_declared_type_is_neither_undefined_void_nor_any_must_return_a_value.code:
|
|
142445
142425
|
if (!declaration || !declaration.body || !declaration.type || !rangeContainsRange(declaration.type, node))
|
|
142446
142426
|
return void 0;
|
|
142447
142427
|
return getFixInfo(
|
|
@@ -142549,6 +142529,7 @@ ${lanes.join("\n")}
|
|
|
142549
142529
|
fixIdWrapTheBlockWithParen = "fixWrapTheBlockWithParen";
|
|
142550
142530
|
errorCodes26 = [
|
|
142551
142531
|
Diagnostics.A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value.code,
|
|
142532
|
+
Diagnostics.A_function_whose_declared_type_is_neither_undefined_void_nor_any_must_return_a_value.code,
|
|
142552
142533
|
Diagnostics.Type_0_is_not_assignable_to_type_1.code,
|
|
142553
142534
|
Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1.code
|
|
142554
142535
|
];
|
package/lib/typingsInstaller.js
CHANGED
|
@@ -54,7 +54,7 @@ var path = __toESM(require("path"));
|
|
|
54
54
|
|
|
55
55
|
// src/compiler/corePublic.ts
|
|
56
56
|
var versionMajorMinor = "5.1";
|
|
57
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
57
|
+
var version = `${versionMajorMinor}.0-insiders.20230317`;
|
|
58
58
|
|
|
59
59
|
// src/compiler/core.ts
|
|
60
60
|
var emptyArray = [];
|
|
@@ -3127,7 +3127,7 @@ var TypeFlags = /* @__PURE__ */ ((TypeFlags2) => {
|
|
|
3127
3127
|
TypeFlags2[TypeFlags2["IncludesWildcard"] = 8388608 /* IndexedAccess */] = "IncludesWildcard";
|
|
3128
3128
|
TypeFlags2[TypeFlags2["IncludesEmptyObject"] = 16777216 /* Conditional */] = "IncludesEmptyObject";
|
|
3129
3129
|
TypeFlags2[TypeFlags2["IncludesInstantiable"] = 33554432 /* Substitution */] = "IncludesInstantiable";
|
|
3130
|
-
TypeFlags2[TypeFlags2["NotPrimitiveUnion"] =
|
|
3130
|
+
TypeFlags2[TypeFlags2["NotPrimitiveUnion"] = 36323331] = "NotPrimitiveUnion";
|
|
3131
3131
|
return TypeFlags2;
|
|
3132
3132
|
})(TypeFlags || {});
|
|
3133
3133
|
var ObjectFlags = /* @__PURE__ */ ((ObjectFlags3) => {
|
|
@@ -6012,6 +6012,8 @@ var Diagnostics = {
|
|
|
6012
6012
|
Type_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: diag(2844, 1 /* Error */, "Type_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2844", "Type of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor."),
|
|
6013
6013
|
This_condition_will_always_return_0: diag(2845, 1 /* Error */, "This_condition_will_always_return_0_2845", "This condition will always return '{0}'."),
|
|
6014
6014
|
A_declaration_file_cannot_be_imported_without_import_type_Did_you_mean_to_import_an_implementation_file_0_instead: diag(2846, 1 /* Error */, "A_declaration_file_cannot_be_imported_without_import_type_Did_you_mean_to_import_an_implementation_f_2846", "A declaration file cannot be imported without 'import type'. Did you mean to import an implementation file '{0}' instead?"),
|
|
6015
|
+
A_function_whose_declared_type_is_neither_undefined_void_nor_any_must_return_a_value: diag(2847, 1 /* Error */, "A_function_whose_declared_type_is_neither_undefined_void_nor_any_must_return_a_value_2847", "A function whose declared type is neither 'undefined', 'void', nor 'any' must return a value."),
|
|
6016
|
+
The_right_hand_side_of_an_instanceof_expression_must_not_be_an_instantiation_expression: diag(2848, 1 /* Error */, "The_right_hand_side_of_an_instanceof_expression_must_not_be_an_instantiation_expression_2848", "The right-hand side of an 'instanceof' expression must not be an instantiation expression."),
|
|
6015
6017
|
Import_declaration_0_is_using_private_name_1: diag(4e3, 1 /* Error */, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."),
|
|
6016
6018
|
Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, 1 /* 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}'."),
|
|
6017
6019
|
Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, 1 /* 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}'."),
|
|
@@ -6689,7 +6691,6 @@ var Diagnostics = {
|
|
|
6689
6691
|
Specify_emit_Slashchecking_behavior_for_imports_that_are_only_used_for_types: diag(6718, 3 /* Message */, "Specify_emit_Slashchecking_behavior_for_imports_that_are_only_used_for_types_6718", "Specify emit/checking behavior for imports that are only used for types."),
|
|
6690
6692
|
Default_catch_clause_variables_as_unknown_instead_of_any: diag(6803, 3 /* Message */, "Default_catch_clause_variables_as_unknown_instead_of_any_6803", "Default catch clause variables as 'unknown' instead of 'any'."),
|
|
6691
6693
|
Do_not_transform_or_elide_any_imports_or_exports_not_marked_as_type_only_ensuring_they_are_written_in_the_output_file_s_format_based_on_the_module_setting: diag(6804, 3 /* Message */, "Do_not_transform_or_elide_any_imports_or_exports_not_marked_as_type_only_ensuring_they_are_written_i_6804", "Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting."),
|
|
6692
|
-
Default_type_arguments_to_parameter_constraint_or_unknown_instead_of_any_for_instance_checks: diag(6805, 3 /* Message */, "Default_type_arguments_to_parameter_constraint_or_unknown_instead_of_any_for_instance_checks_6805", "Default type arguments to parameter constraint or 'unknown' instead of 'any' for instance checks."),
|
|
6693
6694
|
one_of_Colon: diag(6900, 3 /* Message */, "one_of_Colon_6900", "one of:"),
|
|
6694
6695
|
one_or_more_Colon: diag(6901, 3 /* Message */, "one_or_more_Colon_6901", "one or more:"),
|
|
6695
6696
|
type_Colon: diag(6902, 3 /* Message */, "type_Colon_6902", "type:"),
|
|
@@ -25898,16 +25899,6 @@ var commandOptionsWithoutBuild = [
|
|
|
25898
25899
|
description: Diagnostics.Default_catch_clause_variables_as_unknown_instead_of_any,
|
|
25899
25900
|
defaultValueDescription: false
|
|
25900
25901
|
},
|
|
25901
|
-
{
|
|
25902
|
-
name: "strictInstanceOfTypeParameters",
|
|
25903
|
-
type: "boolean",
|
|
25904
|
-
affectsSemanticDiagnostics: true,
|
|
25905
|
-
affectsBuildInfo: true,
|
|
25906
|
-
strictFlag: true,
|
|
25907
|
-
category: Diagnostics.Type_Checking,
|
|
25908
|
-
description: Diagnostics.Default_type_arguments_to_parameter_constraint_or_unknown_instead_of_any_for_instance_checks,
|
|
25909
|
-
defaultValueDescription: false
|
|
25910
|
-
},
|
|
25911
25902
|
{
|
|
25912
25903
|
name: "alwaysStrict",
|
|
25913
25904
|
type: "boolean",
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@typescript-deploys/pr-build",
|
|
3
3
|
"author": "Microsoft Corp.",
|
|
4
4
|
"homepage": "https://www.typescriptlang.org/",
|
|
5
|
-
"version": "5.1.0-pr-
|
|
5
|
+
"version": "5.1.0-pr-53323-7",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
"node-fetch": "^3.2.10",
|
|
80
80
|
"source-map-support": "^0.5.21",
|
|
81
81
|
"tslib": "^2.5.0",
|
|
82
|
-
"typescript": "5.0.
|
|
82
|
+
"typescript": "^5.0.2",
|
|
83
83
|
"which": "^2.0.2"
|
|
84
84
|
},
|
|
85
85
|
"overrides": {
|
|
@@ -114,5 +114,5 @@
|
|
|
114
114
|
"node": "14.21.1",
|
|
115
115
|
"npm": "8.19.3"
|
|
116
116
|
},
|
|
117
|
-
"gitHead": "
|
|
117
|
+
"gitHead": "3d60ad2cd19401f448daf69a3403fbdb7fdfb4c8"
|
|
118
118
|
}
|