@typescript-deploys/pr-build 5.1.0-pr-49863-27 → 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 +19 -42
- package/lib/tsserver.js +21 -42
- package/lib/tsserverlibrary.d.ts +0 -1
- package/lib/tsserverlibrary.js +21 -42
- package/lib/typescript.d.ts +0 -1
- package/lib/typescript.js +21 -42
- package/lib/typingsInstaller.js +2 -11
- package/package.json +2 -2
package/lib/tsc.js
CHANGED
|
@@ -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 = getStrictOptionValue(compilerOptions, "strictInstanceOfTypeParameters");
|
|
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 2 /* Contravariant */:
|
|
50659
|
-
return neverType;
|
|
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);
|
|
@@ -65110,8 +65077,8 @@ function createTypeChecker(host) {
|
|
|
65110
65077
|
if (symbol === void 0) {
|
|
65111
65078
|
return type;
|
|
65112
65079
|
}
|
|
65113
|
-
const classSymbol =
|
|
65114
|
-
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);
|
|
65115
65082
|
return getNarrowedType(
|
|
65116
65083
|
type,
|
|
65117
65084
|
targetType,
|
|
@@ -71166,6 +71133,12 @@ function createTypeChecker(host) {
|
|
|
71166
71133
|
function checkExpressionWithTypeArguments(node) {
|
|
71167
71134
|
checkGrammarExpressionWithTypeArguments(node);
|
|
71168
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
|
+
}
|
|
71169
71142
|
const exprType = node.kind === 231 /* ExpressionWithTypeArguments */ ? checkExpression(node.expression) : isThisIdentifier(node.exprName) ? checkThisExpression(node.exprName) : checkExpression(node.exprName);
|
|
71170
71143
|
return getInstantiationExpressionType(exprType, node);
|
|
71171
71144
|
}
|
|
@@ -72123,7 +72096,7 @@ function createTypeChecker(host) {
|
|
|
72123
72096
|
function checkAllCodePathsInNonVoidFunctionReturnOrThrowDiagnostics() {
|
|
72124
72097
|
const functionFlags = getFunctionFlags(func);
|
|
72125
72098
|
const type = returnType && unwrapReturnType(returnType, functionFlags);
|
|
72126
|
-
if (type && maybeTypeOfKind(type,
|
|
72099
|
+
if (type && maybeTypeOfKind(type, 32768 /* Undefined */ | 16384 /* Void */ | 1 /* Any */)) {
|
|
72127
72100
|
return;
|
|
72128
72101
|
}
|
|
72129
72102
|
if (func.kind === 171 /* MethodSignature */ || nodeIsMissing(func.body) || func.body.kind !== 239 /* Block */ || !functionHasImplicitReturn(func)) {
|
|
@@ -72134,8 +72107,12 @@ function createTypeChecker(host) {
|
|
|
72134
72107
|
if (type && type.flags & 131072 /* Never */) {
|
|
72135
72108
|
error(errorNode, Diagnostics.A_function_returning_never_cannot_have_a_reachable_end_point);
|
|
72136
72109
|
} else if (type && !hasExplicitReturn) {
|
|
72137
|
-
|
|
72138
|
-
|
|
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) {
|
|
72139
72116
|
error(errorNode, Diagnostics.Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined);
|
|
72140
72117
|
} else if (compilerOptions.noImplicitReturns) {
|
|
72141
72118
|
if (!type) {
|
package/lib/tsserver.js
CHANGED
|
@@ -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 = getStrictOptionValue(compilerOptions, "strictInstanceOfTypeParameters");
|
|
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 2 /* Contravariant */:
|
|
55256
|
-
return neverType;
|
|
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);
|
|
@@ -69707,8 +69674,8 @@ function createTypeChecker(host) {
|
|
|
69707
69674
|
if (symbol === void 0) {
|
|
69708
69675
|
return type;
|
|
69709
69676
|
}
|
|
69710
|
-
const classSymbol =
|
|
69711
|
-
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);
|
|
69712
69679
|
return getNarrowedType(
|
|
69713
69680
|
type,
|
|
69714
69681
|
targetType,
|
|
@@ -75763,6 +75730,12 @@ function createTypeChecker(host) {
|
|
|
75763
75730
|
function checkExpressionWithTypeArguments(node) {
|
|
75764
75731
|
checkGrammarExpressionWithTypeArguments(node);
|
|
75765
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
|
+
}
|
|
75766
75739
|
const exprType = node.kind === 231 /* ExpressionWithTypeArguments */ ? checkExpression(node.expression) : isThisIdentifier(node.exprName) ? checkThisExpression(node.exprName) : checkExpression(node.exprName);
|
|
75767
75740
|
return getInstantiationExpressionType(exprType, node);
|
|
75768
75741
|
}
|
|
@@ -76720,7 +76693,7 @@ function createTypeChecker(host) {
|
|
|
76720
76693
|
function checkAllCodePathsInNonVoidFunctionReturnOrThrowDiagnostics() {
|
|
76721
76694
|
const functionFlags = getFunctionFlags(func);
|
|
76722
76695
|
const type = returnType && unwrapReturnType(returnType, functionFlags);
|
|
76723
|
-
if (type && maybeTypeOfKind(type,
|
|
76696
|
+
if (type && maybeTypeOfKind(type, 32768 /* Undefined */ | 16384 /* Void */ | 1 /* Any */)) {
|
|
76724
76697
|
return;
|
|
76725
76698
|
}
|
|
76726
76699
|
if (func.kind === 171 /* MethodSignature */ || nodeIsMissing(func.body) || func.body.kind !== 239 /* Block */ || !functionHasImplicitReturn(func)) {
|
|
@@ -76731,8 +76704,12 @@ function createTypeChecker(host) {
|
|
|
76731
76704
|
if (type && type.flags & 131072 /* Never */) {
|
|
76732
76705
|
error(errorNode, Diagnostics.A_function_returning_never_cannot_have_a_reachable_end_point);
|
|
76733
76706
|
} else if (type && !hasExplicitReturn) {
|
|
76734
|
-
|
|
76735
|
-
|
|
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) {
|
|
76736
76713
|
error(errorNode, Diagnostics.Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined);
|
|
76737
76714
|
} else if (compilerOptions.noImplicitReturns) {
|
|
76738
76715
|
if (!type) {
|
|
@@ -143660,6 +143637,7 @@ var fixRemoveBracesFromArrowFunctionBody = "fixRemoveBracesFromArrowFunctionBody
|
|
|
143660
143637
|
var fixIdWrapTheBlockWithParen = "fixWrapTheBlockWithParen";
|
|
143661
143638
|
var errorCodes26 = [
|
|
143662
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,
|
|
143663
143641
|
Diagnostics.Type_0_is_not_assignable_to_type_1.code,
|
|
143664
143642
|
Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1.code
|
|
143665
143643
|
];
|
|
@@ -143811,6 +143789,7 @@ function getInfo6(checker, sourceFile, position, errorCode) {
|
|
|
143811
143789
|
const declaration = findAncestor(node.parent, isFunctionLikeDeclaration);
|
|
143812
143790
|
switch (errorCode) {
|
|
143813
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:
|
|
143814
143793
|
if (!declaration || !declaration.body || !declaration.type || !rangeContainsRange(declaration.type, node))
|
|
143815
143794
|
return void 0;
|
|
143816
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
|
@@ -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 = getStrictOptionValue(compilerOptions, "strictInstanceOfTypeParameters");
|
|
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 2 /* Contravariant */:
|
|
53066
|
-
return neverType;
|
|
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);
|
|
@@ -67517,8 +67484,8 @@ ${lanes.join("\n")}
|
|
|
67517
67484
|
if (symbol === void 0) {
|
|
67518
67485
|
return type;
|
|
67519
67486
|
}
|
|
67520
|
-
const classSymbol =
|
|
67521
|
-
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);
|
|
67522
67489
|
return getNarrowedType(
|
|
67523
67490
|
type,
|
|
67524
67491
|
targetType,
|
|
@@ -73573,6 +73540,12 @@ ${lanes.join("\n")}
|
|
|
73573
73540
|
function checkExpressionWithTypeArguments(node) {
|
|
73574
73541
|
checkGrammarExpressionWithTypeArguments(node);
|
|
73575
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
|
+
}
|
|
73576
73549
|
const exprType = node.kind === 231 /* ExpressionWithTypeArguments */ ? checkExpression(node.expression) : isThisIdentifier(node.exprName) ? checkThisExpression(node.exprName) : checkExpression(node.exprName);
|
|
73577
73550
|
return getInstantiationExpressionType(exprType, node);
|
|
73578
73551
|
}
|
|
@@ -74530,7 +74503,7 @@ ${lanes.join("\n")}
|
|
|
74530
74503
|
function checkAllCodePathsInNonVoidFunctionReturnOrThrowDiagnostics() {
|
|
74531
74504
|
const functionFlags = getFunctionFlags(func);
|
|
74532
74505
|
const type = returnType && unwrapReturnType(returnType, functionFlags);
|
|
74533
|
-
if (type && maybeTypeOfKind(type,
|
|
74506
|
+
if (type && maybeTypeOfKind(type, 32768 /* Undefined */ | 16384 /* Void */ | 1 /* Any */)) {
|
|
74534
74507
|
return;
|
|
74535
74508
|
}
|
|
74536
74509
|
if (func.kind === 171 /* MethodSignature */ || nodeIsMissing(func.body) || func.body.kind !== 239 /* Block */ || !functionHasImplicitReturn(func)) {
|
|
@@ -74541,8 +74514,12 @@ ${lanes.join("\n")}
|
|
|
74541
74514
|
if (type && type.flags & 131072 /* Never */) {
|
|
74542
74515
|
error(errorNode, Diagnostics.A_function_returning_never_cannot_have_a_reachable_end_point);
|
|
74543
74516
|
} else if (type && !hasExplicitReturn) {
|
|
74544
|
-
|
|
74545
|
-
|
|
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) {
|
|
74546
74523
|
error(errorNode, Diagnostics.Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined);
|
|
74547
74524
|
} else if (compilerOptions.noImplicitReturns) {
|
|
74548
74525
|
if (!type) {
|
|
@@ -142430,6 +142407,7 @@ ${lanes.join("\n")}
|
|
|
142430
142407
|
const declaration = findAncestor(node.parent, isFunctionLikeDeclaration);
|
|
142431
142408
|
switch (errorCode) {
|
|
142432
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:
|
|
142433
142411
|
if (!declaration || !declaration.body || !declaration.type || !rangeContainsRange(declaration.type, node))
|
|
142434
142412
|
return void 0;
|
|
142435
142413
|
return getFixInfo(
|
|
@@ -142537,6 +142515,7 @@ ${lanes.join("\n")}
|
|
|
142537
142515
|
fixIdWrapTheBlockWithParen = "fixWrapTheBlockWithParen";
|
|
142538
142516
|
errorCodes26 = [
|
|
142539
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,
|
|
142540
142519
|
Diagnostics.Type_0_is_not_assignable_to_type_1.code,
|
|
142541
142520
|
Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1.code
|
|
142542
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
|
@@ -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 = getStrictOptionValue(compilerOptions, "strictInstanceOfTypeParameters");
|
|
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 2 /* Contravariant */:
|
|
53066
|
-
return neverType;
|
|
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);
|
|
@@ -67517,8 +67484,8 @@ ${lanes.join("\n")}
|
|
|
67517
67484
|
if (symbol === void 0) {
|
|
67518
67485
|
return type;
|
|
67519
67486
|
}
|
|
67520
|
-
const classSymbol =
|
|
67521
|
-
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);
|
|
67522
67489
|
return getNarrowedType(
|
|
67523
67490
|
type,
|
|
67524
67491
|
targetType,
|
|
@@ -73573,6 +73540,12 @@ ${lanes.join("\n")}
|
|
|
73573
73540
|
function checkExpressionWithTypeArguments(node) {
|
|
73574
73541
|
checkGrammarExpressionWithTypeArguments(node);
|
|
73575
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
|
+
}
|
|
73576
73549
|
const exprType = node.kind === 231 /* ExpressionWithTypeArguments */ ? checkExpression(node.expression) : isThisIdentifier(node.exprName) ? checkThisExpression(node.exprName) : checkExpression(node.exprName);
|
|
73577
73550
|
return getInstantiationExpressionType(exprType, node);
|
|
73578
73551
|
}
|
|
@@ -74530,7 +74503,7 @@ ${lanes.join("\n")}
|
|
|
74530
74503
|
function checkAllCodePathsInNonVoidFunctionReturnOrThrowDiagnostics() {
|
|
74531
74504
|
const functionFlags = getFunctionFlags(func);
|
|
74532
74505
|
const type = returnType && unwrapReturnType(returnType, functionFlags);
|
|
74533
|
-
if (type && maybeTypeOfKind(type,
|
|
74506
|
+
if (type && maybeTypeOfKind(type, 32768 /* Undefined */ | 16384 /* Void */ | 1 /* Any */)) {
|
|
74534
74507
|
return;
|
|
74535
74508
|
}
|
|
74536
74509
|
if (func.kind === 171 /* MethodSignature */ || nodeIsMissing(func.body) || func.body.kind !== 239 /* Block */ || !functionHasImplicitReturn(func)) {
|
|
@@ -74541,8 +74514,12 @@ ${lanes.join("\n")}
|
|
|
74541
74514
|
if (type && type.flags & 131072 /* Never */) {
|
|
74542
74515
|
error(errorNode, Diagnostics.A_function_returning_never_cannot_have_a_reachable_end_point);
|
|
74543
74516
|
} else if (type && !hasExplicitReturn) {
|
|
74544
|
-
|
|
74545
|
-
|
|
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) {
|
|
74546
74523
|
error(errorNode, Diagnostics.Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined);
|
|
74547
74524
|
} else if (compilerOptions.noImplicitReturns) {
|
|
74548
74525
|
if (!type) {
|
|
@@ -142444,6 +142421,7 @@ ${lanes.join("\n")}
|
|
|
142444
142421
|
const declaration = findAncestor(node.parent, isFunctionLikeDeclaration);
|
|
142445
142422
|
switch (errorCode) {
|
|
142446
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:
|
|
142447
142425
|
if (!declaration || !declaration.body || !declaration.type || !rangeContainsRange(declaration.type, node))
|
|
142448
142426
|
return void 0;
|
|
142449
142427
|
return getFixInfo(
|
|
@@ -142551,6 +142529,7 @@ ${lanes.join("\n")}
|
|
|
142551
142529
|
fixIdWrapTheBlockWithParen = "fixWrapTheBlockWithParen";
|
|
142552
142530
|
errorCodes26 = [
|
|
142553
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,
|
|
142554
142533
|
Diagnostics.Type_0_is_not_assignable_to_type_1.code,
|
|
142555
142534
|
Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1.code
|
|
142556
142535
|
];
|
package/lib/typingsInstaller.js
CHANGED
|
@@ -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": [
|
|
@@ -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
|
}
|