@typescript-deploys/pr-build 5.3.0-pr-55052-14 → 5.3.0-pr-55109-10
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 +56 -96
- package/lib/tsserver.js +56 -93
- package/lib/tsserverlibrary.d.ts +1 -1
- package/lib/tsserverlibrary.js +56 -93
- package/lib/typescript.d.ts +1 -1
- package/lib/typescript.js +56 -93
- package/lib/typingsInstaller.js +26 -12
- package/package.json +2 -2
package/lib/tsc.js
CHANGED
|
@@ -18,7 +18,7 @@ and limitations under the License.
|
|
|
18
18
|
|
|
19
19
|
// src/compiler/corePublic.ts
|
|
20
20
|
var versionMajorMinor = "5.3";
|
|
21
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
21
|
+
var version = `${versionMajorMinor}.0-insiders.20230810`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -6670,9 +6670,6 @@ var Diagnostics = {
|
|
|
6670
6670
|
await_using_statements_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules: diag(2852, 1 /* Error */, "await_using_statements_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules_2852", "'await using' statements are only allowed within async functions and at the top levels of modules."),
|
|
6671
6671
|
await_using_statements_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module: diag(2853, 1 /* Error */, "await_using_statements_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_th_2853", "'await using' statements are only allowed at the top level of a file when that file is a module, but this file has no imports or exports. Consider adding an empty 'export {}' to make this file a module."),
|
|
6672
6672
|
Top_level_await_using_statements_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher: diag(2854, 1 /* Error */, "Top_level_await_using_statements_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_sys_2854", "Top-level 'await using' statements are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', or 'nodenext', and the 'target' option is set to 'es2017' or higher."),
|
|
6673
|
-
The_left_hand_side_of_an_instanceof_expression_must_be_assignable_to_the_first_argument_of_the_right_hand_side_s_Symbol_hasInstance_method: diag(2855, 1 /* Error */, "The_left_hand_side_of_an_instanceof_expression_must_be_assignable_to_the_first_argument_of_the_right_2855", "The left-hand side of an 'instanceof' expression must be assignable to the first argument of the right-hand side's '[Symbol.hasInstance]' method."),
|
|
6674
|
-
An_object_s_Symbol_hasInstance_method_must_return_a_boolean_value_for_it_to_be_used_on_the_right_hand_side_of_an_instanceof_expression: diag(2856, 1 /* Error */, "An_object_s_Symbol_hasInstance_method_must_return_a_boolean_value_for_it_to_be_used_on_the_right_han_2856", "An object's '[Symbol.hasInstance]' method must return a boolean value for it to be used on the right-hand side of an 'instanceof' expression."),
|
|
6675
|
-
The_right_hand_side_of_an_instanceof_expression_must_be_either_of_type_any_an_object_type_with_a_Symbol_hasInstance_method_or_a_type_assignable_to_the_Function_interface_type: diag(2857, 1 /* Error */, "The_right_hand_side_of_an_instanceof_expression_must_be_either_of_type_any_an_object_type_with_a_Sym_2857", "The right-hand side of an 'instanceof' expression must be either of type 'any', an object type with a '[Symbol.hasInstance]()' method, or a type assignable to the 'Function' interface type."),
|
|
6676
6673
|
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}'."),
|
|
6677
6674
|
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}'."),
|
|
6678
6675
|
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}'."),
|
|
@@ -7514,6 +7511,7 @@ var Diagnostics = {
|
|
|
7514
7511
|
Unknown_type_acquisition_option_0_Did_you_mean_1: diag(17018, 1 /* Error */, "Unknown_type_acquisition_option_0_Did_you_mean_1_17018", "Unknown type acquisition option '{0}'. Did you mean '{1}'?"),
|
|
7515
7512
|
_0_at_the_end_of_a_type_is_not_valid_TypeScript_syntax_Did_you_mean_to_write_1: diag(17019, 1 /* Error */, "_0_at_the_end_of_a_type_is_not_valid_TypeScript_syntax_Did_you_mean_to_write_1_17019", "'{0}' at the end of a type is not valid TypeScript syntax. Did you mean to write '{1}'?"),
|
|
7516
7513
|
_0_at_the_start_of_a_type_is_not_valid_TypeScript_syntax_Did_you_mean_to_write_1: diag(17020, 1 /* Error */, "_0_at_the_start_of_a_type_is_not_valid_TypeScript_syntax_Did_you_mean_to_write_1_17020", "'{0}' at the start of a type is not valid TypeScript syntax. Did you mean to write '{1}'?"),
|
|
7514
|
+
Unicode_escape_sequence_cannot_appear_here: diag(17021, 1 /* Error */, "Unicode_escape_sequence_cannot_appear_here_17021", "Unicode escape sequence cannot appear here."),
|
|
7517
7515
|
Circularity_detected_while_resolving_configuration_Colon_0: diag(18e3, 1 /* Error */, "Circularity_detected_while_resolving_configuration_Colon_0_18000", "Circularity detected while resolving configuration: {0}"),
|
|
7518
7516
|
The_files_list_in_config_file_0_is_empty: diag(18002, 1 /* Error */, "The_files_list_in_config_file_0_is_empty_18002", "The 'files' list in config file '{0}' is empty."),
|
|
7519
7517
|
No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2: diag(18003, 1 /* Error */, "No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2_18003", "No inputs were found in config file '{0}'. Specified 'include' paths were '{1}' and 'exclude' paths were '{2}'."),
|
|
@@ -10996,7 +10994,6 @@ function isLeftHandSideExpressionKind(kind) {
|
|
|
10996
10994
|
case 236 /* MetaProperty */:
|
|
10997
10995
|
case 102 /* ImportKeyword */:
|
|
10998
10996
|
case 282 /* MissingDeclaration */:
|
|
10999
|
-
case 237 /* SyntheticExpression */:
|
|
11000
10997
|
return true;
|
|
11001
10998
|
default:
|
|
11002
10999
|
return false;
|
|
@@ -24300,9 +24297,6 @@ function isNonNullExpression(node) {
|
|
|
24300
24297
|
function isMetaProperty(node) {
|
|
24301
24298
|
return node.kind === 236 /* MetaProperty */;
|
|
24302
24299
|
}
|
|
24303
|
-
function isSyntheticExpression(node) {
|
|
24304
|
-
return node.kind === 237 /* SyntheticExpression */;
|
|
24305
|
-
}
|
|
24306
24300
|
function isPartiallyEmittedExpression(node) {
|
|
24307
24301
|
return node.kind === 360 /* PartiallyEmittedExpression */;
|
|
24308
24302
|
}
|
|
@@ -27280,6 +27274,12 @@ var Parser;
|
|
|
27280
27274
|
function parseIdentifierName(diagnosticMessage) {
|
|
27281
27275
|
return createIdentifier(tokenIsIdentifierOrKeyword(token()), diagnosticMessage);
|
|
27282
27276
|
}
|
|
27277
|
+
function parseIdentifierNameErrorOnUnicodeEscapeSequence() {
|
|
27278
|
+
if (scanner.hasUnicodeEscape() || scanner.hasExtendedUnicodeEscape()) {
|
|
27279
|
+
parseErrorAtCurrentToken(Diagnostics.Unicode_escape_sequence_cannot_appear_here);
|
|
27280
|
+
}
|
|
27281
|
+
return createIdentifier(tokenIsIdentifierOrKeyword(token()));
|
|
27282
|
+
}
|
|
27283
27283
|
function isLiteralPropertyName() {
|
|
27284
27284
|
return tokenIsIdentifierOrKeyword(token()) || token() === 11 /* StringLiteral */ || token() === 9 /* NumericLiteral */;
|
|
27285
27285
|
}
|
|
@@ -27906,7 +27906,9 @@ var Parser;
|
|
|
27906
27906
|
parseRightSideOfDot(
|
|
27907
27907
|
allowReservedWords,
|
|
27908
27908
|
/*allowPrivateIdentifiers*/
|
|
27909
|
-
false
|
|
27909
|
+
false,
|
|
27910
|
+
/*allowUnicodeEscapeSequenceInIdentifierName*/
|
|
27911
|
+
true
|
|
27910
27912
|
)
|
|
27911
27913
|
),
|
|
27912
27914
|
pos
|
|
@@ -27917,7 +27919,7 @@ var Parser;
|
|
|
27917
27919
|
function createQualifiedName(entity, name) {
|
|
27918
27920
|
return finishNode(factory2.createQualifiedName(entity, name), entity.pos);
|
|
27919
27921
|
}
|
|
27920
|
-
function parseRightSideOfDot(allowIdentifierNames, allowPrivateIdentifiers) {
|
|
27922
|
+
function parseRightSideOfDot(allowIdentifierNames, allowPrivateIdentifiers, allowUnicodeEscapeSequenceInIdentifierName) {
|
|
27921
27923
|
if (scanner.hasPrecedingLineBreak() && tokenIsIdentifierOrKeyword(token())) {
|
|
27922
27924
|
const matchesPattern = lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine);
|
|
27923
27925
|
if (matchesPattern) {
|
|
@@ -27938,7 +27940,10 @@ var Parser;
|
|
|
27938
27940
|
Diagnostics.Identifier_expected
|
|
27939
27941
|
);
|
|
27940
27942
|
}
|
|
27941
|
-
|
|
27943
|
+
if (allowIdentifierNames) {
|
|
27944
|
+
return allowUnicodeEscapeSequenceInIdentifierName ? parseIdentifierName() : parseIdentifierNameErrorOnUnicodeEscapeSequence();
|
|
27945
|
+
}
|
|
27946
|
+
return parseIdentifier();
|
|
27942
27947
|
}
|
|
27943
27948
|
function parseTemplateSpans(isTaggedTemplate) {
|
|
27944
27949
|
const pos = getNodePos();
|
|
@@ -29713,6 +29718,8 @@ var Parser;
|
|
|
29713
29718
|
/*allowIdentifierNames*/
|
|
29714
29719
|
true,
|
|
29715
29720
|
/*allowPrivateIdentifiers*/
|
|
29721
|
+
true,
|
|
29722
|
+
/*allowUnicodeEscapeSequenceInIdentifierName*/
|
|
29716
29723
|
true
|
|
29717
29724
|
)), pos);
|
|
29718
29725
|
}
|
|
@@ -29880,6 +29887,8 @@ var Parser;
|
|
|
29880
29887
|
/*allowIdentifierNames*/
|
|
29881
29888
|
true,
|
|
29882
29889
|
/*allowPrivateIdentifiers*/
|
|
29890
|
+
false,
|
|
29891
|
+
/*allowUnicodeEscapeSequenceInIdentifierName*/
|
|
29883
29892
|
false
|
|
29884
29893
|
)), pos);
|
|
29885
29894
|
}
|
|
@@ -29889,10 +29898,10 @@ var Parser;
|
|
|
29889
29898
|
const pos = getNodePos();
|
|
29890
29899
|
scanJsxIdentifier();
|
|
29891
29900
|
const isThis = token() === 110 /* ThisKeyword */;
|
|
29892
|
-
const tagName =
|
|
29901
|
+
const tagName = parseIdentifierNameErrorOnUnicodeEscapeSequence();
|
|
29893
29902
|
if (parseOptional(59 /* ColonToken */)) {
|
|
29894
29903
|
scanJsxIdentifier();
|
|
29895
|
-
return finishNode(factory2.createJsxNamespacedName(tagName,
|
|
29904
|
+
return finishNode(factory2.createJsxNamespacedName(tagName, parseIdentifierNameErrorOnUnicodeEscapeSequence()), pos);
|
|
29896
29905
|
}
|
|
29897
29906
|
return isThis ? finishNode(factory2.createToken(110 /* ThisKeyword */), pos) : tagName;
|
|
29898
29907
|
}
|
|
@@ -29953,10 +29962,10 @@ var Parser;
|
|
|
29953
29962
|
function parseJsxAttributeName() {
|
|
29954
29963
|
const pos = getNodePos();
|
|
29955
29964
|
scanJsxIdentifier();
|
|
29956
|
-
const attrName =
|
|
29965
|
+
const attrName = parseIdentifierNameErrorOnUnicodeEscapeSequence();
|
|
29957
29966
|
if (parseOptional(59 /* ColonToken */)) {
|
|
29958
29967
|
scanJsxIdentifier();
|
|
29959
|
-
return finishNode(factory2.createJsxNamespacedName(attrName,
|
|
29968
|
+
return finishNode(factory2.createJsxNamespacedName(attrName, parseIdentifierNameErrorOnUnicodeEscapeSequence()), pos);
|
|
29960
29969
|
}
|
|
29961
29970
|
return attrName;
|
|
29962
29971
|
}
|
|
@@ -30044,6 +30053,8 @@ var Parser;
|
|
|
30044
30053
|
/*allowIdentifierNames*/
|
|
30045
30054
|
true,
|
|
30046
30055
|
/*allowPrivateIdentifiers*/
|
|
30056
|
+
true,
|
|
30057
|
+
/*allowUnicodeEscapeSequenceInIdentifierName*/
|
|
30047
30058
|
true
|
|
30048
30059
|
);
|
|
30049
30060
|
const isOptionalChain2 = questionDotToken || tryReparseOptionalChain(expression);
|
|
@@ -43906,7 +43917,6 @@ function createTypeChecker(host) {
|
|
|
43906
43917
|
var potentialReflectCollisions = [];
|
|
43907
43918
|
var potentialUnusedRenamedBindingElementsInTypes = [];
|
|
43908
43919
|
var awaitedTypeStack = [];
|
|
43909
|
-
var hasGlobalSymbolHasInstanceProperty;
|
|
43910
43920
|
var diagnostics = createDiagnosticCollection();
|
|
43911
43921
|
var suggestionDiagnostics = createDiagnosticCollection();
|
|
43912
43922
|
var typeofType = createTypeofType();
|
|
@@ -56526,7 +56536,10 @@ function createTypeChecker(host) {
|
|
|
56526
56536
|
}
|
|
56527
56537
|
}
|
|
56528
56538
|
function removeStringLiteralsMatchedByTemplateLiterals(types) {
|
|
56529
|
-
const templates = filter(
|
|
56539
|
+
const templates = filter(
|
|
56540
|
+
types,
|
|
56541
|
+
(t) => !!(t.flags & 134217728 /* TemplateLiteral */) && isPatternLiteralType(t) && t.types.every((t2) => !(t2.flags & 2097152 /* Intersection */) || !areIntersectedTypesAvoidingPrimitiveReduction(t2.types))
|
|
56542
|
+
);
|
|
56530
56543
|
if (templates.length) {
|
|
56531
56544
|
let i = types.length;
|
|
56532
56545
|
while (i > 0) {
|
|
@@ -56931,15 +56944,19 @@ function createTypeChecker(host) {
|
|
|
56931
56944
|
function getConstituentCountOfTypes(types) {
|
|
56932
56945
|
return reduceLeft(types, (n, t) => n + getConstituentCount(t), 0);
|
|
56933
56946
|
}
|
|
56934
|
-
function areIntersectedTypesAvoidingPrimitiveReduction(
|
|
56935
|
-
|
|
56947
|
+
function areIntersectedTypesAvoidingPrimitiveReduction(types, primitiveFlags = 4 /* String */ | 8 /* Number */ | 64 /* BigInt */) {
|
|
56948
|
+
if (types.length !== 2) {
|
|
56949
|
+
return false;
|
|
56950
|
+
}
|
|
56951
|
+
const [t1, t2] = types;
|
|
56952
|
+
return !!(t1.flags & primitiveFlags) && t2 === emptyTypeLiteralType || !!(t2.flags & primitiveFlags) && t1 === emptyTypeLiteralType;
|
|
56936
56953
|
}
|
|
56937
56954
|
function getTypeFromIntersectionTypeNode(node) {
|
|
56938
56955
|
const links = getNodeLinks(node);
|
|
56939
56956
|
if (!links.resolvedType) {
|
|
56940
56957
|
const aliasSymbol = getAliasSymbolForTypeNode(node);
|
|
56941
56958
|
const types = map(node.types, getTypeFromTypeNode);
|
|
56942
|
-
const noSupertypeReduction =
|
|
56959
|
+
const noSupertypeReduction = areIntersectedTypesAvoidingPrimitiveReduction(types);
|
|
56943
56960
|
links.resolvedType = getIntersectionType(types, aliasSymbol, getTypeArgumentsForAliasSymbol(aliasSymbol), noSupertypeReduction);
|
|
56944
56961
|
}
|
|
56945
56962
|
return links.resolvedType;
|
|
@@ -63397,6 +63414,9 @@ function createTypeChecker(host) {
|
|
|
63397
63414
|
if (source === target || target.flags & (1 /* Any */ | 4 /* String */)) {
|
|
63398
63415
|
return true;
|
|
63399
63416
|
}
|
|
63417
|
+
if (target.flags & 2097152 /* Intersection */) {
|
|
63418
|
+
return every(target.types, (t) => t === emptyTypeLiteralType || isValidTypeForTemplateLiteralPlaceholder(source, t));
|
|
63419
|
+
}
|
|
63400
63420
|
if (source.flags & 128 /* StringLiteral */) {
|
|
63401
63421
|
const value = source.value;
|
|
63402
63422
|
return !!(target.flags & 8 /* Number */ && isValidNumberString(
|
|
@@ -63407,7 +63427,7 @@ function createTypeChecker(host) {
|
|
|
63407
63427
|
value,
|
|
63408
63428
|
/*roundTripOnly*/
|
|
63409
63429
|
false
|
|
63410
|
-
) || target.flags & (512 /* BooleanLiteral */ | 98304 /* Nullable */) && value === target.intrinsicName || target.flags & 268435456 /* StringMapping */ && isMemberOfStringMapping(getStringLiteralType(value), target));
|
|
63430
|
+
) || target.flags & (512 /* BooleanLiteral */ | 98304 /* Nullable */) && value === target.intrinsicName || target.flags & 268435456 /* StringMapping */ && isMemberOfStringMapping(getStringLiteralType(value), target) || target.flags & 134217728 /* TemplateLiteral */ && isTypeMatchedByTemplateLiteralType(source, target));
|
|
63411
63431
|
}
|
|
63412
63432
|
if (source.flags & 134217728 /* TemplateLiteral */) {
|
|
63413
63433
|
const texts = source.texts;
|
|
@@ -65985,15 +66005,6 @@ function createTypeChecker(host) {
|
|
|
65985
66005
|
return type;
|
|
65986
66006
|
}
|
|
65987
66007
|
const rightType = getTypeOfExpression(expr.right);
|
|
65988
|
-
const hasInstanceMethodType = getSymbolHasInstanceMethodOfObjectType(rightType);
|
|
65989
|
-
if (hasInstanceMethodType) {
|
|
65990
|
-
const syntheticCall = createSyntheticHasInstanceMethodCall(left, expr.right, type, hasInstanceMethodType);
|
|
65991
|
-
const signature = getEffectsSignature(syntheticCall);
|
|
65992
|
-
const predicate = signature && getTypePredicateOfSignature(signature);
|
|
65993
|
-
if (predicate && (predicate.kind === 0 /* This */ || predicate.kind === 1 /* Identifier */)) {
|
|
65994
|
-
return narrowTypeByTypePredicate(type, predicate, syntheticCall, assumeTrue);
|
|
65995
|
-
}
|
|
65996
|
-
}
|
|
65997
66008
|
if (!isTypeDerivedFrom(rightType, globalFunctionType)) {
|
|
65998
66009
|
return type;
|
|
65999
66010
|
}
|
|
@@ -66073,12 +66084,8 @@ function createTypeChecker(host) {
|
|
|
66073
66084
|
}
|
|
66074
66085
|
function narrowTypeByTypePredicate(type, predicate, callExpression, assumeTrue) {
|
|
66075
66086
|
if (predicate.type && !(isTypeAny(type) && (predicate.type === globalObjectType || predicate.type === globalFunctionType))) {
|
|
66076
|
-
|
|
66087
|
+
const predicateArgument = getTypePredicateArgument(predicate, callExpression);
|
|
66077
66088
|
if (predicateArgument) {
|
|
66078
|
-
if (isSyntheticExpression(predicateArgument) && predicate.parameterIndex === 0 && isSyntheticHasInstanceMethodCall(callExpression)) {
|
|
66079
|
-
Debug.assertNode(predicateArgument.parent, isExpression);
|
|
66080
|
-
predicateArgument = predicateArgument.parent;
|
|
66081
|
-
}
|
|
66082
66089
|
if (isMatchingReference(reference, predicateArgument)) {
|
|
66083
66090
|
return getNarrowedType(
|
|
66084
66091
|
type,
|
|
@@ -70654,7 +70661,7 @@ function createTypeChecker(host) {
|
|
|
70654
70661
|
}
|
|
70655
70662
|
return createDiagnosticForNodeArray(getSourceFileOfNode(node), typeArguments, Diagnostics.Expected_0_type_arguments_but_got_1, belowArgCount === -Infinity ? aboveArgCount : belowArgCount, argCount);
|
|
70656
70663
|
}
|
|
70657
|
-
function resolveCall(node, signatures, candidatesOutArray, checkMode, callChainFlags,
|
|
70664
|
+
function resolveCall(node, signatures, candidatesOutArray, checkMode, callChainFlags, headMessage) {
|
|
70658
70665
|
const isTaggedTemplate = node.kind === 215 /* TaggedTemplateExpression */;
|
|
70659
70666
|
const isDecorator2 = node.kind === 170 /* Decorator */;
|
|
70660
70667
|
const isJsxOpeningOrSelfClosingElement = isJsxOpeningLikeElement(node);
|
|
@@ -70697,7 +70704,6 @@ function createTypeChecker(host) {
|
|
|
70697
70704
|
chain = chainDiagnosticMessages(chain, Diagnostics.The_last_overload_gave_the_following_error);
|
|
70698
70705
|
chain = chainDiagnosticMessages(chain, Diagnostics.No_overload_matches_this_call);
|
|
70699
70706
|
}
|
|
70700
|
-
const headMessage = headMessageCallback == null ? void 0 : headMessageCallback();
|
|
70701
70707
|
if (headMessage) {
|
|
70702
70708
|
chain = chainDiagnosticMessages(chain, headMessage);
|
|
70703
70709
|
}
|
|
@@ -70765,7 +70771,6 @@ function createTypeChecker(host) {
|
|
|
70765
70771
|
map(diags, createDiagnosticMessageChainFromDiagnostic),
|
|
70766
70772
|
Diagnostics.No_overload_matches_this_call
|
|
70767
70773
|
);
|
|
70768
|
-
const headMessage = headMessageCallback == null ? void 0 : headMessageCallback();
|
|
70769
70774
|
if (headMessage) {
|
|
70770
70775
|
chain = chainDiagnosticMessages(chain, headMessage);
|
|
70771
70776
|
}
|
|
@@ -70781,21 +70786,21 @@ function createTypeChecker(host) {
|
|
|
70781
70786
|
diagnostics.add(diag2);
|
|
70782
70787
|
}
|
|
70783
70788
|
} else if (candidateForArgumentArityError) {
|
|
70784
|
-
diagnostics.add(getArgumentArityError(node, [candidateForArgumentArityError], args,
|
|
70789
|
+
diagnostics.add(getArgumentArityError(node, [candidateForArgumentArityError], args, headMessage));
|
|
70785
70790
|
} else if (candidateForTypeArgumentError) {
|
|
70786
70791
|
checkTypeArguments(
|
|
70787
70792
|
candidateForTypeArgumentError,
|
|
70788
70793
|
node.typeArguments,
|
|
70789
70794
|
/*reportErrors*/
|
|
70790
70795
|
true,
|
|
70791
|
-
|
|
70796
|
+
headMessage
|
|
70792
70797
|
);
|
|
70793
70798
|
} else {
|
|
70794
70799
|
const signaturesWithCorrectTypeArgumentArity = filter(signatures, (s) => hasCorrectTypeArgumentArity(s, typeArguments));
|
|
70795
70800
|
if (signaturesWithCorrectTypeArgumentArity.length === 0) {
|
|
70796
|
-
diagnostics.add(getTypeArgumentArityError(node, signatures, typeArguments,
|
|
70801
|
+
diagnostics.add(getTypeArgumentArityError(node, signatures, typeArguments, headMessage));
|
|
70797
70802
|
} else {
|
|
70798
|
-
diagnostics.add(getArgumentArityError(node, signaturesWithCorrectTypeArgumentArity, args,
|
|
70803
|
+
diagnostics.add(getArgumentArityError(node, signaturesWithCorrectTypeArgumentArity, args, headMessage));
|
|
70799
70804
|
}
|
|
70800
70805
|
}
|
|
70801
70806
|
}
|
|
@@ -71103,7 +71108,7 @@ function createTypeChecker(host) {
|
|
|
71103
71108
|
error(node, Diagnostics.Value_of_type_0_is_not_callable_Did_you_mean_to_include_new, typeToString(funcType));
|
|
71104
71109
|
return resolveErrorCall(node);
|
|
71105
71110
|
}
|
|
71106
|
-
return resolveCall(node, callSignatures, candidatesOutArray, checkMode, callChainFlags
|
|
71111
|
+
return resolveCall(node, callSignatures, candidatesOutArray, checkMode, callChainFlags);
|
|
71107
71112
|
}
|
|
71108
71113
|
function isGenericFunctionReturningFunction(signature) {
|
|
71109
71114
|
return !!(signature.typeParameters && isFunctionType(getReturnTypeOfSignature(signature)));
|
|
@@ -71400,7 +71405,7 @@ function createTypeChecker(host) {
|
|
|
71400
71405
|
invocationErrorRecovery(apparentType, 0 /* Call */, diag2);
|
|
71401
71406
|
return resolveErrorCall(node);
|
|
71402
71407
|
}
|
|
71403
|
-
return resolveCall(node, callSignatures, candidatesOutArray, checkMode, 0 /* None */,
|
|
71408
|
+
return resolveCall(node, callSignatures, candidatesOutArray, checkMode, 0 /* None */, headMessage);
|
|
71404
71409
|
}
|
|
71405
71410
|
function createSignatureForJSXIntrinsic(node, result) {
|
|
71406
71411
|
const namespace = getJsxNamespaceAt(node);
|
|
@@ -73442,32 +73447,6 @@ function createTypeChecker(host) {
|
|
|
73442
73447
|
function isConstEnumSymbol(symbol) {
|
|
73443
73448
|
return (symbol.flags & 128 /* ConstEnum */) !== 0;
|
|
73444
73449
|
}
|
|
73445
|
-
function getSymbolHasInstanceMethodOfObjectType(type) {
|
|
73446
|
-
const hasInstancePropertyName = getPropertyNameForKnownSymbolName("hasInstance");
|
|
73447
|
-
const hasInstanceProperty = getPropertyOfObjectType(type, hasInstancePropertyName);
|
|
73448
|
-
if (hasInstanceProperty) {
|
|
73449
|
-
const hasInstancePropertyType = getTypeOfSymbol(hasInstanceProperty);
|
|
73450
|
-
if (hasInstancePropertyType && getSignaturesOfType(hasInstancePropertyType, 0 /* Call */).length !== 0) {
|
|
73451
|
-
return hasInstancePropertyType;
|
|
73452
|
-
}
|
|
73453
|
-
}
|
|
73454
|
-
}
|
|
73455
|
-
function createSyntheticHasInstanceMethodCall(left, right, leftType, hasInstanceMethodType) {
|
|
73456
|
-
const syntheticExpression = createSyntheticExpression(right, hasInstanceMethodType);
|
|
73457
|
-
const syntheticArgument = createSyntheticExpression(left, leftType);
|
|
73458
|
-
const syntheticCall = parseNodeFactory.createCallExpression(
|
|
73459
|
-
syntheticExpression,
|
|
73460
|
-
/*typeArguments*/
|
|
73461
|
-
void 0,
|
|
73462
|
-
[syntheticArgument]
|
|
73463
|
-
);
|
|
73464
|
-
setParent(syntheticCall, left.parent);
|
|
73465
|
-
setTextRange(syntheticCall, left.parent);
|
|
73466
|
-
return syntheticCall;
|
|
73467
|
-
}
|
|
73468
|
-
function isSyntheticHasInstanceMethodCall(node) {
|
|
73469
|
-
return isSyntheticExpression(node.expression) && node.arguments.length === 1 && isSyntheticExpression(node.arguments[0]) && isBinaryExpression(node.parent) && node.parent.operatorToken.kind === 104 /* InstanceOfKeyword */ && node.parent.right === node.expression.parent && node.parent.left === node.arguments[0].parent;
|
|
73470
|
-
}
|
|
73471
73450
|
function checkInstanceOfExpression(left, right, leftType, rightType) {
|
|
73472
73451
|
if (leftType === silentNeverType || rightType === silentNeverType) {
|
|
73473
73452
|
return silentNeverType;
|
|
@@ -73475,31 +73454,8 @@ function createTypeChecker(host) {
|
|
|
73475
73454
|
if (!isTypeAny(leftType) && allTypesAssignableToKind(leftType, 402784252 /* Primitive */)) {
|
|
73476
73455
|
error(left, Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter);
|
|
73477
73456
|
}
|
|
73478
|
-
if (!isTypeAny(rightType)) {
|
|
73479
|
-
|
|
73480
|
-
if (hasInstanceMethodType) {
|
|
73481
|
-
const cache = hasInstanceMethodType;
|
|
73482
|
-
if (cache.hasSimpleUnrestrictedSingleCallSignature === void 0) {
|
|
73483
|
-
const signature = getSingleCallSignature(hasInstanceMethodType);
|
|
73484
|
-
cache.hasSimpleUnrestrictedSingleCallSignature = !!signature && signature.parameters.length === 1 && !!(getTypeOfSymbol(signature.parameters[0]).flags & 3 /* AnyOrUnknown */) && !!signature.resolvedReturnType && !!(signature.resolvedReturnType.flags & 16 /* Boolean */);
|
|
73485
|
-
}
|
|
73486
|
-
if (!cache.hasSimpleUnrestrictedSingleCallSignature) {
|
|
73487
|
-
const syntheticCall = createSyntheticHasInstanceMethodCall(left, right, leftType, hasInstanceMethodType);
|
|
73488
|
-
const returnType = getReturnTypeOfSignature(getResolvedSignature(syntheticCall));
|
|
73489
|
-
checkTypeAssignableTo(returnType, booleanType, right, Diagnostics.An_object_s_Symbol_hasInstance_method_must_return_a_boolean_value_for_it_to_be_used_on_the_right_hand_side_of_an_instanceof_expression);
|
|
73490
|
-
}
|
|
73491
|
-
}
|
|
73492
|
-
if (!(hasInstanceMethodType || typeHasCallOrConstructSignatures(rightType) || isTypeSubtypeOf(rightType, globalFunctionType))) {
|
|
73493
|
-
if (hasGlobalSymbolHasInstanceProperty === void 0) {
|
|
73494
|
-
const globalESSymbolConstructorSymbol = getGlobalESSymbolConstructorTypeSymbol(
|
|
73495
|
-
/*reportErrors*/
|
|
73496
|
-
false
|
|
73497
|
-
);
|
|
73498
|
-
hasGlobalSymbolHasInstanceProperty = !!globalESSymbolConstructorSymbol && getMembersOfSymbol(globalESSymbolConstructorSymbol).has("hasInstance");
|
|
73499
|
-
}
|
|
73500
|
-
const message = hasGlobalSymbolHasInstanceProperty ? Diagnostics.The_right_hand_side_of_an_instanceof_expression_must_be_either_of_type_any_an_object_type_with_a_Symbol_hasInstance_method_or_a_type_assignable_to_the_Function_interface_type : Diagnostics.The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type;
|
|
73501
|
-
error(right, message);
|
|
73502
|
-
}
|
|
73457
|
+
if (!(isTypeAny(rightType) || typeHasCallOrConstructSignatures(rightType) || isTypeSubtypeOf(rightType, globalFunctionType))) {
|
|
73458
|
+
error(right, Diagnostics.The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type);
|
|
73503
73459
|
}
|
|
73504
73460
|
return booleanType;
|
|
73505
73461
|
}
|
|
@@ -110704,7 +110660,11 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
110704
110660
|
function emitMethodSignature(node) {
|
|
110705
110661
|
pushNameGenerationScope(node);
|
|
110706
110662
|
emitModifierList(node, node.modifiers);
|
|
110707
|
-
|
|
110663
|
+
if (node.name.kind === 80 /* Identifier */ && node.name.escapedText === "new") {
|
|
110664
|
+
emit(factory.createStringLiteralFromNode(node.name));
|
|
110665
|
+
} else {
|
|
110666
|
+
emit(node.name);
|
|
110667
|
+
}
|
|
110708
110668
|
emit(node.questionToken);
|
|
110709
110669
|
emitTypeParameters(node, node.typeParameters);
|
|
110710
110670
|
emitParameters(node, node.parameters);
|