typescript 4.7.0-dev.20220215 → 4.7.0-dev.20220216
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/lib.es2020.intl.d.ts +4 -0
- package/lib/lib.esnext.intl.d.ts +4 -1
- package/lib/protocol.d.ts +7 -0
- package/lib/tsc.js +376 -306
- package/lib/tsserver.js +476 -388
- package/lib/tsserverlibrary.d.ts +24 -18
- package/lib/tsserverlibrary.js +476 -388
- package/lib/typescript.d.ts +16 -17
- package/lib/typescript.js +474 -386
- package/lib/typescriptServices.d.ts +16 -17
- package/lib/typescriptServices.js +474 -386
- package/lib/typingsInstaller.js +459 -381
- package/package.json +1 -1
package/lib/tsc.js
CHANGED
|
@@ -69,7 +69,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
69
69
|
var ts;
|
|
70
70
|
(function (ts) {
|
|
71
71
|
ts.versionMajorMinor = "4.7";
|
|
72
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
72
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220216";
|
|
73
73
|
var NativeCollections;
|
|
74
74
|
(function (NativeCollections) {
|
|
75
75
|
var globals = typeof globalThis !== "undefined" ? globalThis :
|
|
@@ -3306,7 +3306,8 @@ var ts;
|
|
|
3306
3306
|
{ name: "types", optional: true, captureSpan: true },
|
|
3307
3307
|
{ name: "lib", optional: true, captureSpan: true },
|
|
3308
3308
|
{ name: "path", optional: true, captureSpan: true },
|
|
3309
|
-
{ name: "no-default-lib", optional: true }
|
|
3309
|
+
{ name: "no-default-lib", optional: true },
|
|
3310
|
+
{ name: "resolution-mode", optional: true }
|
|
3310
3311
|
],
|
|
3311
3312
|
kind: 1
|
|
3312
3313
|
},
|
|
@@ -5283,6 +5284,8 @@ var ts;
|
|
|
5283
5284
|
Property_0_cannot_have_an_initializer_because_it_is_marked_abstract: diag(1267, ts.DiagnosticCategory.Error, "Property_0_cannot_have_an_initializer_because_it_is_marked_abstract_1267", "Property '{0}' cannot have an initializer because it is marked abstract."),
|
|
5284
5285
|
An_index_signature_parameter_type_must_be_string_number_symbol_or_a_template_literal_type: diag(1268, ts.DiagnosticCategory.Error, "An_index_signature_parameter_type_must_be_string_number_symbol_or_a_template_literal_type_1268", "An index signature parameter type must be 'string', 'number', 'symbol', or a template literal type."),
|
|
5285
5286
|
Cannot_use_export_import_on_a_type_or_type_only_namespace_when_the_isolatedModules_flag_is_provided: diag(1269, ts.DiagnosticCategory.Error, "Cannot_use_export_import_on_a_type_or_type_only_namespace_when_the_isolatedModules_flag_is_provided_1269", "Cannot use 'export import' on a type or type-only namespace when the '--isolatedModules' flag is provided."),
|
|
5287
|
+
Decorator_function_return_type_0_is_not_assignable_to_type_1: diag(1270, ts.DiagnosticCategory.Error, "Decorator_function_return_type_0_is_not_assignable_to_type_1_1270", "Decorator function return type '{0}' is not assignable to type '{1}'."),
|
|
5288
|
+
Decorator_function_return_type_is_0_but_is_expected_to_be_void_or_any: diag(1271, ts.DiagnosticCategory.Error, "Decorator_function_return_type_is_0_but_is_expected_to_be_void_or_any_1271", "Decorator function return type is '{0}' but is expected to be 'void' or 'any'."),
|
|
5286
5289
|
with_statements_are_not_allowed_in_an_async_function_block: diag(1300, ts.DiagnosticCategory.Error, "with_statements_are_not_allowed_in_an_async_function_block_1300", "'with' statements are not allowed in an async function block."),
|
|
5287
5290
|
await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules: diag(1308, ts.DiagnosticCategory.Error, "await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules_1308", "'await' expressions are only allowed within async functions and at the top levels of modules."),
|
|
5288
5291
|
Did_you_mean_to_use_a_Colon_An_can_only_follow_a_property_name_when_the_containing_object_literal_is_part_of_a_destructuring_pattern: diag(1312, ts.DiagnosticCategory.Error, "Did_you_mean_to_use_a_Colon_An_can_only_follow_a_property_name_when_the_containing_object_literal_is_1312", "Did you mean to use a ':'? An '=' can only follow a property name when the containing object literal is part of a destructuring pattern."),
|
|
@@ -5416,6 +5419,8 @@ var ts;
|
|
|
5416
5419
|
Preserve_unused_imported_values_in_the_JavaScript_output_that_would_otherwise_be_removed: diag(1449, ts.DiagnosticCategory.Message, "Preserve_unused_imported_values_in_the_JavaScript_output_that_would_otherwise_be_removed_1449", "Preserve unused imported values in the JavaScript output that would otherwise be removed."),
|
|
5417
5420
|
Dynamic_imports_can_only_accept_a_module_specifier_and_an_optional_assertion_as_arguments: diag(1450, ts.DiagnosticCategory.Message, "Dynamic_imports_can_only_accept_a_module_specifier_and_an_optional_assertion_as_arguments_1450", "Dynamic imports can only accept a module specifier and an optional assertion as arguments"),
|
|
5418
5421
|
Private_identifiers_are_only_allowed_in_class_bodies_and_may_only_be_used_as_part_of_a_class_member_declaration_property_access_or_on_the_left_hand_side_of_an_in_expression: diag(1451, ts.DiagnosticCategory.Error, "Private_identifiers_are_only_allowed_in_class_bodies_and_may_only_be_used_as_part_of_a_class_member__1451", "Private identifiers are only allowed in class bodies and may only be used as part of a class member declaration, property access, or on the left-hand-side of an 'in' expression"),
|
|
5422
|
+
Resolution_modes_are_only_supported_when_moduleResolution_is_node12_or_nodenext: diag(1452, ts.DiagnosticCategory.Error, "Resolution_modes_are_only_supported_when_moduleResolution_is_node12_or_nodenext_1452", "Resolution modes are only supported when `moduleResolution` is `node12` or `nodenext`."),
|
|
5423
|
+
resolution_mode_should_be_either_require_or_import: diag(1453, ts.DiagnosticCategory.Error, "resolution_mode_should_be_either_require_or_import_1453", "`resolution-mode` should be either `require` or `import`."),
|
|
5419
5424
|
The_import_meta_meta_property_is_not_allowed_in_files_which_will_build_into_CommonJS_output: diag(1470, ts.DiagnosticCategory.Error, "The_import_meta_meta_property_is_not_allowed_in_files_which_will_build_into_CommonJS_output_1470", "The 'import.meta' meta-property is not allowed in files which will build into CommonJS output."),
|
|
5420
5425
|
Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_cannot_be_imported_synchronously_Use_dynamic_import_instead: diag(1471, ts.DiagnosticCategory.Error, "Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_c_1471", "Module '{0}' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported synchronously. Use dynamic import instead."),
|
|
5421
5426
|
catch_or_finally_expected: diag(1472, ts.DiagnosticCategory.Error, "catch_or_finally_expected_1472", "'catch' or 'finally' expected."),
|
|
@@ -10696,7 +10701,10 @@ var ts;
|
|
|
10696
10701
|
ts.Debug.assert(names.length === newResolutions.length);
|
|
10697
10702
|
for (var i = 0; i < names.length; i++) {
|
|
10698
10703
|
var newResolution = newResolutions[i];
|
|
10699
|
-
var
|
|
10704
|
+
var entry = names[i];
|
|
10705
|
+
var name = !ts.isString(entry) ? entry.fileName.toLowerCase() : entry;
|
|
10706
|
+
var mode = !ts.isString(entry) ? ts.getModeForFileReference(entry, oldSourceFile === null || oldSourceFile === void 0 ? void 0 : oldSourceFile.impliedNodeFormat) : oldSourceFile && ts.getModeForResolutionAtIndex(oldSourceFile, i);
|
|
10707
|
+
var oldResolution = oldResolutions && oldResolutions.get(name, mode);
|
|
10700
10708
|
var changed = oldResolution
|
|
10701
10709
|
? !newResolution || !comparer(oldResolution, newResolution)
|
|
10702
10710
|
: newResolution;
|
|
@@ -21467,7 +21475,13 @@ var ts;
|
|
|
21467
21475
|
referencedFiles = ts.append(referencedFiles, { pos: -1, end: -1, fileName: section.data });
|
|
21468
21476
|
break;
|
|
21469
21477
|
case "type":
|
|
21470
|
-
typeReferenceDirectives = ts.append(typeReferenceDirectives, section.data);
|
|
21478
|
+
typeReferenceDirectives = ts.append(typeReferenceDirectives, { pos: -1, end: -1, fileName: section.data });
|
|
21479
|
+
break;
|
|
21480
|
+
case "type-import":
|
|
21481
|
+
typeReferenceDirectives = ts.append(typeReferenceDirectives, { pos: -1, end: -1, fileName: section.data, resolutionMode: ts.ModuleKind.ESNext });
|
|
21482
|
+
break;
|
|
21483
|
+
case "type-require":
|
|
21484
|
+
typeReferenceDirectives = ts.append(typeReferenceDirectives, { pos: -1, end: -1, fileName: section.data, resolutionMode: ts.ModuleKind.CommonJS });
|
|
21471
21485
|
break;
|
|
21472
21486
|
case "lib":
|
|
21473
21487
|
libReferenceDirectives = ts.append(libReferenceDirectives, { pos: -1, end: -1, fileName: section.data });
|
|
@@ -21525,6 +21539,8 @@ var ts;
|
|
|
21525
21539
|
case "no-default-lib":
|
|
21526
21540
|
case "reference":
|
|
21527
21541
|
case "type":
|
|
21542
|
+
case "type-import":
|
|
21543
|
+
case "type-require":
|
|
21528
21544
|
case "lib":
|
|
21529
21545
|
syntheticReferences = ts.append(syntheticReferences, ts.setTextRange(ts.factory.createUnparsedSyntheticReference(section), section));
|
|
21530
21546
|
break;
|
|
@@ -24665,7 +24681,7 @@ var ts;
|
|
|
24665
24681
|
function parseIsolatedEntityName(content, languageVersion) {
|
|
24666
24682
|
initializeState("", content, languageVersion, undefined, 1);
|
|
24667
24683
|
nextToken();
|
|
24668
|
-
var entityName = parseEntityName(true);
|
|
24684
|
+
var entityName = parseEntityName(true, false);
|
|
24669
24685
|
var isInvalid = token() === 1 && !parseDiagnostics.length;
|
|
24670
24686
|
clearState();
|
|
24671
24687
|
return isInvalid ? entityName : undefined;
|
|
@@ -25963,7 +25979,7 @@ var ts;
|
|
|
25963
25979
|
}
|
|
25964
25980
|
return createMissingList();
|
|
25965
25981
|
}
|
|
25966
|
-
function parseEntityName(allowReservedWords, diagnosticMessage) {
|
|
25982
|
+
function parseEntityName(allowReservedWords, allowPrivateIdentifiers, diagnosticMessage) {
|
|
25967
25983
|
var pos = getNodePos();
|
|
25968
25984
|
var entity = allowReservedWords ? parseIdentifierName(diagnosticMessage) : parseIdentifier(diagnosticMessage);
|
|
25969
25985
|
var dotPos = getNodePos();
|
|
@@ -25973,7 +25989,7 @@ var ts;
|
|
|
25973
25989
|
break;
|
|
25974
25990
|
}
|
|
25975
25991
|
dotPos = getNodePos();
|
|
25976
|
-
entity = finishNode(factory.createQualifiedName(entity, parseRightSideOfDot(allowReservedWords,
|
|
25992
|
+
entity = finishNode(factory.createQualifiedName(entity, parseRightSideOfDot(allowReservedWords, allowPrivateIdentifiers)), pos);
|
|
25977
25993
|
}
|
|
25978
25994
|
return entity;
|
|
25979
25995
|
}
|
|
@@ -26076,7 +26092,7 @@ var ts;
|
|
|
26076
26092
|
return finishNode(node, pos);
|
|
26077
26093
|
}
|
|
26078
26094
|
function parseEntityNameOfTypeReference() {
|
|
26079
|
-
return parseEntityName(true, ts.Diagnostics.Type_expected);
|
|
26095
|
+
return parseEntityName(true, false, ts.Diagnostics.Type_expected);
|
|
26080
26096
|
}
|
|
26081
26097
|
function parseTypeArgumentsOfTypeReference() {
|
|
26082
26098
|
if (!scanner.hasPrecedingLineBreak() && reScanLessThanToken() === 29) {
|
|
@@ -26190,7 +26206,7 @@ var ts;
|
|
|
26190
26206
|
function parseTypeQuery() {
|
|
26191
26207
|
var pos = getNodePos();
|
|
26192
26208
|
parseExpected(112);
|
|
26193
|
-
return finishNode(factory.createTypeQueryNode(parseEntityName(true)), pos);
|
|
26209
|
+
return finishNode(factory.createTypeQueryNode(parseEntityName(true, true)), pos);
|
|
26194
26210
|
}
|
|
26195
26211
|
function parseTypeParameter() {
|
|
26196
26212
|
var pos = getNodePos();
|
|
@@ -28201,11 +28217,12 @@ var ts;
|
|
|
28201
28217
|
}
|
|
28202
28218
|
function parseCaseClause() {
|
|
28203
28219
|
var pos = getNodePos();
|
|
28220
|
+
var hasJSDoc = hasPrecedingJSDocComment();
|
|
28204
28221
|
parseExpected(82);
|
|
28205
28222
|
var expression = allowInAnd(parseExpression);
|
|
28206
28223
|
parseExpected(58);
|
|
28207
28224
|
var statements = parseList(3, parseStatement);
|
|
28208
|
-
return finishNode(factory.createCaseClause(expression, statements), pos);
|
|
28225
|
+
return withJSDoc(finishNode(factory.createCaseClause(expression, statements), pos), hasJSDoc);
|
|
28209
28226
|
}
|
|
28210
28227
|
function parseDefaultClause() {
|
|
28211
28228
|
var pos = getNodePos();
|
|
@@ -29228,7 +29245,7 @@ var ts;
|
|
|
29228
29245
|
function parseModuleReference() {
|
|
29229
29246
|
return isExternalModuleReference()
|
|
29230
29247
|
? parseExternalModuleReference()
|
|
29231
|
-
: parseEntityName(false);
|
|
29248
|
+
: parseEntityName(false, false);
|
|
29232
29249
|
}
|
|
29233
29250
|
function parseExternalModuleReference() {
|
|
29234
29251
|
var pos = getNodePos();
|
|
@@ -29436,7 +29453,7 @@ var ts;
|
|
|
29436
29453
|
var pos = getNodePos();
|
|
29437
29454
|
var hasBrace = parseOptional(18);
|
|
29438
29455
|
var p2 = getNodePos();
|
|
29439
|
-
var entityName = parseEntityName(false);
|
|
29456
|
+
var entityName = parseEntityName(false, false);
|
|
29440
29457
|
while (token() === 80) {
|
|
29441
29458
|
reScanHashToken();
|
|
29442
29459
|
nextTokenJSDoc();
|
|
@@ -29838,7 +29855,7 @@ var ts;
|
|
|
29838
29855
|
skipWhitespace();
|
|
29839
29856
|
var p2 = getNodePos();
|
|
29840
29857
|
var name = ts.tokenIsIdentifierOrKeyword(token())
|
|
29841
|
-
? parseEntityName(true)
|
|
29858
|
+
? parseEntityName(true, false)
|
|
29842
29859
|
: undefined;
|
|
29843
29860
|
if (name) {
|
|
29844
29861
|
while (token() === 80) {
|
|
@@ -29863,11 +29880,13 @@ var ts;
|
|
|
29863
29880
|
&& nextTokenJSDoc() === 59
|
|
29864
29881
|
&& ts.tokenIsIdentifierOrKeyword(nextTokenJSDoc())) {
|
|
29865
29882
|
var kind = scanner.getTokenValue();
|
|
29866
|
-
if (kind
|
|
29883
|
+
if (isJSDocLinkTag(kind))
|
|
29867
29884
|
return kind;
|
|
29868
|
-
}
|
|
29869
29885
|
}
|
|
29870
29886
|
}
|
|
29887
|
+
function isJSDocLinkTag(kind) {
|
|
29888
|
+
return kind === "link" || kind === "linkcode" || kind === "linkplain";
|
|
29889
|
+
}
|
|
29871
29890
|
function parseUnknownTag(start, tagName, indent, indentText) {
|
|
29872
29891
|
return finishNode(factory.createJSDocUnknownTag(tagName, parseTrailingTagComments(start, getNodePos(), indent, indentText)), start);
|
|
29873
29892
|
}
|
|
@@ -29970,7 +29989,7 @@ var ts;
|
|
|
29970
29989
|
}
|
|
29971
29990
|
function parseSeeTag(start, tagName, indent, indentText) {
|
|
29972
29991
|
var isMarkdownOrJSDocLink = token() === 22
|
|
29973
|
-
|| lookAhead(function () { return nextTokenJSDoc() === 59 && ts.tokenIsIdentifierOrKeyword(nextTokenJSDoc()) && scanner.getTokenValue()
|
|
29992
|
+
|| lookAhead(function () { return nextTokenJSDoc() === 59 && ts.tokenIsIdentifierOrKeyword(nextTokenJSDoc()) && isJSDocLinkTag(scanner.getTokenValue()); });
|
|
29974
29993
|
var nameExpression = isMarkdownOrJSDocLink ? undefined : parseJSDocNameReference();
|
|
29975
29994
|
var comments = indent !== undefined && indentText !== undefined ? parseTrailingTagComments(start, getNodePos(), indent, indentText) : undefined;
|
|
29976
29995
|
return finishNode(factory.createJSDocSeeTag(tagName, nameExpression, comments), start);
|
|
@@ -30625,6 +30644,19 @@ var ts;
|
|
|
30625
30644
|
return ts.fileExtensionIsOneOf(fileName, [".d.ts", ".d.mts", ".d.cts"]);
|
|
30626
30645
|
}
|
|
30627
30646
|
ts.isDeclarationFileName = isDeclarationFileName;
|
|
30647
|
+
function parseResolutionMode(mode, pos, end, reportDiagnostic) {
|
|
30648
|
+
if (!mode) {
|
|
30649
|
+
return undefined;
|
|
30650
|
+
}
|
|
30651
|
+
if (mode === "import") {
|
|
30652
|
+
return ts.ModuleKind.ESNext;
|
|
30653
|
+
}
|
|
30654
|
+
if (mode === "require") {
|
|
30655
|
+
return ts.ModuleKind.CommonJS;
|
|
30656
|
+
}
|
|
30657
|
+
reportDiagnostic(pos, end - pos, ts.Diagnostics.resolution_mode_should_be_either_require_or_import);
|
|
30658
|
+
return undefined;
|
|
30659
|
+
}
|
|
30628
30660
|
function processCommentPragmas(context, sourceText) {
|
|
30629
30661
|
var pragmas = [];
|
|
30630
30662
|
for (var _i = 0, _a = ts.getLeadingCommentRanges(sourceText, 0) || ts.emptyArray; _i < _a.length; _i++) {
|
|
@@ -30663,12 +30695,13 @@ var ts;
|
|
|
30663
30695
|
var typeReferenceDirectives_1 = context.typeReferenceDirectives;
|
|
30664
30696
|
var libReferenceDirectives_1 = context.libReferenceDirectives;
|
|
30665
30697
|
ts.forEach(ts.toArray(entryOrList), function (arg) {
|
|
30666
|
-
var _a = arg.arguments, types = _a.types, lib = _a.lib, path = _a.path;
|
|
30698
|
+
var _a = arg.arguments, types = _a.types, lib = _a.lib, path = _a.path, res = _a["resolution-mode"];
|
|
30667
30699
|
if (arg.arguments["no-default-lib"]) {
|
|
30668
30700
|
context.hasNoDefaultLib = true;
|
|
30669
30701
|
}
|
|
30670
30702
|
else if (types) {
|
|
30671
|
-
|
|
30703
|
+
var parsed = parseResolutionMode(res, types.pos, types.end, reportDiagnostic);
|
|
30704
|
+
typeReferenceDirectives_1.push(__assign({ pos: types.pos, end: types.end, fileName: types.value }, (parsed ? { resolutionMode: parsed } : {})));
|
|
30672
30705
|
}
|
|
30673
30706
|
else if (lib) {
|
|
30674
30707
|
libReferenceDirectives_1.push({ pos: lib.pos, end: lib.end, fileName: lib.value });
|
|
@@ -33911,14 +33944,14 @@ var ts;
|
|
|
33911
33944
|
var useCaseSensitiveFileNames = typeof host.useCaseSensitiveFileNames === "function" ? host.useCaseSensitiveFileNames() : host.useCaseSensitiveFileNames;
|
|
33912
33945
|
return ts.comparePaths(path1, path2, !useCaseSensitiveFileNames) === 0;
|
|
33913
33946
|
}
|
|
33914
|
-
function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFile, options, host, redirectedReference, cache) {
|
|
33947
|
+
function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFile, options, host, redirectedReference, cache, resolutionMode) {
|
|
33915
33948
|
var traceEnabled = isTraceEnabled(options, host);
|
|
33916
33949
|
if (redirectedReference) {
|
|
33917
33950
|
options = redirectedReference.commandLine.options;
|
|
33918
33951
|
}
|
|
33919
33952
|
var containingDirectory = containingFile ? ts.getDirectoryPath(containingFile) : undefined;
|
|
33920
33953
|
var perFolderCache = containingDirectory ? cache && cache.getOrCreateCacheForDirectory(containingDirectory, redirectedReference) : undefined;
|
|
33921
|
-
var result = perFolderCache && perFolderCache.get(typeReferenceDirectiveName,
|
|
33954
|
+
var result = perFolderCache && perFolderCache.get(typeReferenceDirectiveName, resolutionMode);
|
|
33922
33955
|
if (result) {
|
|
33923
33956
|
if (traceEnabled) {
|
|
33924
33957
|
trace(host, ts.Diagnostics.Resolving_type_reference_directive_0_containing_file_1, typeReferenceDirectiveName, containingFile);
|
|
@@ -33953,7 +33986,11 @@ var ts;
|
|
|
33953
33986
|
}
|
|
33954
33987
|
var failedLookupLocations = [];
|
|
33955
33988
|
var features = getDefaultNodeResolutionFeatures(options);
|
|
33956
|
-
|
|
33989
|
+
if (resolutionMode === ts.ModuleKind.ESNext && (ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.Node12 || ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.NodeNext)) {
|
|
33990
|
+
features |= NodeResolutionFeatures.EsmMode;
|
|
33991
|
+
}
|
|
33992
|
+
var conditions = features & NodeResolutionFeatures.Exports ? features & NodeResolutionFeatures.EsmMode ? ["node", "import", "types"] : ["node", "require", "types"] : [];
|
|
33993
|
+
var moduleResolutionState = { compilerOptions: options, host: host, traceEnabled: traceEnabled, failedLookupLocations: failedLookupLocations, packageJsonInfoCache: cache, features: features, conditions: conditions };
|
|
33957
33994
|
var resolved = primaryLookup();
|
|
33958
33995
|
var primary = true;
|
|
33959
33996
|
if (!resolved) {
|
|
@@ -33973,7 +34010,7 @@ var ts;
|
|
|
33973
34010
|
};
|
|
33974
34011
|
}
|
|
33975
34012
|
result = { resolvedTypeReferenceDirective: resolvedTypeReferenceDirective, failedLookupLocations: failedLookupLocations };
|
|
33976
|
-
perFolderCache === null || perFolderCache === void 0 ? void 0 : perFolderCache.set(typeReferenceDirectiveName,
|
|
34013
|
+
perFolderCache === null || perFolderCache === void 0 ? void 0 : perFolderCache.set(typeReferenceDirectiveName, resolutionMode, result);
|
|
33977
34014
|
if (traceEnabled)
|
|
33978
34015
|
traceResult(result);
|
|
33979
34016
|
return result;
|
|
@@ -34232,7 +34269,10 @@ var ts;
|
|
|
34232
34269
|
ts.Debug.assert(keys.length === values.length);
|
|
34233
34270
|
var map = createModeAwareCache();
|
|
34234
34271
|
for (var i = 0; i < keys.length; ++i) {
|
|
34235
|
-
|
|
34272
|
+
var entry = keys[i];
|
|
34273
|
+
var name = !ts.isString(entry) ? entry.fileName.toLowerCase() : entry;
|
|
34274
|
+
var mode = !ts.isString(entry) ? entry.resolutionMode || file.impliedNodeFormat : ts.getModeForResolutionAtIndex(file, i);
|
|
34275
|
+
map.set(name, mode, values[i]);
|
|
34236
34276
|
}
|
|
34237
34277
|
return map;
|
|
34238
34278
|
}
|
|
@@ -48591,9 +48631,10 @@ var ts;
|
|
|
48591
48631
|
return signature;
|
|
48592
48632
|
}
|
|
48593
48633
|
function getOrCreateTypeFromSignature(signature) {
|
|
48634
|
+
var _a;
|
|
48594
48635
|
if (!signature.isolatedSignatureType) {
|
|
48595
|
-
var kind = signature.declaration ?
|
|
48596
|
-
var isConstructor = kind === 170 || kind === 174 || kind === 179;
|
|
48636
|
+
var kind = (_a = signature.declaration) === null || _a === void 0 ? void 0 : _a.kind;
|
|
48637
|
+
var isConstructor = kind === undefined || kind === 170 || kind === 174 || kind === 179;
|
|
48597
48638
|
var type = createObjectType(16);
|
|
48598
48639
|
type.members = emptySymbols;
|
|
48599
48640
|
type.properties = ts.emptyArray;
|
|
@@ -49430,7 +49471,7 @@ var ts;
|
|
|
49430
49471
|
}
|
|
49431
49472
|
}
|
|
49432
49473
|
var fixedLength = properties.length;
|
|
49433
|
-
var lengthSymbol = createSymbol(4, "length");
|
|
49474
|
+
var lengthSymbol = createSymbol(4, "length", readonly ? 8 : 0);
|
|
49434
49475
|
if (combinedFlags & 12) {
|
|
49435
49476
|
lengthSymbol.type = numberType;
|
|
49436
49477
|
}
|
|
@@ -52684,11 +52725,11 @@ var ts;
|
|
|
52684
52725
|
var overflow = false;
|
|
52685
52726
|
var overrideNextErrorInfo = 0;
|
|
52686
52727
|
var lastSkippedInfo;
|
|
52687
|
-
var incompatibleStack
|
|
52728
|
+
var incompatibleStack;
|
|
52688
52729
|
var inPropertyCheck = false;
|
|
52689
52730
|
ts.Debug.assert(relation !== identityRelation || !errorNode, "no error reporting in identity checking");
|
|
52690
52731
|
var result = isRelatedTo(source, target, 3, !!errorNode, headMessage);
|
|
52691
|
-
if (incompatibleStack
|
|
52732
|
+
if (incompatibleStack) {
|
|
52692
52733
|
reportIncompatibleStack();
|
|
52693
52734
|
}
|
|
52694
52735
|
if (overflow) {
|
|
@@ -52743,19 +52784,19 @@ var ts;
|
|
|
52743
52784
|
return {
|
|
52744
52785
|
errorInfo: errorInfo,
|
|
52745
52786
|
lastSkippedInfo: lastSkippedInfo,
|
|
52746
|
-
incompatibleStack: incompatibleStack.slice(),
|
|
52787
|
+
incompatibleStack: incompatibleStack === null || incompatibleStack === void 0 ? void 0 : incompatibleStack.slice(),
|
|
52747
52788
|
overrideNextErrorInfo: overrideNextErrorInfo,
|
|
52748
|
-
relatedInfo:
|
|
52789
|
+
relatedInfo: relatedInfo === null || relatedInfo === void 0 ? void 0 : relatedInfo.slice(),
|
|
52749
52790
|
};
|
|
52750
52791
|
}
|
|
52751
52792
|
function reportIncompatibleError(message, arg0, arg1, arg2, arg3) {
|
|
52752
52793
|
overrideNextErrorInfo++;
|
|
52753
52794
|
lastSkippedInfo = undefined;
|
|
52754
|
-
incompatibleStack.push([message, arg0, arg1, arg2, arg3]);
|
|
52795
|
+
(incompatibleStack || (incompatibleStack = [])).push([message, arg0, arg1, arg2, arg3]);
|
|
52755
52796
|
}
|
|
52756
52797
|
function reportIncompatibleStack() {
|
|
52757
|
-
var stack = incompatibleStack;
|
|
52758
|
-
incompatibleStack =
|
|
52798
|
+
var stack = incompatibleStack || [];
|
|
52799
|
+
incompatibleStack = undefined;
|
|
52759
52800
|
var info = lastSkippedInfo;
|
|
52760
52801
|
lastSkippedInfo = undefined;
|
|
52761
52802
|
if (stack.length === 1) {
|
|
@@ -52849,7 +52890,7 @@ var ts;
|
|
|
52849
52890
|
}
|
|
52850
52891
|
function reportError(message, arg0, arg1, arg2, arg3) {
|
|
52851
52892
|
ts.Debug.assert(!!errorNode);
|
|
52852
|
-
if (incompatibleStack
|
|
52893
|
+
if (incompatibleStack)
|
|
52853
52894
|
reportIncompatibleStack();
|
|
52854
52895
|
if (message.elidedInCompatabilityPyramid)
|
|
52855
52896
|
return;
|
|
@@ -52865,7 +52906,7 @@ var ts;
|
|
|
52865
52906
|
}
|
|
52866
52907
|
}
|
|
52867
52908
|
function reportRelationError(message, source, target) {
|
|
52868
|
-
if (incompatibleStack
|
|
52909
|
+
if (incompatibleStack)
|
|
52869
52910
|
reportIncompatibleStack();
|
|
52870
52911
|
var _a = getTypeNamesForErrorDisplay(source, target), sourceType = _a[0], targetType = _a[1];
|
|
52871
52912
|
var generalizedSource = source;
|
|
@@ -52956,7 +52997,9 @@ var ts;
|
|
|
52956
52997
|
if (isSimpleTypeRelatedTo(originalSource, originalTarget, relation, reportErrors ? reportError : undefined)) {
|
|
52957
52998
|
return -1;
|
|
52958
52999
|
}
|
|
52959
|
-
|
|
53000
|
+
if (reportErrors) {
|
|
53001
|
+
reportErrorResults(originalSource, originalTarget, originalSource, originalTarget, headMessage);
|
|
53002
|
+
}
|
|
52960
53003
|
return 0;
|
|
52961
53004
|
}
|
|
52962
53005
|
var source = getNormalizedType(originalSource, false);
|
|
@@ -52964,127 +53007,121 @@ var ts;
|
|
|
52964
53007
|
if (source === target)
|
|
52965
53008
|
return -1;
|
|
52966
53009
|
if (relation === identityRelation) {
|
|
52967
|
-
|
|
53010
|
+
if (source.flags !== target.flags)
|
|
53011
|
+
return 0;
|
|
53012
|
+
if (source.flags & 67358815)
|
|
53013
|
+
return -1;
|
|
53014
|
+
traceUnionsOrIntersectionsTooLarge(source, target);
|
|
53015
|
+
return recursiveTypeRelatedTo(source, target, false, 0, recursionFlags);
|
|
52968
53016
|
}
|
|
52969
53017
|
if (source.flags & 262144 && getConstraintOfType(source) === target) {
|
|
52970
53018
|
return -1;
|
|
52971
53019
|
}
|
|
52972
|
-
if (
|
|
52973
|
-
|
|
52974
|
-
var
|
|
52975
|
-
|
|
52976
|
-
|
|
53020
|
+
if (source.flags & 470302716 && target.flags & 1048576) {
|
|
53021
|
+
var types = target.types;
|
|
53022
|
+
var candidate = types.length === 2 && types[0].flags & 98304 ? types[1] :
|
|
53023
|
+
types.length === 3 && types[0].flags & 98304 && types[1].flags & 98304 ? types[2] :
|
|
53024
|
+
undefined;
|
|
53025
|
+
if (candidate && !(candidate.flags & 98304)) {
|
|
53026
|
+
target = getNormalizedType(candidate, true);
|
|
53027
|
+
if (source === target)
|
|
53028
|
+
return -1;
|
|
52977
53029
|
}
|
|
52978
|
-
if (source === nullStrippedTarget)
|
|
52979
|
-
return -1;
|
|
52980
53030
|
}
|
|
52981
53031
|
if (relation === comparableRelation && !(target.flags & 131072) && isSimpleTypeRelatedTo(target, source, relation) ||
|
|
52982
53032
|
isSimpleTypeRelatedTo(source, target, relation, reportErrors ? reportError : undefined))
|
|
52983
53033
|
return -1;
|
|
52984
|
-
|
|
52985
|
-
|
|
52986
|
-
|
|
52987
|
-
|
|
53034
|
+
if (source.flags & 469499904 || target.flags & 469499904) {
|
|
53035
|
+
var isPerformingExcessPropertyChecks = !(intersectionState & 2) && (isObjectLiteralType(source) && ts.getObjectFlags(source) & 16384);
|
|
53036
|
+
if (isPerformingExcessPropertyChecks) {
|
|
53037
|
+
if (hasExcessProperties(source, target, reportErrors)) {
|
|
53038
|
+
if (reportErrors) {
|
|
53039
|
+
reportRelationError(headMessage, source, originalTarget.aliasSymbol ? originalTarget : target);
|
|
53040
|
+
}
|
|
53041
|
+
return 0;
|
|
53042
|
+
}
|
|
53043
|
+
}
|
|
53044
|
+
var isPerformingCommonPropertyChecks = relation !== comparableRelation && !(intersectionState & 2) &&
|
|
53045
|
+
source.flags & (131068 | 524288 | 2097152) && source !== globalObjectType &&
|
|
53046
|
+
target.flags & (524288 | 2097152) && isWeakType(target) &&
|
|
53047
|
+
(getPropertiesOfType(source).length > 0 || typeHasCallOrConstructSignatures(source));
|
|
53048
|
+
var isComparingJsxAttributes = !!(ts.getObjectFlags(source) & 2048);
|
|
53049
|
+
if (isPerformingCommonPropertyChecks && !hasCommonProperties(source, target, isComparingJsxAttributes)) {
|
|
52988
53050
|
if (reportErrors) {
|
|
52989
|
-
|
|
53051
|
+
var sourceString = typeToString(originalSource.aliasSymbol ? originalSource : source);
|
|
53052
|
+
var targetString = typeToString(originalTarget.aliasSymbol ? originalTarget : target);
|
|
53053
|
+
var calls = getSignaturesOfType(source, 0);
|
|
53054
|
+
var constructs = getSignaturesOfType(source, 1);
|
|
53055
|
+
if (calls.length > 0 && isRelatedTo(getReturnTypeOfSignature(calls[0]), target, 1, false) ||
|
|
53056
|
+
constructs.length > 0 && isRelatedTo(getReturnTypeOfSignature(constructs[0]), target, 1, false)) {
|
|
53057
|
+
reportError(ts.Diagnostics.Value_of_type_0_has_no_properties_in_common_with_type_1_Did_you_mean_to_call_it, sourceString, targetString);
|
|
53058
|
+
}
|
|
53059
|
+
else {
|
|
53060
|
+
reportError(ts.Diagnostics.Type_0_has_no_properties_in_common_with_type_1, sourceString, targetString);
|
|
53061
|
+
}
|
|
52990
53062
|
}
|
|
52991
53063
|
return 0;
|
|
52992
53064
|
}
|
|
52993
|
-
|
|
52994
|
-
|
|
52995
|
-
|
|
52996
|
-
|
|
52997
|
-
|
|
52998
|
-
|
|
52999
|
-
if (
|
|
53000
|
-
|
|
53001
|
-
|
|
53002
|
-
|
|
53003
|
-
|
|
53004
|
-
if (calls.length > 0 && isRelatedTo(getReturnTypeOfSignature(calls[0]), target, 1, false) ||
|
|
53005
|
-
constructs.length > 0 && isRelatedTo(getReturnTypeOfSignature(constructs[0]), target, 1, false)) {
|
|
53006
|
-
reportError(ts.Diagnostics.Value_of_type_0_has_no_properties_in_common_with_type_1_Did_you_mean_to_call_it, sourceString, targetString);
|
|
53007
|
-
}
|
|
53008
|
-
else {
|
|
53009
|
-
reportError(ts.Diagnostics.Type_0_has_no_properties_in_common_with_type_1, sourceString, targetString);
|
|
53010
|
-
}
|
|
53065
|
+
traceUnionsOrIntersectionsTooLarge(source, target);
|
|
53066
|
+
var skipCaching = source.flags & 1048576 && source.types.length < 4 && !(target.flags & 1048576) ||
|
|
53067
|
+
target.flags & 1048576 && target.types.length < 4 && !(source.flags & 469499904);
|
|
53068
|
+
var result_7 = skipCaching ?
|
|
53069
|
+
unionOrIntersectionRelatedTo(source, target, reportErrors, intersectionState) :
|
|
53070
|
+
recursiveTypeRelatedTo(source, target, reportErrors, intersectionState, recursionFlags);
|
|
53071
|
+
if (result_7 && !inPropertyCheck && (target.flags & 2097152 && (isPerformingExcessPropertyChecks || isPerformingCommonPropertyChecks) ||
|
|
53072
|
+
isNonGenericObjectType(target) && !isArrayType(target) && !isTupleType(target) && source.flags & 2097152 && getApparentType(source).flags & 3670016 && !ts.some(source.types, function (t) { return !!(ts.getObjectFlags(t) & 524288); }))) {
|
|
53073
|
+
inPropertyCheck = true;
|
|
53074
|
+
result_7 &= recursiveTypeRelatedTo(source, target, reportErrors, 4, recursionFlags);
|
|
53075
|
+
inPropertyCheck = false;
|
|
53011
53076
|
}
|
|
53012
|
-
|
|
53013
|
-
|
|
53014
|
-
traceUnionsOrIntersectionsTooLarge(source, target);
|
|
53015
|
-
var result = 0;
|
|
53016
|
-
var saveErrorInfo = captureErrorCalculationState();
|
|
53017
|
-
if ((source.flags & 1048576 || target.flags & 1048576) && getConstituentCount(source) * getConstituentCount(target) < 4) {
|
|
53018
|
-
result = structuredTypeRelatedTo(source, target, reportErrors, intersectionState | 8);
|
|
53019
|
-
}
|
|
53020
|
-
else if (source.flags & 3145728 || target.flags & 3145728) {
|
|
53021
|
-
result = recursiveTypeRelatedTo(source, target, reportErrors, intersectionState | 8, recursionFlags);
|
|
53022
|
-
}
|
|
53023
|
-
if (!result && !(source.flags & 1048576) && (source.flags & (469499904) || target.flags & 469499904)) {
|
|
53024
|
-
if (result = recursiveTypeRelatedTo(source, target, reportErrors, intersectionState, recursionFlags)) {
|
|
53025
|
-
resetErrorInfo(saveErrorInfo);
|
|
53077
|
+
if (result_7) {
|
|
53078
|
+
return result_7;
|
|
53026
53079
|
}
|
|
53027
53080
|
}
|
|
53028
|
-
if (
|
|
53029
|
-
|
|
53030
|
-
|
|
53031
|
-
|
|
53032
|
-
|
|
53033
|
-
|
|
53034
|
-
|
|
53035
|
-
|
|
53081
|
+
if (reportErrors) {
|
|
53082
|
+
reportErrorResults(originalSource, originalTarget, source, target, headMessage);
|
|
53083
|
+
}
|
|
53084
|
+
return 0;
|
|
53085
|
+
}
|
|
53086
|
+
function reportErrorResults(originalSource, originalTarget, source, target, headMessage) {
|
|
53087
|
+
var sourceHasBase = !!getSingleBaseForNonAugmentingSubtype(originalSource);
|
|
53088
|
+
var targetHasBase = !!getSingleBaseForNonAugmentingSubtype(originalTarget);
|
|
53089
|
+
source = (originalSource.aliasSymbol || sourceHasBase) ? originalSource : source;
|
|
53090
|
+
target = (originalTarget.aliasSymbol || targetHasBase) ? originalTarget : target;
|
|
53091
|
+
var maybeSuppress = overrideNextErrorInfo > 0;
|
|
53092
|
+
if (maybeSuppress) {
|
|
53093
|
+
overrideNextErrorInfo--;
|
|
53094
|
+
}
|
|
53095
|
+
if (source.flags & 524288 && target.flags & 524288) {
|
|
53096
|
+
var currentError = errorInfo;
|
|
53097
|
+
tryElaborateArrayLikeErrors(source, target, true);
|
|
53098
|
+
if (errorInfo !== currentError) {
|
|
53099
|
+
maybeSuppress = !!errorInfo;
|
|
53100
|
+
}
|
|
53101
|
+
}
|
|
53102
|
+
if (source.flags & 524288 && target.flags & 131068) {
|
|
53103
|
+
tryElaborateErrorsForPrimitivesAndObjects(source, target);
|
|
53104
|
+
}
|
|
53105
|
+
else if (source.symbol && source.flags & 524288 && globalObjectType === source) {
|
|
53106
|
+
reportError(ts.Diagnostics.The_Object_type_is_assignable_to_very_few_other_types_Did_you_mean_to_use_the_any_type_instead);
|
|
53107
|
+
}
|
|
53108
|
+
else if (ts.getObjectFlags(source) & 2048 && target.flags & 2097152) {
|
|
53109
|
+
var targetTypes = target.types;
|
|
53110
|
+
var intrinsicAttributes = getJsxType(JsxNames.IntrinsicAttributes, errorNode);
|
|
53111
|
+
var intrinsicClassAttributes = getJsxType(JsxNames.IntrinsicClassAttributes, errorNode);
|
|
53112
|
+
if (!isErrorType(intrinsicAttributes) && !isErrorType(intrinsicClassAttributes) &&
|
|
53113
|
+
(ts.contains(targetTypes, intrinsicAttributes) || ts.contains(targetTypes, intrinsicClassAttributes))) {
|
|
53114
|
+
return;
|
|
53036
53115
|
}
|
|
53037
53116
|
}
|
|
53038
|
-
|
|
53039
|
-
|
|
53040
|
-
inPropertyCheck = true;
|
|
53041
|
-
result &= recursiveTypeRelatedTo(source, target, reportErrors, 4, recursionFlags);
|
|
53042
|
-
inPropertyCheck = false;
|
|
53117
|
+
else {
|
|
53118
|
+
errorInfo = elaborateNeverIntersection(errorInfo, originalTarget);
|
|
53043
53119
|
}
|
|
53044
|
-
|
|
53045
|
-
|
|
53046
|
-
|
|
53047
|
-
if (!result && reportErrors) {
|
|
53048
|
-
var sourceHasBase = !!getSingleBaseForNonAugmentingSubtype(originalSource);
|
|
53049
|
-
var targetHasBase = !!getSingleBaseForNonAugmentingSubtype(originalTarget);
|
|
53050
|
-
source = (originalSource.aliasSymbol || sourceHasBase) ? originalSource : source;
|
|
53051
|
-
target = (originalTarget.aliasSymbol || targetHasBase) ? originalTarget : target;
|
|
53052
|
-
var maybeSuppress = overrideNextErrorInfo > 0;
|
|
53053
|
-
if (maybeSuppress) {
|
|
53054
|
-
overrideNextErrorInfo--;
|
|
53055
|
-
}
|
|
53056
|
-
if (source.flags & 524288 && target.flags & 524288) {
|
|
53057
|
-
var currentError = errorInfo;
|
|
53058
|
-
tryElaborateArrayLikeErrors(source, target, reportErrors);
|
|
53059
|
-
if (errorInfo !== currentError) {
|
|
53060
|
-
maybeSuppress = !!errorInfo;
|
|
53061
|
-
}
|
|
53062
|
-
}
|
|
53063
|
-
if (source.flags & 524288 && target.flags & 131068) {
|
|
53064
|
-
tryElaborateErrorsForPrimitivesAndObjects(source, target);
|
|
53065
|
-
}
|
|
53066
|
-
else if (source.symbol && source.flags & 524288 && globalObjectType === source) {
|
|
53067
|
-
reportError(ts.Diagnostics.The_Object_type_is_assignable_to_very_few_other_types_Did_you_mean_to_use_the_any_type_instead);
|
|
53068
|
-
}
|
|
53069
|
-
else if (isComparingJsxAttributes && target.flags & 2097152) {
|
|
53070
|
-
var targetTypes = target.types;
|
|
53071
|
-
var intrinsicAttributes = getJsxType(JsxNames.IntrinsicAttributes, errorNode);
|
|
53072
|
-
var intrinsicClassAttributes = getJsxType(JsxNames.IntrinsicClassAttributes, errorNode);
|
|
53073
|
-
if (!isErrorType(intrinsicAttributes) && !isErrorType(intrinsicClassAttributes) &&
|
|
53074
|
-
(ts.contains(targetTypes, intrinsicAttributes) || ts.contains(targetTypes, intrinsicClassAttributes))) {
|
|
53075
|
-
return result;
|
|
53076
|
-
}
|
|
53077
|
-
}
|
|
53078
|
-
else {
|
|
53079
|
-
errorInfo = elaborateNeverIntersection(errorInfo, originalTarget);
|
|
53080
|
-
}
|
|
53081
|
-
if (!headMessage && maybeSuppress) {
|
|
53082
|
-
lastSkippedInfo = [source, target];
|
|
53083
|
-
return result;
|
|
53084
|
-
}
|
|
53085
|
-
reportRelationError(headMessage, source, target);
|
|
53086
|
-
}
|
|
53120
|
+
if (!headMessage && maybeSuppress) {
|
|
53121
|
+
lastSkippedInfo = [source, target];
|
|
53122
|
+
return;
|
|
53087
53123
|
}
|
|
53124
|
+
reportRelationError(headMessage, source, target);
|
|
53088
53125
|
}
|
|
53089
53126
|
function traceUnionsOrIntersectionsTooLarge(source, target) {
|
|
53090
53127
|
if (!ts.tracing) {
|
|
@@ -53110,21 +53147,6 @@ var ts;
|
|
|
53110
53147
|
}
|
|
53111
53148
|
}
|
|
53112
53149
|
}
|
|
53113
|
-
function isIdenticalTo(source, target, recursionFlags) {
|
|
53114
|
-
if (source.flags !== target.flags)
|
|
53115
|
-
return 0;
|
|
53116
|
-
if (source.flags & 67358815)
|
|
53117
|
-
return -1;
|
|
53118
|
-
traceUnionsOrIntersectionsTooLarge(source, target);
|
|
53119
|
-
if (source.flags & 3145728) {
|
|
53120
|
-
var result_7 = eachTypeRelatedToSomeType(source, target);
|
|
53121
|
-
if (result_7) {
|
|
53122
|
-
result_7 &= eachTypeRelatedToSomeType(target, source);
|
|
53123
|
-
}
|
|
53124
|
-
return result_7;
|
|
53125
|
-
}
|
|
53126
|
-
return recursiveTypeRelatedTo(source, target, false, 0, recursionFlags);
|
|
53127
|
-
}
|
|
53128
53150
|
function getTypeOfPropertyInTypes(types, name) {
|
|
53129
53151
|
var appendPropType = function (propTypes, type) {
|
|
53130
53152
|
var _a;
|
|
@@ -53213,6 +53235,29 @@ var ts;
|
|
|
53213
53235
|
function shouldCheckAsExcessProperty(prop, container) {
|
|
53214
53236
|
return prop.valueDeclaration && container.valueDeclaration && prop.valueDeclaration.parent === container.valueDeclaration;
|
|
53215
53237
|
}
|
|
53238
|
+
function unionOrIntersectionRelatedTo(source, target, reportErrors, intersectionState) {
|
|
53239
|
+
if (source.flags & 1048576) {
|
|
53240
|
+
return relation === comparableRelation ?
|
|
53241
|
+
someTypeRelatedToType(source, target, reportErrors && !(source.flags & 131068), intersectionState) :
|
|
53242
|
+
eachTypeRelatedToType(source, target, reportErrors && !(source.flags & 131068), intersectionState);
|
|
53243
|
+
}
|
|
53244
|
+
if (target.flags & 1048576) {
|
|
53245
|
+
return typeRelatedToSomeType(getRegularTypeOfObjectLiteral(source), target, reportErrors && !(source.flags & 131068) && !(target.flags & 131068));
|
|
53246
|
+
}
|
|
53247
|
+
if (target.flags & 2097152) {
|
|
53248
|
+
return typeRelatedToEachType(getRegularTypeOfObjectLiteral(source), target, reportErrors, 2);
|
|
53249
|
+
}
|
|
53250
|
+
if (relation === comparableRelation && target.flags & 131068) {
|
|
53251
|
+
var constraints = ts.sameMap(source.types, getBaseConstraintOrType);
|
|
53252
|
+
if (constraints !== source.types) {
|
|
53253
|
+
source = getIntersectionType(constraints);
|
|
53254
|
+
if (!(source.flags & 2097152)) {
|
|
53255
|
+
return isRelatedTo(source, target, 1, false);
|
|
53256
|
+
}
|
|
53257
|
+
}
|
|
53258
|
+
}
|
|
53259
|
+
return someTypeRelatedToType(source, target, false, 1);
|
|
53260
|
+
}
|
|
53216
53261
|
function eachTypeRelatedToSomeType(source, target) {
|
|
53217
53262
|
var result = -1;
|
|
53218
53263
|
var sourceTypes = source.types;
|
|
@@ -53249,7 +53294,9 @@ var ts;
|
|
|
53249
53294
|
}
|
|
53250
53295
|
if (reportErrors) {
|
|
53251
53296
|
var bestMatchingType = getBestMatchingType(source, target, isRelatedTo);
|
|
53252
|
-
|
|
53297
|
+
if (bestMatchingType) {
|
|
53298
|
+
isRelatedTo(source, bestMatchingType, 2, true);
|
|
53299
|
+
}
|
|
53253
53300
|
}
|
|
53254
53301
|
return 0;
|
|
53255
53302
|
}
|
|
@@ -53357,7 +53404,7 @@ var ts;
|
|
|
53357
53404
|
if (overflow) {
|
|
53358
53405
|
return 0;
|
|
53359
53406
|
}
|
|
53360
|
-
var keyIntersectionState = intersectionState | (inPropertyCheck ?
|
|
53407
|
+
var keyIntersectionState = intersectionState | (inPropertyCheck ? 8 : 0);
|
|
53361
53408
|
var id = getRelationKey(source, target, keyIntersectionState, relation, false);
|
|
53362
53409
|
var entry = relation.get(id);
|
|
53363
53410
|
if (entry !== undefined) {
|
|
@@ -53418,6 +53465,7 @@ var ts;
|
|
|
53418
53465
|
return originalHandler(onlyUnreliable);
|
|
53419
53466
|
};
|
|
53420
53467
|
}
|
|
53468
|
+
var result;
|
|
53421
53469
|
if (expandingFlags === 3) {
|
|
53422
53470
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.instant("checkTypes", "recursiveTypeRelatedTo_DepthLimit", {
|
|
53423
53471
|
sourceId: source.id,
|
|
@@ -53427,8 +53475,13 @@ var ts;
|
|
|
53427
53475
|
depth: sourceDepth,
|
|
53428
53476
|
targetDepth: targetDepth
|
|
53429
53477
|
});
|
|
53478
|
+
result = 3;
|
|
53479
|
+
}
|
|
53480
|
+
else {
|
|
53481
|
+
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("checkTypes", "structuredTypeRelatedTo", { sourceId: source.id, targetId: target.id });
|
|
53482
|
+
result = structuredTypeRelatedTo(source, target, reportErrors, intersectionState);
|
|
53483
|
+
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
53430
53484
|
}
|
|
53431
|
-
var result = expandingFlags !== 3 ? structuredTypeRelatedTo(source, target, reportErrors, intersectionState) : 3;
|
|
53432
53485
|
if (outofbandVarianceMarkerHandler) {
|
|
53433
53486
|
outofbandVarianceMarkerHandler = originalHandler;
|
|
53434
53487
|
}
|
|
@@ -53456,74 +53509,73 @@ var ts;
|
|
|
53456
53509
|
return result;
|
|
53457
53510
|
}
|
|
53458
53511
|
function structuredTypeRelatedTo(source, target, reportErrors, intersectionState) {
|
|
53459
|
-
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("checkTypes", "structuredTypeRelatedTo", { sourceId: source.id, targetId: target.id });
|
|
53460
|
-
var result = structuredTypeRelatedToWorker(source, target, reportErrors, intersectionState);
|
|
53461
|
-
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
53462
|
-
return result;
|
|
53463
|
-
}
|
|
53464
|
-
function structuredTypeRelatedToWorker(source, target, reportErrors, intersectionState) {
|
|
53465
53512
|
if (intersectionState & 4) {
|
|
53466
53513
|
return propertiesRelatedTo(source, target, reportErrors, undefined, 0);
|
|
53467
53514
|
}
|
|
53468
|
-
|
|
53469
|
-
|
|
53470
|
-
|
|
53471
|
-
|
|
53472
|
-
|
|
53473
|
-
|
|
53474
|
-
|
|
53475
|
-
|
|
53476
|
-
|
|
53477
|
-
|
|
53478
|
-
|
|
53479
|
-
}
|
|
53480
|
-
if (relation === comparableRelation && target.flags & 131068) {
|
|
53481
|
-
var constraints = ts.sameMap(source.types, getBaseConstraintOrType);
|
|
53482
|
-
if (constraints !== source.types) {
|
|
53483
|
-
source = getIntersectionType(constraints);
|
|
53484
|
-
if (!(source.flags & 2097152)) {
|
|
53485
|
-
return isRelatedTo(source, target, 1, false);
|
|
53486
|
-
}
|
|
53515
|
+
var result;
|
|
53516
|
+
var originalErrorInfo;
|
|
53517
|
+
var varianceCheckFailed = false;
|
|
53518
|
+
var saveErrorInfo = captureErrorCalculationState();
|
|
53519
|
+
var sourceFlags = source.flags;
|
|
53520
|
+
var targetFlags = target.flags;
|
|
53521
|
+
if (relation === identityRelation) {
|
|
53522
|
+
if (sourceFlags & 3145728) {
|
|
53523
|
+
var result_8 = eachTypeRelatedToSomeType(source, target);
|
|
53524
|
+
if (result_8) {
|
|
53525
|
+
result_8 &= eachTypeRelatedToSomeType(target, source);
|
|
53487
53526
|
}
|
|
53527
|
+
return result_8;
|
|
53488
53528
|
}
|
|
53489
|
-
|
|
53490
|
-
}
|
|
53491
|
-
var flags = source.flags & target.flags;
|
|
53492
|
-
if (relation === identityRelation && !(flags & 524288)) {
|
|
53493
|
-
if (flags & 4194304) {
|
|
53529
|
+
if (sourceFlags & 4194304) {
|
|
53494
53530
|
return isRelatedTo(source.type, target.type, 3, false);
|
|
53495
53531
|
}
|
|
53496
|
-
|
|
53497
|
-
|
|
53498
|
-
|
|
53499
|
-
|
|
53500
|
-
return result_8;
|
|
53532
|
+
if (sourceFlags & 8388608) {
|
|
53533
|
+
if (result = isRelatedTo(source.objectType, target.objectType, 3, false)) {
|
|
53534
|
+
if (result &= isRelatedTo(source.indexType, target.indexType, 3, false)) {
|
|
53535
|
+
return result;
|
|
53501
53536
|
}
|
|
53502
53537
|
}
|
|
53503
53538
|
}
|
|
53504
|
-
if (
|
|
53539
|
+
if (sourceFlags & 16777216) {
|
|
53505
53540
|
if (source.root.isDistributive === target.root.isDistributive) {
|
|
53506
|
-
if (
|
|
53507
|
-
if (
|
|
53508
|
-
if (
|
|
53509
|
-
if (
|
|
53510
|
-
return
|
|
53541
|
+
if (result = isRelatedTo(source.checkType, target.checkType, 3, false)) {
|
|
53542
|
+
if (result &= isRelatedTo(source.extendsType, target.extendsType, 3, false)) {
|
|
53543
|
+
if (result &= isRelatedTo(getTrueTypeFromConditionalType(source), getTrueTypeFromConditionalType(target), 3, false)) {
|
|
53544
|
+
if (result &= isRelatedTo(getFalseTypeFromConditionalType(source), getFalseTypeFromConditionalType(target), 3, false)) {
|
|
53545
|
+
return result;
|
|
53511
53546
|
}
|
|
53512
53547
|
}
|
|
53513
53548
|
}
|
|
53514
53549
|
}
|
|
53515
53550
|
}
|
|
53516
53551
|
}
|
|
53517
|
-
if (
|
|
53552
|
+
if (sourceFlags & 33554432) {
|
|
53518
53553
|
return isRelatedTo(source.substitute, target.substitute, 3, false);
|
|
53519
53554
|
}
|
|
53520
|
-
|
|
53555
|
+
if (!(sourceFlags & 524288)) {
|
|
53556
|
+
return 0;
|
|
53557
|
+
}
|
|
53521
53558
|
}
|
|
53522
|
-
|
|
53523
|
-
|
|
53524
|
-
|
|
53525
|
-
|
|
53526
|
-
|
|
53559
|
+
else if (sourceFlags & 3145728 || targetFlags & 3145728) {
|
|
53560
|
+
if (result = unionOrIntersectionRelatedTo(source, target, reportErrors, intersectionState)) {
|
|
53561
|
+
return result;
|
|
53562
|
+
}
|
|
53563
|
+
if (source.flags & 2097152 || source.flags & 262144 && target.flags & 1048576) {
|
|
53564
|
+
var constraint = getEffectiveConstraintOfIntersection(source.flags & 2097152 ? source.types : [source], !!(target.flags & 1048576));
|
|
53565
|
+
if (constraint && everyType(constraint, function (c) { return c !== source; })) {
|
|
53566
|
+
if (result = isRelatedTo(constraint, target, 1, false, undefined, intersectionState)) {
|
|
53567
|
+
resetErrorInfo(saveErrorInfo);
|
|
53568
|
+
return result;
|
|
53569
|
+
}
|
|
53570
|
+
}
|
|
53571
|
+
}
|
|
53572
|
+
if (!(sourceFlags & 465829888 ||
|
|
53573
|
+
sourceFlags & 524288 && targetFlags & 1048576 ||
|
|
53574
|
+
sourceFlags & 2097152 && targetFlags & (524288 | 1048576 | 465829888))) {
|
|
53575
|
+
return 0;
|
|
53576
|
+
}
|
|
53577
|
+
}
|
|
53578
|
+
if (sourceFlags & (524288 | 16777216) && source.aliasSymbol &&
|
|
53527
53579
|
source.aliasTypeArguments && source.aliasSymbol === target.aliasSymbol &&
|
|
53528
53580
|
!(source.aliasTypeArgumentsContainsMarker || target.aliasTypeArgumentsContainsMarker)) {
|
|
53529
53581
|
var variances = getAliasVariances(source.aliasSymbol);
|
|
@@ -53539,7 +53591,7 @@ var ts;
|
|
|
53539
53591
|
isSingleElementGenericTupleType(target) && (target.target.readonly || isMutableArrayOrTuple(getBaseConstraintOfType(source) || source)) && (result = isRelatedTo(source, getTypeArguments(target)[0], 2))) {
|
|
53540
53592
|
return result;
|
|
53541
53593
|
}
|
|
53542
|
-
if (
|
|
53594
|
+
if (targetFlags & 262144) {
|
|
53543
53595
|
if (ts.getObjectFlags(source) & 32 && !source.declaration.nameType && isRelatedTo(getIndexType(target), getConstraintTypeFromMappedType(source), 3)) {
|
|
53544
53596
|
if (!(getMappedTypeModifiers(source) & 4)) {
|
|
53545
53597
|
var templateType = getTemplateTypeFromMappedType(source);
|
|
@@ -53550,9 +53602,9 @@ var ts;
|
|
|
53550
53602
|
}
|
|
53551
53603
|
}
|
|
53552
53604
|
}
|
|
53553
|
-
else if (
|
|
53605
|
+
else if (targetFlags & 4194304) {
|
|
53554
53606
|
var targetType_1 = target.type;
|
|
53555
|
-
if (
|
|
53607
|
+
if (sourceFlags & 4194304) {
|
|
53556
53608
|
if (result = isRelatedTo(targetType_1, source.type, 3, false)) {
|
|
53557
53609
|
return result;
|
|
53558
53610
|
}
|
|
@@ -53588,8 +53640,8 @@ var ts;
|
|
|
53588
53640
|
}
|
|
53589
53641
|
}
|
|
53590
53642
|
}
|
|
53591
|
-
else if (
|
|
53592
|
-
if (
|
|
53643
|
+
else if (targetFlags & 8388608) {
|
|
53644
|
+
if (sourceFlags & 8388608) {
|
|
53593
53645
|
if (result = isRelatedTo(source.objectType, target.objectType, 3, reportErrors)) {
|
|
53594
53646
|
result &= isRelatedTo(source.indexType, target.indexType, 3, reportErrors);
|
|
53595
53647
|
}
|
|
@@ -53668,7 +53720,7 @@ var ts;
|
|
|
53668
53720
|
}
|
|
53669
53721
|
}
|
|
53670
53722
|
}
|
|
53671
|
-
else if (
|
|
53723
|
+
else if (targetFlags & 16777216) {
|
|
53672
53724
|
if (isDeeplyNestedType(target, targetStack, targetDepth, 10)) {
|
|
53673
53725
|
resetErrorInfo(saveErrorInfo);
|
|
53674
53726
|
return 3;
|
|
@@ -53686,8 +53738,8 @@ var ts;
|
|
|
53686
53738
|
}
|
|
53687
53739
|
}
|
|
53688
53740
|
}
|
|
53689
|
-
else if (
|
|
53690
|
-
if (
|
|
53741
|
+
else if (targetFlags & 134217728) {
|
|
53742
|
+
if (sourceFlags & 134217728) {
|
|
53691
53743
|
if (relation === comparableRelation) {
|
|
53692
53744
|
return templateLiteralTypesDefinitelyUnrelated(source, target) ? 0 : -1;
|
|
53693
53745
|
}
|
|
@@ -53697,10 +53749,10 @@ var ts;
|
|
|
53697
53749
|
return -1;
|
|
53698
53750
|
}
|
|
53699
53751
|
}
|
|
53700
|
-
if (
|
|
53701
|
-
if (!(
|
|
53752
|
+
if (sourceFlags & 8650752) {
|
|
53753
|
+
if (!(sourceFlags & 8388608 && targetFlags & 8388608)) {
|
|
53702
53754
|
var constraint = getConstraintOfType(source);
|
|
53703
|
-
if (!constraint || (
|
|
53755
|
+
if (!constraint || (sourceFlags & 262144 && constraint.flags & 1)) {
|
|
53704
53756
|
if (result = isRelatedTo(emptyObjectType, extractTypesOfKind(target, ~67108864), 3)) {
|
|
53705
53757
|
resetErrorInfo(saveErrorInfo);
|
|
53706
53758
|
return result;
|
|
@@ -53710,7 +53762,7 @@ var ts;
|
|
|
53710
53762
|
resetErrorInfo(saveErrorInfo);
|
|
53711
53763
|
return result;
|
|
53712
53764
|
}
|
|
53713
|
-
else if (result = isRelatedTo(getTypeWithThisArgument(constraint, source), target, 1, reportErrors && !(
|
|
53765
|
+
else if (result = isRelatedTo(getTypeWithThisArgument(constraint, source), target, 1, reportErrors && !(targetFlags & sourceFlags & 262144), undefined, intersectionState)) {
|
|
53714
53766
|
resetErrorInfo(saveErrorInfo);
|
|
53715
53767
|
return result;
|
|
53716
53768
|
}
|
|
@@ -53725,14 +53777,14 @@ var ts;
|
|
|
53725
53777
|
}
|
|
53726
53778
|
}
|
|
53727
53779
|
}
|
|
53728
|
-
else if (
|
|
53780
|
+
else if (sourceFlags & 4194304) {
|
|
53729
53781
|
if (result = isRelatedTo(keyofConstraintType, target, 1, reportErrors)) {
|
|
53730
53782
|
resetErrorInfo(saveErrorInfo);
|
|
53731
53783
|
return result;
|
|
53732
53784
|
}
|
|
53733
53785
|
}
|
|
53734
|
-
else if (
|
|
53735
|
-
if (!(
|
|
53786
|
+
else if (sourceFlags & 134217728 && !(targetFlags & 524288)) {
|
|
53787
|
+
if (!(targetFlags & 134217728)) {
|
|
53736
53788
|
var constraint = getBaseConstraintOfType(source);
|
|
53737
53789
|
if (constraint && constraint !== source && (result = isRelatedTo(constraint, target, 1, reportErrors))) {
|
|
53738
53790
|
resetErrorInfo(saveErrorInfo);
|
|
@@ -53740,8 +53792,8 @@ var ts;
|
|
|
53740
53792
|
}
|
|
53741
53793
|
}
|
|
53742
53794
|
}
|
|
53743
|
-
else if (
|
|
53744
|
-
if (
|
|
53795
|
+
else if (sourceFlags & 268435456) {
|
|
53796
|
+
if (targetFlags & 268435456 && source.symbol === target.symbol) {
|
|
53745
53797
|
if (result = isRelatedTo(source.type, target.type, 3, reportErrors)) {
|
|
53746
53798
|
resetErrorInfo(saveErrorInfo);
|
|
53747
53799
|
return result;
|
|
@@ -53755,12 +53807,12 @@ var ts;
|
|
|
53755
53807
|
}
|
|
53756
53808
|
}
|
|
53757
53809
|
}
|
|
53758
|
-
else if (
|
|
53810
|
+
else if (sourceFlags & 16777216) {
|
|
53759
53811
|
if (isDeeplyNestedType(source, sourceStack, sourceDepth, 10)) {
|
|
53760
53812
|
resetErrorInfo(saveErrorInfo);
|
|
53761
53813
|
return 3;
|
|
53762
53814
|
}
|
|
53763
|
-
if (
|
|
53815
|
+
if (targetFlags & 16777216) {
|
|
53764
53816
|
var sourceParams = source.root.inferTypeParameters;
|
|
53765
53817
|
var sourceExtends = source.extendsType;
|
|
53766
53818
|
var mapper = void 0;
|
|
@@ -53811,9 +53863,10 @@ var ts;
|
|
|
53811
53863
|
}
|
|
53812
53864
|
return 0;
|
|
53813
53865
|
}
|
|
53814
|
-
var sourceIsPrimitive = !!(
|
|
53866
|
+
var sourceIsPrimitive = !!(sourceFlags & 131068);
|
|
53815
53867
|
if (relation !== identityRelation) {
|
|
53816
53868
|
source = getApparentType(source);
|
|
53869
|
+
sourceFlags = source.flags;
|
|
53817
53870
|
}
|
|
53818
53871
|
else if (isGenericMappedType(source)) {
|
|
53819
53872
|
return 0;
|
|
@@ -53843,7 +53896,7 @@ var ts;
|
|
|
53843
53896
|
else if ((relation === subtypeRelation || relation === strictSubtypeRelation) && isEmptyObjectType(target) && ts.getObjectFlags(target) & 16384 && !isEmptyObjectType(source)) {
|
|
53844
53897
|
return 0;
|
|
53845
53898
|
}
|
|
53846
|
-
if (
|
|
53899
|
+
if (sourceFlags & (524288 | 2097152) && targetFlags & 524288) {
|
|
53847
53900
|
var reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo.errorInfo && !sourceIsPrimitive;
|
|
53848
53901
|
result = propertiesRelatedTo(source, target, reportStructuralErrors, undefined, intersectionState);
|
|
53849
53902
|
if (result) {
|
|
@@ -53862,7 +53915,7 @@ var ts;
|
|
|
53862
53915
|
return result;
|
|
53863
53916
|
}
|
|
53864
53917
|
}
|
|
53865
|
-
if (
|
|
53918
|
+
if (sourceFlags & (524288 | 2097152) && targetFlags & 1048576) {
|
|
53866
53919
|
var objectOnlyTarget = extractTypesOfKind(target, 524288 | 2097152 | 33554432);
|
|
53867
53920
|
if (objectOnlyTarget.flags & 1048576) {
|
|
53868
53921
|
var result_9 = typeRelatedToDiscriminatedType(source, objectOnlyTarget);
|
|
@@ -54312,7 +54365,6 @@ var ts;
|
|
|
54312
54365
|
}
|
|
54313
54366
|
}
|
|
54314
54367
|
var result = -1;
|
|
54315
|
-
var saveErrorInfo = captureErrorCalculationState();
|
|
54316
54368
|
var incompatibleReporter = kind === 1 ? reportIncompatibleConstructSignatureReturn : reportIncompatibleCallSignatureReturn;
|
|
54317
54369
|
var sourceObjectFlags = ts.getObjectFlags(source);
|
|
54318
54370
|
var targetObjectFlags = ts.getObjectFlags(target);
|
|
@@ -54344,6 +54396,7 @@ var ts;
|
|
|
54344
54396
|
else {
|
|
54345
54397
|
outer: for (var _i = 0, targetSignatures_1 = targetSignatures; _i < targetSignatures_1.length; _i++) {
|
|
54346
54398
|
var t = targetSignatures_1[_i];
|
|
54399
|
+
var saveErrorInfo = captureErrorCalculationState();
|
|
54347
54400
|
var shouldElaborateErrors = reportErrors;
|
|
54348
54401
|
for (var _c = 0, sourceSignatures_1 = sourceSignatures; _c < sourceSignatures_1.length; _c++) {
|
|
54349
54402
|
var s = sourceSignatures_1[_c];
|
|
@@ -57132,9 +57185,6 @@ var ts;
|
|
|
57132
57185
|
getUnionType(ts.map(type.types, mapper), 1, aliasSymbol, aliasTypeArguments) :
|
|
57133
57186
|
mapType(type, mapper);
|
|
57134
57187
|
}
|
|
57135
|
-
function getConstituentCount(type) {
|
|
57136
|
-
return type.flags & 1048576 ? type.types.length : 1;
|
|
57137
|
-
}
|
|
57138
57188
|
function extractTypesOfKind(type, kind) {
|
|
57139
57189
|
return filterType(type, function (t) { return (t.flags & kind) !== 0; });
|
|
57140
57190
|
}
|
|
@@ -61092,6 +61142,9 @@ var ts;
|
|
|
61092
61142
|
if (compilerOptions.noPropertyAccessFromIndexSignature && ts.isPropertyAccessExpression(node)) {
|
|
61093
61143
|
error(right, ts.Diagnostics.Property_0_comes_from_an_index_signature_so_it_must_be_accessed_with_0, ts.unescapeLeadingUnderscores(right.escapedText));
|
|
61094
61144
|
}
|
|
61145
|
+
if (indexInfo.declaration && ts.getCombinedNodeFlags(indexInfo.declaration) & 134217728) {
|
|
61146
|
+
addDeprecatedSuggestion(right, [indexInfo.declaration], right.escapedText);
|
|
61147
|
+
}
|
|
61095
61148
|
}
|
|
61096
61149
|
else {
|
|
61097
61150
|
if (isDeprecatedSymbol(prop) && isUncalledFunctionReference(node, prop) && prop.declarations) {
|
|
@@ -63643,19 +63696,20 @@ var ts;
|
|
|
63643
63696
|
if (links.type === unknownType) {
|
|
63644
63697
|
links.type = getTypeFromBindingPattern(declaration.name);
|
|
63645
63698
|
}
|
|
63646
|
-
assignBindingElementTypes(declaration.name);
|
|
63699
|
+
assignBindingElementTypes(declaration.name, links.type);
|
|
63647
63700
|
}
|
|
63648
63701
|
}
|
|
63649
63702
|
}
|
|
63650
|
-
function assignBindingElementTypes(pattern) {
|
|
63703
|
+
function assignBindingElementTypes(pattern, parentType) {
|
|
63651
63704
|
for (var _i = 0, _a = pattern.elements; _i < _a.length; _i++) {
|
|
63652
63705
|
var element = _a[_i];
|
|
63653
63706
|
if (!ts.isOmittedExpression(element)) {
|
|
63707
|
+
var type = getBindingElementTypeFromParentType(element, parentType);
|
|
63654
63708
|
if (element.name.kind === 79) {
|
|
63655
|
-
getSymbolLinks(getSymbolOfNode(element)).type =
|
|
63709
|
+
getSymbolLinks(getSymbolOfNode(element)).type = type;
|
|
63656
63710
|
}
|
|
63657
63711
|
else {
|
|
63658
|
-
assignBindingElementTypes(element.name);
|
|
63712
|
+
assignBindingElementTypes(element.name, type);
|
|
63659
63713
|
}
|
|
63660
63714
|
}
|
|
63661
63715
|
}
|
|
@@ -66850,26 +66904,24 @@ var ts;
|
|
|
66850
66904
|
if (returnType.flags & 1) {
|
|
66851
66905
|
return;
|
|
66852
66906
|
}
|
|
66907
|
+
var headMessage;
|
|
66853
66908
|
var expectedReturnType;
|
|
66854
|
-
var headMessage = getDiagnosticHeadMessageForDecoratorResolution(node);
|
|
66855
|
-
var errorInfo;
|
|
66856
66909
|
switch (node.parent.kind) {
|
|
66857
66910
|
case 256:
|
|
66911
|
+
headMessage = ts.Diagnostics.Decorator_function_return_type_0_is_not_assignable_to_type_1;
|
|
66858
66912
|
var classSymbol = getSymbolOfNode(node.parent);
|
|
66859
66913
|
var classConstructorType = getTypeOfSymbol(classSymbol);
|
|
66860
66914
|
expectedReturnType = getUnionType([classConstructorType, voidType]);
|
|
66861
66915
|
break;
|
|
66862
|
-
case 163:
|
|
66863
|
-
expectedReturnType = voidType;
|
|
66864
|
-
errorInfo = ts.chainDiagnosticMessages(undefined, ts.Diagnostics.The_return_type_of_a_parameter_decorator_function_must_be_either_void_or_any);
|
|
66865
|
-
break;
|
|
66866
66916
|
case 166:
|
|
66917
|
+
case 163:
|
|
66918
|
+
headMessage = ts.Diagnostics.Decorator_function_return_type_is_0_but_is_expected_to_be_void_or_any;
|
|
66867
66919
|
expectedReturnType = voidType;
|
|
66868
|
-
errorInfo = ts.chainDiagnosticMessages(undefined, ts.Diagnostics.The_return_type_of_a_property_decorator_function_must_be_either_void_or_any);
|
|
66869
66920
|
break;
|
|
66870
66921
|
case 168:
|
|
66871
66922
|
case 171:
|
|
66872
66923
|
case 172:
|
|
66924
|
+
headMessage = ts.Diagnostics.Decorator_function_return_type_0_is_not_assignable_to_type_1;
|
|
66873
66925
|
var methodType = getTypeOfNode(node.parent);
|
|
66874
66926
|
var descriptorType = createTypedPropertyDescriptorType(methodType);
|
|
66875
66927
|
expectedReturnType = getUnionType([descriptorType, voidType]);
|
|
@@ -66877,7 +66929,7 @@ var ts;
|
|
|
66877
66929
|
default:
|
|
66878
66930
|
return ts.Debug.fail();
|
|
66879
66931
|
}
|
|
66880
|
-
checkTypeAssignableTo(returnType, expectedReturnType, node, headMessage
|
|
66932
|
+
checkTypeAssignableTo(returnType, expectedReturnType, node, headMessage);
|
|
66881
66933
|
}
|
|
66882
66934
|
function markTypeNodeAsReferenced(node) {
|
|
66883
66935
|
markEntityNameOrEntityExpressionAsReference(node && ts.getEntityNameFromTypeNode(node));
|
|
@@ -71662,13 +71714,13 @@ var ts;
|
|
|
71662
71714
|
var fileToDirective;
|
|
71663
71715
|
if (resolvedTypeReferenceDirectives) {
|
|
71664
71716
|
fileToDirective = new ts.Map();
|
|
71665
|
-
resolvedTypeReferenceDirectives.forEach(function (resolvedDirective, key) {
|
|
71717
|
+
resolvedTypeReferenceDirectives.forEach(function (resolvedDirective, key, mode) {
|
|
71666
71718
|
if (!resolvedDirective || !resolvedDirective.resolvedFileName) {
|
|
71667
71719
|
return;
|
|
71668
71720
|
}
|
|
71669
71721
|
var file = host.getSourceFile(resolvedDirective.resolvedFileName);
|
|
71670
71722
|
if (file) {
|
|
71671
|
-
addReferencedFilesToTypeDirective(file, key);
|
|
71723
|
+
addReferencedFilesToTypeDirective(file, key, mode);
|
|
71672
71724
|
}
|
|
71673
71725
|
});
|
|
71674
71726
|
}
|
|
@@ -71846,16 +71898,16 @@ var ts;
|
|
|
71846
71898
|
}
|
|
71847
71899
|
return false;
|
|
71848
71900
|
}
|
|
71849
|
-
function addReferencedFilesToTypeDirective(file, key) {
|
|
71901
|
+
function addReferencedFilesToTypeDirective(file, key, mode) {
|
|
71850
71902
|
if (fileToDirective.has(file.path))
|
|
71851
71903
|
return;
|
|
71852
|
-
fileToDirective.set(file.path, key);
|
|
71904
|
+
fileToDirective.set(file.path, [key, mode]);
|
|
71853
71905
|
for (var _i = 0, _a = file.referencedFiles; _i < _a.length; _i++) {
|
|
71854
|
-
var
|
|
71906
|
+
var _b = _a[_i], fileName = _b.fileName, resolutionMode = _b.resolutionMode;
|
|
71855
71907
|
var resolvedFile = ts.resolveTripleslashReference(fileName, file.fileName);
|
|
71856
71908
|
var referencedFile = host.getSourceFile(resolvedFile);
|
|
71857
71909
|
if (referencedFile) {
|
|
71858
|
-
addReferencedFilesToTypeDirective(referencedFile, key);
|
|
71910
|
+
addReferencedFilesToTypeDirective(referencedFile, key, resolutionMode || file.impliedNodeFormat);
|
|
71859
71911
|
}
|
|
71860
71912
|
}
|
|
71861
71913
|
}
|
|
@@ -73446,25 +73498,24 @@ var ts;
|
|
|
73446
73498
|
}
|
|
73447
73499
|
function findMostOverlappyType(source, unionTarget) {
|
|
73448
73500
|
var bestMatch;
|
|
73449
|
-
|
|
73450
|
-
|
|
73451
|
-
var
|
|
73452
|
-
|
|
73453
|
-
|
|
73454
|
-
|
|
73455
|
-
|
|
73456
|
-
|
|
73457
|
-
|
|
73458
|
-
|
|
73459
|
-
|
|
73460
|
-
|
|
73461
|
-
|
|
73501
|
+
if (!(source.flags & (131068 | 406847488))) {
|
|
73502
|
+
var matchingCount = 0;
|
|
73503
|
+
for (var _i = 0, _a = unionTarget.types; _i < _a.length; _i++) {
|
|
73504
|
+
var target = _a[_i];
|
|
73505
|
+
if (!(target.flags & (131068 | 406847488))) {
|
|
73506
|
+
var overlap = getIntersectionType([getIndexType(source), getIndexType(target)]);
|
|
73507
|
+
if (overlap.flags & 4194304) {
|
|
73508
|
+
return target;
|
|
73509
|
+
}
|
|
73510
|
+
else if (isUnitType(overlap) || overlap.flags & 1048576) {
|
|
73511
|
+
var len = overlap.flags & 1048576 ? ts.countWhere(overlap.types, isUnitType) : 1;
|
|
73512
|
+
if (len >= matchingCount) {
|
|
73513
|
+
bestMatch = target;
|
|
73514
|
+
matchingCount = len;
|
|
73515
|
+
}
|
|
73516
|
+
}
|
|
73462
73517
|
}
|
|
73463
73518
|
}
|
|
73464
|
-
else if (isUnitType(overlap) && 1 >= matchingCount) {
|
|
73465
|
-
bestMatch = target;
|
|
73466
|
-
matchingCount = 1;
|
|
73467
|
-
}
|
|
73468
73519
|
}
|
|
73469
73520
|
return bestMatch;
|
|
73470
73521
|
}
|
|
@@ -87148,7 +87199,7 @@ var ts;
|
|
|
87148
87199
|
var sourceFile = ts.createUnparsedSourceFile(prepend, "dts", stripInternal);
|
|
87149
87200
|
hasNoDefaultLib_1 = hasNoDefaultLib_1 || !!sourceFile.hasNoDefaultLib;
|
|
87150
87201
|
collectReferences(sourceFile, refs);
|
|
87151
|
-
recordTypeReferenceDirectivesIfNecessary(sourceFile.typeReferenceDirectives);
|
|
87202
|
+
recordTypeReferenceDirectivesIfNecessary(ts.map(sourceFile.typeReferenceDirectives, function (ref) { return [ref.fileName, ref.resolutionMode]; }));
|
|
87152
87203
|
collectLibs(sourceFile, libs);
|
|
87153
87204
|
return sourceFile;
|
|
87154
87205
|
}
|
|
@@ -87202,9 +87253,10 @@ var ts;
|
|
|
87202
87253
|
return ts.map(ts.arrayFrom(libs.keys()), function (lib) { return ({ fileName: lib, pos: -1, end: -1 }); });
|
|
87203
87254
|
}
|
|
87204
87255
|
function getFileReferencesForUsedTypeReferences() {
|
|
87205
|
-
return necessaryTypeReferences ? ts.mapDefined(ts.arrayFrom(necessaryTypeReferences.keys()),
|
|
87256
|
+
return necessaryTypeReferences ? ts.mapDefined(ts.arrayFrom(necessaryTypeReferences.keys()), getFileReferenceForSpecifierModeTuple) : [];
|
|
87206
87257
|
}
|
|
87207
|
-
function
|
|
87258
|
+
function getFileReferenceForSpecifierModeTuple(_a) {
|
|
87259
|
+
var typeName = _a[0], mode = _a[1];
|
|
87208
87260
|
if (emittedImports) {
|
|
87209
87261
|
for (var _i = 0, emittedImports_1 = emittedImports; _i < emittedImports_1.length; _i++) {
|
|
87210
87262
|
var importStatement = emittedImports_1[_i];
|
|
@@ -87219,7 +87271,7 @@ var ts;
|
|
|
87219
87271
|
}
|
|
87220
87272
|
}
|
|
87221
87273
|
}
|
|
87222
|
-
return { fileName: typeName, pos: -1, end: -1 };
|
|
87274
|
+
return __assign({ fileName: typeName, pos: -1, end: -1 }, (mode ? { resolutionMode: mode } : undefined));
|
|
87223
87275
|
}
|
|
87224
87276
|
function mapReferencesIntoArray(references, outputFilePath) {
|
|
87225
87277
|
return function (file) {
|
|
@@ -87236,7 +87288,7 @@ var ts;
|
|
|
87236
87288
|
if (declFileName) {
|
|
87237
87289
|
var specifier = ts.moduleSpecifiers.getModuleSpecifier(options, currentSourceFile, ts.toPath(outputFilePath, host.getCurrentDirectory(), host.getCanonicalFileName), ts.toPath(declFileName, host.getCurrentDirectory(), host.getCanonicalFileName), host);
|
|
87238
87290
|
if (!ts.pathIsRelative(specifier)) {
|
|
87239
|
-
recordTypeReferenceDirectivesIfNecessary([specifier]);
|
|
87291
|
+
recordTypeReferenceDirectivesIfNecessary([[specifier, undefined]]);
|
|
87240
87292
|
return;
|
|
87241
87293
|
}
|
|
87242
87294
|
var fileName = ts.getRelativePathToDirectoryOrUrl(outputFilePath, declFileName, host.getCurrentDirectory(), host.getCanonicalFileName, false);
|
|
@@ -91871,9 +91923,12 @@ var ts;
|
|
|
91871
91923
|
for (var _d = 0, types_24 = types; _d < types_24.length; _d++) {
|
|
91872
91924
|
var directive = types_24[_d];
|
|
91873
91925
|
var pos = writer.getTextPos();
|
|
91874
|
-
|
|
91926
|
+
var resolutionMode = directive.resolutionMode && directive.resolutionMode !== (currentSourceFile === null || currentSourceFile === void 0 ? void 0 : currentSourceFile.impliedNodeFormat)
|
|
91927
|
+
? "resolution-mode=\"" + (directive.resolutionMode === ts.ModuleKind.ESNext ? "import" : "require") + "\""
|
|
91928
|
+
: "";
|
|
91929
|
+
writeComment("/// <reference types=\"" + directive.fileName + "\" " + resolutionMode + "/>");
|
|
91875
91930
|
if (bundleFileInfo)
|
|
91876
|
-
bundleFileInfo.sections.push({ pos: pos, end: writer.getTextPos(), kind: "type", data: directive.fileName });
|
|
91931
|
+
bundleFileInfo.sections.push({ pos: pos, end: writer.getTextPos(), kind: !directive.resolutionMode ? "type" : directive.resolutionMode === ts.ModuleKind.ESNext ? "type-import" : "type-require", data: directive.fileName });
|
|
91877
91932
|
writeLine();
|
|
91878
91933
|
}
|
|
91879
91934
|
for (var _e = 0, libs_1 = libs; _e < libs_1.length; _e++) {
|
|
@@ -94179,7 +94234,7 @@ var ts;
|
|
|
94179
94234
|
return result;
|
|
94180
94235
|
}
|
|
94181
94236
|
ts.flattenDiagnosticMessageText = flattenDiagnosticMessageText;
|
|
94182
|
-
function
|
|
94237
|
+
function loadWithTypeDirectiveCache(names, containingFile, redirectedReference, containingFileMode, loader) {
|
|
94183
94238
|
if (names.length === 0) {
|
|
94184
94239
|
return [];
|
|
94185
94240
|
}
|
|
@@ -94188,18 +94243,25 @@ var ts;
|
|
|
94188
94243
|
for (var _i = 0, names_2 = names; _i < names_2.length; _i++) {
|
|
94189
94244
|
var name = names_2[_i];
|
|
94190
94245
|
var result = void 0;
|
|
94191
|
-
|
|
94192
|
-
|
|
94246
|
+
var mode = getModeForFileReference(name, containingFileMode);
|
|
94247
|
+
var strName = ts.isString(name) ? name : name.fileName.toLowerCase();
|
|
94248
|
+
var cacheKey = mode !== undefined ? mode + "|" + strName : strName;
|
|
94249
|
+
if (cache.has(cacheKey)) {
|
|
94250
|
+
result = cache.get(cacheKey);
|
|
94193
94251
|
}
|
|
94194
94252
|
else {
|
|
94195
|
-
cache.set(
|
|
94253
|
+
cache.set(cacheKey, result = loader(strName, containingFile, redirectedReference, mode));
|
|
94196
94254
|
}
|
|
94197
94255
|
resolutions.push(result);
|
|
94198
94256
|
}
|
|
94199
94257
|
return resolutions;
|
|
94200
94258
|
}
|
|
94201
|
-
ts.
|
|
94259
|
+
ts.loadWithTypeDirectiveCache = loadWithTypeDirectiveCache;
|
|
94202
94260
|
;
|
|
94261
|
+
function getModeForFileReference(ref, containingFileMode) {
|
|
94262
|
+
return (ts.isString(ref) ? containingFileMode : ref.resolutionMode) || containingFileMode;
|
|
94263
|
+
}
|
|
94264
|
+
ts.getModeForFileReference = getModeForFileReference;
|
|
94203
94265
|
function getModeForResolutionAtIndex(file, index) {
|
|
94204
94266
|
if (file.impliedNodeFormat === undefined)
|
|
94205
94267
|
return undefined;
|
|
@@ -94288,7 +94350,7 @@ var ts;
|
|
|
94288
94350
|
var _d, _e, _f, _g;
|
|
94289
94351
|
var file = ts.Debug.checkDefined(getSourceFileByPath(ref.file));
|
|
94290
94352
|
var kind = ref.kind, index = ref.index;
|
|
94291
|
-
var pos, end, packageId;
|
|
94353
|
+
var pos, end, packageId, resolutionMode;
|
|
94292
94354
|
switch (kind) {
|
|
94293
94355
|
case ts.FileIncludeKind.Import:
|
|
94294
94356
|
var importLiteral = getModuleNameStringLiteralAt(file, index);
|
|
@@ -94302,8 +94364,8 @@ var ts;
|
|
|
94302
94364
|
(_a = file.referencedFiles[index], pos = _a.pos, end = _a.end);
|
|
94303
94365
|
break;
|
|
94304
94366
|
case ts.FileIncludeKind.TypeReferenceDirective:
|
|
94305
|
-
(_b = file.typeReferenceDirectives[index], pos = _b.pos, end = _b.end);
|
|
94306
|
-
packageId = (_g = (_f = file.resolvedTypeReferenceDirectiveNames) === null || _f === void 0 ? void 0 : _f.get(ts.toFileNameLowerCase(file.typeReferenceDirectives[index].fileName), file.impliedNodeFormat)) === null || _g === void 0 ? void 0 : _g.packageId;
|
|
94367
|
+
(_b = file.typeReferenceDirectives[index], pos = _b.pos, end = _b.end, resolutionMode = _b.resolutionMode);
|
|
94368
|
+
packageId = (_g = (_f = file.resolvedTypeReferenceDirectiveNames) === null || _f === void 0 ? void 0 : _f.get(ts.toFileNameLowerCase(file.typeReferenceDirectives[index].fileName), resolutionMode || file.impliedNodeFormat)) === null || _g === void 0 ? void 0 : _g.packageId;
|
|
94307
94369
|
break;
|
|
94308
94370
|
case ts.FileIncludeKind.LibReferenceDirective:
|
|
94309
94371
|
(_c = file.libReferenceDirectives[index], pos = _c.pos, end = _c.end);
|
|
@@ -94509,7 +94571,7 @@ var ts;
|
|
|
94509
94571
|
var fileReasons = ts.createMultiMap();
|
|
94510
94572
|
var cachedBindAndCheckDiagnosticsForFile = {};
|
|
94511
94573
|
var cachedDeclarationDiagnosticsForFile = {};
|
|
94512
|
-
var resolvedTypeReferenceDirectives =
|
|
94574
|
+
var resolvedTypeReferenceDirectives = ts.createModeAwareCache();
|
|
94513
94575
|
var fileProcessingDiagnostics;
|
|
94514
94576
|
var maxNodeModuleJsDepth = typeof options.maxNodeModuleJsDepth === "number" ? options.maxNodeModuleJsDepth : 0;
|
|
94515
94577
|
var currentNodeModulesDepth = 0;
|
|
@@ -94550,12 +94612,12 @@ var ts;
|
|
|
94550
94612
|
}
|
|
94551
94613
|
var actualResolveTypeReferenceDirectiveNamesWorker;
|
|
94552
94614
|
if (host.resolveTypeReferenceDirectives) {
|
|
94553
|
-
actualResolveTypeReferenceDirectiveNamesWorker = function (typeDirectiveNames, containingFile, redirectedReference) { return host.resolveTypeReferenceDirectives(ts.Debug.checkEachDefined(typeDirectiveNames), containingFile, redirectedReference, options); };
|
|
94615
|
+
actualResolveTypeReferenceDirectiveNamesWorker = function (typeDirectiveNames, containingFile, redirectedReference, containingFileMode) { return host.resolveTypeReferenceDirectives(ts.Debug.checkEachDefined(typeDirectiveNames), containingFile, redirectedReference, options, containingFileMode); };
|
|
94554
94616
|
}
|
|
94555
94617
|
else {
|
|
94556
94618
|
typeReferenceDirectiveResolutionCache = ts.createTypeReferenceDirectiveResolutionCache(currentDirectory, getCanonicalFileName, undefined, moduleResolutionCache === null || moduleResolutionCache === void 0 ? void 0 : moduleResolutionCache.getPackageJsonInfoCache());
|
|
94557
|
-
var loader_2 = function (typesRef, containingFile, redirectedReference) { return ts.resolveTypeReferenceDirective(typesRef, containingFile, options, host, redirectedReference, typeReferenceDirectiveResolutionCache).resolvedTypeReferenceDirective; };
|
|
94558
|
-
actualResolveTypeReferenceDirectiveNamesWorker = function (typeReferenceDirectiveNames, containingFile, redirectedReference) { return
|
|
94619
|
+
var loader_2 = function (typesRef, containingFile, redirectedReference, resolutionMode) { return ts.resolveTypeReferenceDirective(typesRef, containingFile, options, host, redirectedReference, typeReferenceDirectiveResolutionCache, resolutionMode).resolvedTypeReferenceDirective; };
|
|
94620
|
+
actualResolveTypeReferenceDirectiveNamesWorker = function (typeReferenceDirectiveNames, containingFile, redirectedReference, containingFileMode) { return loadWithTypeDirectiveCache(ts.Debug.checkEachDefined(typeReferenceDirectiveNames), containingFile, redirectedReference, containingFileMode, loader_2); };
|
|
94559
94621
|
}
|
|
94560
94622
|
var packageIdToSourceFile = new ts.Map();
|
|
94561
94623
|
var sourceFileToPackageName = new ts.Map();
|
|
@@ -94634,7 +94696,7 @@ var ts;
|
|
|
94634
94696
|
var containingFilename = ts.combinePaths(containingDirectory, ts.inferredTypesContainingFile);
|
|
94635
94697
|
var resolutions = resolveTypeReferenceDirectiveNamesWorker(typeReferences, containingFilename);
|
|
94636
94698
|
for (var i = 0; i < typeReferences.length; i++) {
|
|
94637
|
-
processTypeReferenceDirective(typeReferences[i], resolutions[i], { kind: ts.FileIncludeKind.AutomaticTypeDirectiveFile, typeReference: typeReferences[i], packageId: (_c = resolutions[i]) === null || _c === void 0 ? void 0 : _c.packageId });
|
|
94699
|
+
processTypeReferenceDirective(typeReferences[i], undefined, resolutions[i], { kind: ts.FileIncludeKind.AutomaticTypeDirectiveFile, typeReference: typeReferences[i], packageId: (_c = resolutions[i]) === null || _c === void 0 ? void 0 : _c.packageId });
|
|
94638
94700
|
}
|
|
94639
94701
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
94640
94702
|
}
|
|
@@ -94782,9 +94844,10 @@ var ts;
|
|
|
94782
94844
|
return [];
|
|
94783
94845
|
var containingFileName = !ts.isString(containingFile) ? ts.getNormalizedAbsolutePath(containingFile.originalFileName, currentDirectory) : containingFile;
|
|
94784
94846
|
var redirectedReference = !ts.isString(containingFile) ? getRedirectReferenceForResolution(containingFile) : undefined;
|
|
94847
|
+
var containingFileMode = !ts.isString(containingFile) ? containingFile.impliedNodeFormat : undefined;
|
|
94785
94848
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("program", "resolveTypeReferenceDirectiveNamesWorker", { containingFileName: containingFileName });
|
|
94786
94849
|
ts.performance.mark("beforeResolveTypeReference");
|
|
94787
|
-
var result = actualResolveTypeReferenceDirectiveNamesWorker(typeDirectiveNames, containingFileName, redirectedReference);
|
|
94850
|
+
var result = actualResolveTypeReferenceDirectiveNamesWorker(typeDirectiveNames, containingFileName, redirectedReference, containingFileMode);
|
|
94788
94851
|
ts.performance.mark("afterResolveTypeReference");
|
|
94789
94852
|
ts.performance.measure("ResolveTypeReference", "beforeResolveTypeReference", "afterResolveTypeReference");
|
|
94790
94853
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
@@ -95086,7 +95149,7 @@ var ts;
|
|
|
95086
95149
|
else {
|
|
95087
95150
|
newSourceFile.resolvedModules = oldSourceFile.resolvedModules;
|
|
95088
95151
|
}
|
|
95089
|
-
var typesReferenceDirectives =
|
|
95152
|
+
var typesReferenceDirectives = newSourceFile.typeReferenceDirectives;
|
|
95090
95153
|
var typeReferenceResolutions = resolveTypeReferenceDirectiveNamesWorker(typesReferenceDirectives, newSourceFile);
|
|
95091
95154
|
var typeReferenceResolutionsChanged = ts.hasChangesInResolutions(typesReferenceDirectives, typeReferenceResolutions, oldSourceFile.resolvedTypeReferenceDirectiveNames, oldSourceFile, ts.typeDirectiveIsEqualTo);
|
|
95092
95155
|
if (typeReferenceResolutionsChanged) {
|
|
@@ -96037,7 +96100,7 @@ var ts;
|
|
|
96037
96100
|
});
|
|
96038
96101
|
}
|
|
96039
96102
|
function processTypeReferenceDirectives(file) {
|
|
96040
|
-
var typeDirectives =
|
|
96103
|
+
var typeDirectives = file.typeReferenceDirectives;
|
|
96041
96104
|
if (!typeDirectives) {
|
|
96042
96105
|
return;
|
|
96043
96106
|
}
|
|
@@ -96047,16 +96110,20 @@ var ts;
|
|
|
96047
96110
|
var resolvedTypeReferenceDirective = resolutions[index];
|
|
96048
96111
|
var fileName = ts.toFileNameLowerCase(ref.fileName);
|
|
96049
96112
|
ts.setResolvedTypeReferenceDirective(file, fileName, resolvedTypeReferenceDirective);
|
|
96050
|
-
|
|
96113
|
+
var mode = ref.resolutionMode || file.impliedNodeFormat;
|
|
96114
|
+
if (mode && ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.Node12 && ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.NodeNext) {
|
|
96115
|
+
programDiagnostics.add(ts.createDiagnosticForRange(file, ref, ts.Diagnostics.Resolution_modes_are_only_supported_when_moduleResolution_is_node12_or_nodenext));
|
|
96116
|
+
}
|
|
96117
|
+
processTypeReferenceDirective(fileName, mode, resolvedTypeReferenceDirective, { kind: ts.FileIncludeKind.TypeReferenceDirective, file: file.path, index: index, });
|
|
96051
96118
|
}
|
|
96052
96119
|
}
|
|
96053
|
-
function processTypeReferenceDirective(typeReferenceDirective, resolvedTypeReferenceDirective, reason) {
|
|
96120
|
+
function processTypeReferenceDirective(typeReferenceDirective, mode, resolvedTypeReferenceDirective, reason) {
|
|
96054
96121
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("program", "processTypeReferenceDirective", { directive: typeReferenceDirective, hasResolved: !!resolveModuleNamesReusingOldState, refKind: reason.kind, refPath: isReferencedFile(reason) ? reason.file : undefined });
|
|
96055
|
-
processTypeReferenceDirectiveWorker(typeReferenceDirective, resolvedTypeReferenceDirective, reason);
|
|
96122
|
+
processTypeReferenceDirectiveWorker(typeReferenceDirective, mode, resolvedTypeReferenceDirective, reason);
|
|
96056
96123
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
96057
96124
|
}
|
|
96058
|
-
function processTypeReferenceDirectiveWorker(typeReferenceDirective, resolvedTypeReferenceDirective, reason) {
|
|
96059
|
-
var previousResolution = resolvedTypeReferenceDirectives.get(typeReferenceDirective);
|
|
96125
|
+
function processTypeReferenceDirectiveWorker(typeReferenceDirective, mode, resolvedTypeReferenceDirective, reason) {
|
|
96126
|
+
var previousResolution = resolvedTypeReferenceDirectives.get(typeReferenceDirective, mode);
|
|
96060
96127
|
if (previousResolution && previousResolution.primary) {
|
|
96061
96128
|
return;
|
|
96062
96129
|
}
|
|
@@ -96089,7 +96156,7 @@ var ts;
|
|
|
96089
96156
|
addFilePreprocessingFileExplainingDiagnostic(undefined, reason, ts.Diagnostics.Cannot_find_type_definition_file_for_0, [typeReferenceDirective]);
|
|
96090
96157
|
}
|
|
96091
96158
|
if (saveResolution) {
|
|
96092
|
-
resolvedTypeReferenceDirectives.set(typeReferenceDirective, resolvedTypeReferenceDirective);
|
|
96159
|
+
resolvedTypeReferenceDirectives.set(typeReferenceDirective, mode, resolvedTypeReferenceDirective);
|
|
96093
96160
|
}
|
|
96094
96161
|
}
|
|
96095
96162
|
function pathForLibFile(libFileName) {
|
|
@@ -98498,9 +98565,9 @@ var ts;
|
|
|
98498
98565
|
});
|
|
98499
98566
|
hasChangedAutomaticTypeDirectiveNames = false;
|
|
98500
98567
|
}
|
|
98501
|
-
function resolveModuleName(moduleName, containingFile, compilerOptions, host, redirectedReference) {
|
|
98568
|
+
function resolveModuleName(moduleName, containingFile, compilerOptions, host, redirectedReference, _containingSourceFile, mode) {
|
|
98502
98569
|
var _a;
|
|
98503
|
-
var primaryResult = ts.resolveModuleName(moduleName, containingFile, compilerOptions, host, moduleResolutionCache, redirectedReference);
|
|
98570
|
+
var primaryResult = ts.resolveModuleName(moduleName, containingFile, compilerOptions, host, moduleResolutionCache, redirectedReference, mode);
|
|
98504
98571
|
if (!resolutionHost.getGlobalCache) {
|
|
98505
98572
|
return primaryResult;
|
|
98506
98573
|
}
|
|
@@ -98515,12 +98582,12 @@ var ts;
|
|
|
98515
98582
|
}
|
|
98516
98583
|
return primaryResult;
|
|
98517
98584
|
}
|
|
98518
|
-
function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFile, options, host, redirectedReference) {
|
|
98519
|
-
return ts.resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFile, options, host, redirectedReference, typeReferenceDirectiveResolutionCache);
|
|
98585
|
+
function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFile, options, host, redirectedReference, _containingSourceFile, resolutionMode) {
|
|
98586
|
+
return ts.resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFile, options, host, redirectedReference, typeReferenceDirectiveResolutionCache, resolutionMode);
|
|
98520
98587
|
}
|
|
98521
98588
|
function resolveNamesWithLocalCache(_a) {
|
|
98522
98589
|
var _b, _c, _d;
|
|
98523
|
-
var names = _a.names, containingFile = _a.containingFile, redirectedReference = _a.redirectedReference, cache = _a.cache, perDirectoryCacheWithRedirects = _a.perDirectoryCacheWithRedirects, loader = _a.loader, getResolutionWithResolvedFileName = _a.getResolutionWithResolvedFileName, shouldRetryResolution = _a.shouldRetryResolution, reusedNames = _a.reusedNames, logChanges = _a.logChanges, containingSourceFile = _a.containingSourceFile;
|
|
98590
|
+
var names = _a.names, containingFile = _a.containingFile, redirectedReference = _a.redirectedReference, cache = _a.cache, perDirectoryCacheWithRedirects = _a.perDirectoryCacheWithRedirects, loader = _a.loader, getResolutionWithResolvedFileName = _a.getResolutionWithResolvedFileName, shouldRetryResolution = _a.shouldRetryResolution, reusedNames = _a.reusedNames, logChanges = _a.logChanges, containingSourceFile = _a.containingSourceFile, containingSourceFileMode = _a.containingSourceFileMode;
|
|
98524
98591
|
var path = resolutionHost.toPath(containingFile);
|
|
98525
98592
|
var resolutionsInFile = cache.get(path) || cache.set(path, ts.createModeAwareCache()).get(path);
|
|
98526
98593
|
var dirPath = ts.getDirectoryPath(path);
|
|
@@ -98541,8 +98608,10 @@ var ts;
|
|
|
98541
98608
|
var seenNamesInFile = ts.createModeAwareCache();
|
|
98542
98609
|
var i = 0;
|
|
98543
98610
|
for (var _i = 0, names_4 = names; _i < names_4.length; _i++) {
|
|
98544
|
-
var
|
|
98545
|
-
var
|
|
98611
|
+
var entry = names_4[_i];
|
|
98612
|
+
var name = ts.isString(entry) ? entry : entry.fileName.toLowerCase();
|
|
98613
|
+
var mode = !ts.isString(entry) ? ts.getModeForFileReference(entry, containingSourceFileMode) :
|
|
98614
|
+
containingSourceFile ? ts.getModeForResolutionAtIndex(containingSourceFile, i) : undefined;
|
|
98546
98615
|
i++;
|
|
98547
98616
|
var resolution = resolutionsInFile.get(name, mode);
|
|
98548
98617
|
if (!seenNamesInFile.has(name, mode) &&
|
|
@@ -98569,7 +98638,7 @@ var ts;
|
|
|
98569
98638
|
}
|
|
98570
98639
|
}
|
|
98571
98640
|
else {
|
|
98572
|
-
resolution = loader(name, containingFile, compilerOptions, ((_c = resolutionHost.getCompilerHost) === null || _c === void 0 ? void 0 : _c.call(resolutionHost)) || resolutionHost, redirectedReference, containingSourceFile);
|
|
98641
|
+
resolution = loader(name, containingFile, compilerOptions, ((_c = resolutionHost.getCompilerHost) === null || _c === void 0 ? void 0 : _c.call(resolutionHost)) || resolutionHost, redirectedReference, containingSourceFile, mode);
|
|
98573
98642
|
perDirectoryResolution.set(name, mode, resolution);
|
|
98574
98643
|
if (resolutionHost.onDiscoveredSymlink && resolutionIsSymlink(resolution)) {
|
|
98575
98644
|
resolutionHost.onDiscoveredSymlink();
|
|
@@ -98631,7 +98700,7 @@ var ts;
|
|
|
98631
98700
|
return oldResult.resolvedFileName === newResult.resolvedFileName;
|
|
98632
98701
|
}
|
|
98633
98702
|
}
|
|
98634
|
-
function resolveTypeReferenceDirectives(typeDirectiveNames, containingFile, redirectedReference) {
|
|
98703
|
+
function resolveTypeReferenceDirectives(typeDirectiveNames, containingFile, redirectedReference, containingFileMode) {
|
|
98635
98704
|
return resolveNamesWithLocalCache({
|
|
98636
98705
|
names: typeDirectiveNames,
|
|
98637
98706
|
containingFile: containingFile,
|
|
@@ -98641,6 +98710,7 @@ var ts;
|
|
|
98641
98710
|
loader: resolveTypeReferenceDirective,
|
|
98642
98711
|
getResolutionWithResolvedFileName: getResolvedTypeReferenceDirective,
|
|
98643
98712
|
shouldRetryResolution: function (resolution) { return resolution.resolvedTypeReferenceDirective === undefined; },
|
|
98713
|
+
containingSourceFileMode: containingFileMode
|
|
98644
98714
|
});
|
|
98645
98715
|
}
|
|
98646
98716
|
function resolveModuleNames(moduleNames, containingFile, reusedNames, redirectedReference, containingSourceFile) {
|
|
@@ -100332,7 +100402,7 @@ var ts;
|
|
|
100332
100402
|
}
|
|
100333
100403
|
return host.resolveTypeReferenceDirectives.apply(host, args);
|
|
100334
100404
|
}) :
|
|
100335
|
-
(function (typeDirectiveNames, containingFile, redirectedReference) { return resolutionCache.resolveTypeReferenceDirectives(typeDirectiveNames, containingFile, redirectedReference); });
|
|
100405
|
+
(function (typeDirectiveNames, containingFile, redirectedReference, _options, containingFileMode) { return resolutionCache.resolveTypeReferenceDirectives(typeDirectiveNames, containingFile, redirectedReference, containingFileMode); });
|
|
100336
100406
|
var userProvidedResolution = !!host.resolveModuleNames || !!host.resolveTypeReferenceDirectives;
|
|
100337
100407
|
builderProgram = readBuilderProgram(compilerOptions, compilerHost);
|
|
100338
100408
|
synchronizeProgram();
|
|
@@ -100986,9 +101056,9 @@ var ts;
|
|
|
100986
101056
|
compilerHost.getModuleResolutionCache = function () { return moduleResolutionCache; };
|
|
100987
101057
|
}
|
|
100988
101058
|
if (!compilerHost.resolveTypeReferenceDirectives) {
|
|
100989
|
-
var loader_4 = function (moduleName, containingFile, redirectedReference) { return ts.resolveTypeReferenceDirective(moduleName, containingFile, state.projectCompilerOptions, compilerHost, redirectedReference, state.typeReferenceDirectiveResolutionCache).resolvedTypeReferenceDirective; };
|
|
100990
|
-
compilerHost.resolveTypeReferenceDirectives = function (typeReferenceDirectiveNames, containingFile, redirectedReference) {
|
|
100991
|
-
return ts.
|
|
101059
|
+
var loader_4 = function (moduleName, containingFile, redirectedReference, containingFileMode) { return ts.resolveTypeReferenceDirective(moduleName, containingFile, state.projectCompilerOptions, compilerHost, redirectedReference, state.typeReferenceDirectiveResolutionCache, containingFileMode).resolvedTypeReferenceDirective; };
|
|
101060
|
+
compilerHost.resolveTypeReferenceDirectives = function (typeReferenceDirectiveNames, containingFile, redirectedReference, _options, containingFileMode) {
|
|
101061
|
+
return ts.loadWithTypeDirectiveCache(ts.Debug.checkEachDefined(typeReferenceDirectiveNames), containingFile, redirectedReference, containingFileMode, loader_4);
|
|
100992
101062
|
};
|
|
100993
101063
|
}
|
|
100994
101064
|
var _a = ts.createWatchFactory(hostWithWatch, options), watchFile = _a.watchFile, watchDirectory = _a.watchDirectory, writeLog = _a.writeLog;
|