@typescript-deploys/pr-build 4.7.0-pr-47898-11 → 4.7.0-pr-47904-2
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.esnext.intl.d.ts +4 -1
- package/lib/protocol.d.ts +7 -0
- package/lib/tsc.js +364 -306
- package/lib/tsserver.js +452 -386
- package/lib/tsserverlibrary.d.ts +24 -18
- package/lib/tsserverlibrary.js +452 -386
- package/lib/typescript.d.ts +16 -17
- package/lib/typescript.js +450 -384
- package/lib/typescriptServices.d.ts +16 -17
- package/lib/typescriptServices.js +450 -384
- package/lib/typingsInstaller.js +447 -381
- package/package.json +1 -1
package/lib/tsc.js
CHANGED
|
@@ -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;
|
|
@@ -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();
|
|
@@ -30625,6 +30642,19 @@ var ts;
|
|
|
30625
30642
|
return ts.fileExtensionIsOneOf(fileName, [".d.ts", ".d.mts", ".d.cts"]);
|
|
30626
30643
|
}
|
|
30627
30644
|
ts.isDeclarationFileName = isDeclarationFileName;
|
|
30645
|
+
function parseResolutionMode(mode, pos, end, reportDiagnostic) {
|
|
30646
|
+
if (!mode) {
|
|
30647
|
+
return undefined;
|
|
30648
|
+
}
|
|
30649
|
+
if (mode === "import") {
|
|
30650
|
+
return ts.ModuleKind.ESNext;
|
|
30651
|
+
}
|
|
30652
|
+
if (mode === "require") {
|
|
30653
|
+
return ts.ModuleKind.CommonJS;
|
|
30654
|
+
}
|
|
30655
|
+
reportDiagnostic(pos, end - pos, ts.Diagnostics.resolution_mode_should_be_either_require_or_import);
|
|
30656
|
+
return undefined;
|
|
30657
|
+
}
|
|
30628
30658
|
function processCommentPragmas(context, sourceText) {
|
|
30629
30659
|
var pragmas = [];
|
|
30630
30660
|
for (var _i = 0, _a = ts.getLeadingCommentRanges(sourceText, 0) || ts.emptyArray; _i < _a.length; _i++) {
|
|
@@ -30663,12 +30693,13 @@ var ts;
|
|
|
30663
30693
|
var typeReferenceDirectives_1 = context.typeReferenceDirectives;
|
|
30664
30694
|
var libReferenceDirectives_1 = context.libReferenceDirectives;
|
|
30665
30695
|
ts.forEach(ts.toArray(entryOrList), function (arg) {
|
|
30666
|
-
var _a = arg.arguments, types = _a.types, lib = _a.lib, path = _a.path;
|
|
30696
|
+
var _a = arg.arguments, types = _a.types, lib = _a.lib, path = _a.path, res = _a["resolution-mode"];
|
|
30667
30697
|
if (arg.arguments["no-default-lib"]) {
|
|
30668
30698
|
context.hasNoDefaultLib = true;
|
|
30669
30699
|
}
|
|
30670
30700
|
else if (types) {
|
|
30671
|
-
|
|
30701
|
+
var parsed = parseResolutionMode(res, types.pos, types.end, reportDiagnostic);
|
|
30702
|
+
typeReferenceDirectives_1.push(__assign({ pos: types.pos, end: types.end, fileName: types.value }, (parsed ? { resolutionMode: parsed } : {})));
|
|
30672
30703
|
}
|
|
30673
30704
|
else if (lib) {
|
|
30674
30705
|
libReferenceDirectives_1.push({ pos: lib.pos, end: lib.end, fileName: lib.value });
|
|
@@ -33911,14 +33942,14 @@ var ts;
|
|
|
33911
33942
|
var useCaseSensitiveFileNames = typeof host.useCaseSensitiveFileNames === "function" ? host.useCaseSensitiveFileNames() : host.useCaseSensitiveFileNames;
|
|
33912
33943
|
return ts.comparePaths(path1, path2, !useCaseSensitiveFileNames) === 0;
|
|
33913
33944
|
}
|
|
33914
|
-
function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFile, options, host, redirectedReference, cache) {
|
|
33945
|
+
function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFile, options, host, redirectedReference, cache, resolutionMode) {
|
|
33915
33946
|
var traceEnabled = isTraceEnabled(options, host);
|
|
33916
33947
|
if (redirectedReference) {
|
|
33917
33948
|
options = redirectedReference.commandLine.options;
|
|
33918
33949
|
}
|
|
33919
33950
|
var containingDirectory = containingFile ? ts.getDirectoryPath(containingFile) : undefined;
|
|
33920
33951
|
var perFolderCache = containingDirectory ? cache && cache.getOrCreateCacheForDirectory(containingDirectory, redirectedReference) : undefined;
|
|
33921
|
-
var result = perFolderCache && perFolderCache.get(typeReferenceDirectiveName,
|
|
33952
|
+
var result = perFolderCache && perFolderCache.get(typeReferenceDirectiveName, resolutionMode);
|
|
33922
33953
|
if (result) {
|
|
33923
33954
|
if (traceEnabled) {
|
|
33924
33955
|
trace(host, ts.Diagnostics.Resolving_type_reference_directive_0_containing_file_1, typeReferenceDirectiveName, containingFile);
|
|
@@ -33953,7 +33984,11 @@ var ts;
|
|
|
33953
33984
|
}
|
|
33954
33985
|
var failedLookupLocations = [];
|
|
33955
33986
|
var features = getDefaultNodeResolutionFeatures(options);
|
|
33956
|
-
|
|
33987
|
+
if (resolutionMode === ts.ModuleKind.ESNext && (ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.Node12 || ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.NodeNext)) {
|
|
33988
|
+
features |= NodeResolutionFeatures.EsmMode;
|
|
33989
|
+
}
|
|
33990
|
+
var conditions = features & NodeResolutionFeatures.Exports ? features & NodeResolutionFeatures.EsmMode ? ["node", "import", "types"] : ["node", "require", "types"] : [];
|
|
33991
|
+
var moduleResolutionState = { compilerOptions: options, host: host, traceEnabled: traceEnabled, failedLookupLocations: failedLookupLocations, packageJsonInfoCache: cache, features: features, conditions: conditions };
|
|
33957
33992
|
var resolved = primaryLookup();
|
|
33958
33993
|
var primary = true;
|
|
33959
33994
|
if (!resolved) {
|
|
@@ -33973,7 +34008,7 @@ var ts;
|
|
|
33973
34008
|
};
|
|
33974
34009
|
}
|
|
33975
34010
|
result = { resolvedTypeReferenceDirective: resolvedTypeReferenceDirective, failedLookupLocations: failedLookupLocations };
|
|
33976
|
-
perFolderCache === null || perFolderCache === void 0 ? void 0 : perFolderCache.set(typeReferenceDirectiveName,
|
|
34011
|
+
perFolderCache === null || perFolderCache === void 0 ? void 0 : perFolderCache.set(typeReferenceDirectiveName, resolutionMode, result);
|
|
33977
34012
|
if (traceEnabled)
|
|
33978
34013
|
traceResult(result);
|
|
33979
34014
|
return result;
|
|
@@ -34232,7 +34267,10 @@ var ts;
|
|
|
34232
34267
|
ts.Debug.assert(keys.length === values.length);
|
|
34233
34268
|
var map = createModeAwareCache();
|
|
34234
34269
|
for (var i = 0; i < keys.length; ++i) {
|
|
34235
|
-
|
|
34270
|
+
var entry = keys[i];
|
|
34271
|
+
var name = !ts.isString(entry) ? entry.fileName.toLowerCase() : entry;
|
|
34272
|
+
var mode = !ts.isString(entry) ? entry.resolutionMode || file.impliedNodeFormat : ts.getModeForResolutionAtIndex(file, i);
|
|
34273
|
+
map.set(name, mode, values[i]);
|
|
34236
34274
|
}
|
|
34237
34275
|
return map;
|
|
34238
34276
|
}
|
|
@@ -37691,12 +37729,14 @@ var ts;
|
|
|
37691
37729
|
}
|
|
37692
37730
|
}
|
|
37693
37731
|
function setCommonJsModuleIndicator(node) {
|
|
37694
|
-
if (file.externalModuleIndicator) {
|
|
37732
|
+
if (file.externalModuleIndicator && file.commonJsModuleIndicator) {
|
|
37695
37733
|
return false;
|
|
37696
37734
|
}
|
|
37697
|
-
if (
|
|
37735
|
+
if (file.commonJsModuleIndicator === undefined) {
|
|
37698
37736
|
file.commonJsModuleIndicator = node;
|
|
37699
|
-
|
|
37737
|
+
if (file.externalModuleIndicator === undefined) {
|
|
37738
|
+
bindSourceFileAsExternalModule();
|
|
37739
|
+
}
|
|
37700
37740
|
}
|
|
37701
37741
|
return true;
|
|
37702
37742
|
}
|
|
@@ -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;
|
|
@@ -51862,10 +51903,7 @@ var ts;
|
|
|
51862
51903
|
case 204:
|
|
51863
51904
|
return ts.some(node.properties, isContextSensitive);
|
|
51864
51905
|
case 203:
|
|
51865
|
-
|
|
51866
|
-
return ts.some(node.elements, isContextSensitive);
|
|
51867
|
-
}
|
|
51868
|
-
return true;
|
|
51906
|
+
return ts.some(node.elements, isContextSensitive);
|
|
51869
51907
|
case 221:
|
|
51870
51908
|
return isContextSensitive(node.whenTrue) ||
|
|
51871
51909
|
isContextSensitive(node.whenFalse);
|
|
@@ -52687,11 +52725,11 @@ var ts;
|
|
|
52687
52725
|
var overflow = false;
|
|
52688
52726
|
var overrideNextErrorInfo = 0;
|
|
52689
52727
|
var lastSkippedInfo;
|
|
52690
|
-
var incompatibleStack
|
|
52728
|
+
var incompatibleStack;
|
|
52691
52729
|
var inPropertyCheck = false;
|
|
52692
52730
|
ts.Debug.assert(relation !== identityRelation || !errorNode, "no error reporting in identity checking");
|
|
52693
52731
|
var result = isRelatedTo(source, target, 3, !!errorNode, headMessage);
|
|
52694
|
-
if (incompatibleStack
|
|
52732
|
+
if (incompatibleStack) {
|
|
52695
52733
|
reportIncompatibleStack();
|
|
52696
52734
|
}
|
|
52697
52735
|
if (overflow) {
|
|
@@ -52746,19 +52784,19 @@ var ts;
|
|
|
52746
52784
|
return {
|
|
52747
52785
|
errorInfo: errorInfo,
|
|
52748
52786
|
lastSkippedInfo: lastSkippedInfo,
|
|
52749
|
-
incompatibleStack: incompatibleStack.slice(),
|
|
52787
|
+
incompatibleStack: incompatibleStack === null || incompatibleStack === void 0 ? void 0 : incompatibleStack.slice(),
|
|
52750
52788
|
overrideNextErrorInfo: overrideNextErrorInfo,
|
|
52751
|
-
relatedInfo:
|
|
52789
|
+
relatedInfo: relatedInfo === null || relatedInfo === void 0 ? void 0 : relatedInfo.slice(),
|
|
52752
52790
|
};
|
|
52753
52791
|
}
|
|
52754
52792
|
function reportIncompatibleError(message, arg0, arg1, arg2, arg3) {
|
|
52755
52793
|
overrideNextErrorInfo++;
|
|
52756
52794
|
lastSkippedInfo = undefined;
|
|
52757
|
-
incompatibleStack.push([message, arg0, arg1, arg2, arg3]);
|
|
52795
|
+
(incompatibleStack || (incompatibleStack = [])).push([message, arg0, arg1, arg2, arg3]);
|
|
52758
52796
|
}
|
|
52759
52797
|
function reportIncompatibleStack() {
|
|
52760
|
-
var stack = incompatibleStack;
|
|
52761
|
-
incompatibleStack =
|
|
52798
|
+
var stack = incompatibleStack || [];
|
|
52799
|
+
incompatibleStack = undefined;
|
|
52762
52800
|
var info = lastSkippedInfo;
|
|
52763
52801
|
lastSkippedInfo = undefined;
|
|
52764
52802
|
if (stack.length === 1) {
|
|
@@ -52852,7 +52890,7 @@ var ts;
|
|
|
52852
52890
|
}
|
|
52853
52891
|
function reportError(message, arg0, arg1, arg2, arg3) {
|
|
52854
52892
|
ts.Debug.assert(!!errorNode);
|
|
52855
|
-
if (incompatibleStack
|
|
52893
|
+
if (incompatibleStack)
|
|
52856
52894
|
reportIncompatibleStack();
|
|
52857
52895
|
if (message.elidedInCompatabilityPyramid)
|
|
52858
52896
|
return;
|
|
@@ -52868,7 +52906,7 @@ var ts;
|
|
|
52868
52906
|
}
|
|
52869
52907
|
}
|
|
52870
52908
|
function reportRelationError(message, source, target) {
|
|
52871
|
-
if (incompatibleStack
|
|
52909
|
+
if (incompatibleStack)
|
|
52872
52910
|
reportIncompatibleStack();
|
|
52873
52911
|
var _a = getTypeNamesForErrorDisplay(source, target), sourceType = _a[0], targetType = _a[1];
|
|
52874
52912
|
var generalizedSource = source;
|
|
@@ -52959,7 +52997,9 @@ var ts;
|
|
|
52959
52997
|
if (isSimpleTypeRelatedTo(originalSource, originalTarget, relation, reportErrors ? reportError : undefined)) {
|
|
52960
52998
|
return -1;
|
|
52961
52999
|
}
|
|
52962
|
-
|
|
53000
|
+
if (reportErrors) {
|
|
53001
|
+
reportErrorResults(originalSource, originalTarget, originalSource, originalTarget, headMessage);
|
|
53002
|
+
}
|
|
52963
53003
|
return 0;
|
|
52964
53004
|
}
|
|
52965
53005
|
var source = getNormalizedType(originalSource, false);
|
|
@@ -52967,127 +53007,121 @@ var ts;
|
|
|
52967
53007
|
if (source === target)
|
|
52968
53008
|
return -1;
|
|
52969
53009
|
if (relation === identityRelation) {
|
|
52970
|
-
|
|
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);
|
|
52971
53016
|
}
|
|
52972
53017
|
if (source.flags & 262144 && getConstraintOfType(source) === target) {
|
|
52973
53018
|
return -1;
|
|
52974
53019
|
}
|
|
52975
|
-
if (
|
|
52976
|
-
|
|
52977
|
-
var
|
|
52978
|
-
|
|
52979
|
-
|
|
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;
|
|
52980
53029
|
}
|
|
52981
|
-
if (source === nullStrippedTarget)
|
|
52982
|
-
return -1;
|
|
52983
53030
|
}
|
|
52984
53031
|
if (relation === comparableRelation && !(target.flags & 131072) && isSimpleTypeRelatedTo(target, source, relation) ||
|
|
52985
53032
|
isSimpleTypeRelatedTo(source, target, relation, reportErrors ? reportError : undefined))
|
|
52986
53033
|
return -1;
|
|
52987
|
-
|
|
52988
|
-
|
|
52989
|
-
|
|
52990
|
-
|
|
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)) {
|
|
52991
53050
|
if (reportErrors) {
|
|
52992
|
-
|
|
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
|
+
}
|
|
52993
53062
|
}
|
|
52994
53063
|
return 0;
|
|
52995
53064
|
}
|
|
52996
|
-
|
|
52997
|
-
|
|
52998
|
-
|
|
52999
|
-
|
|
53000
|
-
|
|
53001
|
-
|
|
53002
|
-
if (
|
|
53003
|
-
|
|
53004
|
-
|
|
53005
|
-
|
|
53006
|
-
|
|
53007
|
-
if (calls.length > 0 && isRelatedTo(getReturnTypeOfSignature(calls[0]), target, 1, false) ||
|
|
53008
|
-
constructs.length > 0 && isRelatedTo(getReturnTypeOfSignature(constructs[0]), target, 1, false)) {
|
|
53009
|
-
reportError(ts.Diagnostics.Value_of_type_0_has_no_properties_in_common_with_type_1_Did_you_mean_to_call_it, sourceString, targetString);
|
|
53010
|
-
}
|
|
53011
|
-
else {
|
|
53012
|
-
reportError(ts.Diagnostics.Type_0_has_no_properties_in_common_with_type_1, sourceString, targetString);
|
|
53013
|
-
}
|
|
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;
|
|
53014
53076
|
}
|
|
53015
|
-
|
|
53016
|
-
|
|
53017
|
-
traceUnionsOrIntersectionsTooLarge(source, target);
|
|
53018
|
-
var result = 0;
|
|
53019
|
-
var saveErrorInfo = captureErrorCalculationState();
|
|
53020
|
-
if ((source.flags & 1048576 || target.flags & 1048576) && getConstituentCount(source) * getConstituentCount(target) < 4) {
|
|
53021
|
-
result = structuredTypeRelatedTo(source, target, reportErrors, intersectionState | 8);
|
|
53022
|
-
}
|
|
53023
|
-
else if (source.flags & 3145728 || target.flags & 3145728) {
|
|
53024
|
-
result = recursiveTypeRelatedTo(source, target, reportErrors, intersectionState | 8, recursionFlags);
|
|
53025
|
-
}
|
|
53026
|
-
if (!result && !(source.flags & 1048576) && (source.flags & (469499904) || target.flags & 469499904)) {
|
|
53027
|
-
if (result = recursiveTypeRelatedTo(source, target, reportErrors, intersectionState, recursionFlags)) {
|
|
53028
|
-
resetErrorInfo(saveErrorInfo);
|
|
53077
|
+
if (result_7) {
|
|
53078
|
+
return result_7;
|
|
53029
53079
|
}
|
|
53030
53080
|
}
|
|
53031
|
-
if (
|
|
53032
|
-
|
|
53033
|
-
|
|
53034
|
-
|
|
53035
|
-
|
|
53036
|
-
|
|
53037
|
-
|
|
53038
|
-
|
|
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;
|
|
53039
53115
|
}
|
|
53040
53116
|
}
|
|
53041
|
-
|
|
53042
|
-
|
|
53043
|
-
inPropertyCheck = true;
|
|
53044
|
-
result &= recursiveTypeRelatedTo(source, target, reportErrors, 4, recursionFlags);
|
|
53045
|
-
inPropertyCheck = false;
|
|
53117
|
+
else {
|
|
53118
|
+
errorInfo = elaborateNeverIntersection(errorInfo, originalTarget);
|
|
53046
53119
|
}
|
|
53047
|
-
|
|
53048
|
-
|
|
53049
|
-
|
|
53050
|
-
if (!result && reportErrors) {
|
|
53051
|
-
var sourceHasBase = !!getSingleBaseForNonAugmentingSubtype(originalSource);
|
|
53052
|
-
var targetHasBase = !!getSingleBaseForNonAugmentingSubtype(originalTarget);
|
|
53053
|
-
source = (originalSource.aliasSymbol || sourceHasBase) ? originalSource : source;
|
|
53054
|
-
target = (originalTarget.aliasSymbol || targetHasBase) ? originalTarget : target;
|
|
53055
|
-
var maybeSuppress = overrideNextErrorInfo > 0;
|
|
53056
|
-
if (maybeSuppress) {
|
|
53057
|
-
overrideNextErrorInfo--;
|
|
53058
|
-
}
|
|
53059
|
-
if (source.flags & 524288 && target.flags & 524288) {
|
|
53060
|
-
var currentError = errorInfo;
|
|
53061
|
-
tryElaborateArrayLikeErrors(source, target, reportErrors);
|
|
53062
|
-
if (errorInfo !== currentError) {
|
|
53063
|
-
maybeSuppress = !!errorInfo;
|
|
53064
|
-
}
|
|
53065
|
-
}
|
|
53066
|
-
if (source.flags & 524288 && target.flags & 131068) {
|
|
53067
|
-
tryElaborateErrorsForPrimitivesAndObjects(source, target);
|
|
53068
|
-
}
|
|
53069
|
-
else if (source.symbol && source.flags & 524288 && globalObjectType === source) {
|
|
53070
|
-
reportError(ts.Diagnostics.The_Object_type_is_assignable_to_very_few_other_types_Did_you_mean_to_use_the_any_type_instead);
|
|
53071
|
-
}
|
|
53072
|
-
else if (isComparingJsxAttributes && target.flags & 2097152) {
|
|
53073
|
-
var targetTypes = target.types;
|
|
53074
|
-
var intrinsicAttributes = getJsxType(JsxNames.IntrinsicAttributes, errorNode);
|
|
53075
|
-
var intrinsicClassAttributes = getJsxType(JsxNames.IntrinsicClassAttributes, errorNode);
|
|
53076
|
-
if (!isErrorType(intrinsicAttributes) && !isErrorType(intrinsicClassAttributes) &&
|
|
53077
|
-
(ts.contains(targetTypes, intrinsicAttributes) || ts.contains(targetTypes, intrinsicClassAttributes))) {
|
|
53078
|
-
return result;
|
|
53079
|
-
}
|
|
53080
|
-
}
|
|
53081
|
-
else {
|
|
53082
|
-
errorInfo = elaborateNeverIntersection(errorInfo, originalTarget);
|
|
53083
|
-
}
|
|
53084
|
-
if (!headMessage && maybeSuppress) {
|
|
53085
|
-
lastSkippedInfo = [source, target];
|
|
53086
|
-
return result;
|
|
53087
|
-
}
|
|
53088
|
-
reportRelationError(headMessage, source, target);
|
|
53089
|
-
}
|
|
53120
|
+
if (!headMessage && maybeSuppress) {
|
|
53121
|
+
lastSkippedInfo = [source, target];
|
|
53122
|
+
return;
|
|
53090
53123
|
}
|
|
53124
|
+
reportRelationError(headMessage, source, target);
|
|
53091
53125
|
}
|
|
53092
53126
|
function traceUnionsOrIntersectionsTooLarge(source, target) {
|
|
53093
53127
|
if (!ts.tracing) {
|
|
@@ -53113,21 +53147,6 @@ var ts;
|
|
|
53113
53147
|
}
|
|
53114
53148
|
}
|
|
53115
53149
|
}
|
|
53116
|
-
function isIdenticalTo(source, target, recursionFlags) {
|
|
53117
|
-
if (source.flags !== target.flags)
|
|
53118
|
-
return 0;
|
|
53119
|
-
if (source.flags & 67358815)
|
|
53120
|
-
return -1;
|
|
53121
|
-
traceUnionsOrIntersectionsTooLarge(source, target);
|
|
53122
|
-
if (source.flags & 3145728) {
|
|
53123
|
-
var result_7 = eachTypeRelatedToSomeType(source, target);
|
|
53124
|
-
if (result_7) {
|
|
53125
|
-
result_7 &= eachTypeRelatedToSomeType(target, source);
|
|
53126
|
-
}
|
|
53127
|
-
return result_7;
|
|
53128
|
-
}
|
|
53129
|
-
return recursiveTypeRelatedTo(source, target, false, 0, recursionFlags);
|
|
53130
|
-
}
|
|
53131
53150
|
function getTypeOfPropertyInTypes(types, name) {
|
|
53132
53151
|
var appendPropType = function (propTypes, type) {
|
|
53133
53152
|
var _a;
|
|
@@ -53216,6 +53235,29 @@ var ts;
|
|
|
53216
53235
|
function shouldCheckAsExcessProperty(prop, container) {
|
|
53217
53236
|
return prop.valueDeclaration && container.valueDeclaration && prop.valueDeclaration.parent === container.valueDeclaration;
|
|
53218
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
|
+
}
|
|
53219
53261
|
function eachTypeRelatedToSomeType(source, target) {
|
|
53220
53262
|
var result = -1;
|
|
53221
53263
|
var sourceTypes = source.types;
|
|
@@ -53252,7 +53294,9 @@ var ts;
|
|
|
53252
53294
|
}
|
|
53253
53295
|
if (reportErrors) {
|
|
53254
53296
|
var bestMatchingType = getBestMatchingType(source, target, isRelatedTo);
|
|
53255
|
-
|
|
53297
|
+
if (bestMatchingType) {
|
|
53298
|
+
isRelatedTo(source, bestMatchingType, 2, true);
|
|
53299
|
+
}
|
|
53256
53300
|
}
|
|
53257
53301
|
return 0;
|
|
53258
53302
|
}
|
|
@@ -53360,7 +53404,7 @@ var ts;
|
|
|
53360
53404
|
if (overflow) {
|
|
53361
53405
|
return 0;
|
|
53362
53406
|
}
|
|
53363
|
-
var keyIntersectionState = intersectionState | (inPropertyCheck ?
|
|
53407
|
+
var keyIntersectionState = intersectionState | (inPropertyCheck ? 8 : 0);
|
|
53364
53408
|
var id = getRelationKey(source, target, keyIntersectionState, relation, false);
|
|
53365
53409
|
var entry = relation.get(id);
|
|
53366
53410
|
if (entry !== undefined) {
|
|
@@ -53421,6 +53465,7 @@ var ts;
|
|
|
53421
53465
|
return originalHandler(onlyUnreliable);
|
|
53422
53466
|
};
|
|
53423
53467
|
}
|
|
53468
|
+
var result;
|
|
53424
53469
|
if (expandingFlags === 3) {
|
|
53425
53470
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.instant("checkTypes", "recursiveTypeRelatedTo_DepthLimit", {
|
|
53426
53471
|
sourceId: source.id,
|
|
@@ -53430,8 +53475,13 @@ var ts;
|
|
|
53430
53475
|
depth: sourceDepth,
|
|
53431
53476
|
targetDepth: targetDepth
|
|
53432
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();
|
|
53433
53484
|
}
|
|
53434
|
-
var result = expandingFlags !== 3 ? structuredTypeRelatedTo(source, target, reportErrors, intersectionState) : 3;
|
|
53435
53485
|
if (outofbandVarianceMarkerHandler) {
|
|
53436
53486
|
outofbandVarianceMarkerHandler = originalHandler;
|
|
53437
53487
|
}
|
|
@@ -53459,74 +53509,73 @@ var ts;
|
|
|
53459
53509
|
return result;
|
|
53460
53510
|
}
|
|
53461
53511
|
function structuredTypeRelatedTo(source, target, reportErrors, intersectionState) {
|
|
53462
|
-
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("checkTypes", "structuredTypeRelatedTo", { sourceId: source.id, targetId: target.id });
|
|
53463
|
-
var result = structuredTypeRelatedToWorker(source, target, reportErrors, intersectionState);
|
|
53464
|
-
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
53465
|
-
return result;
|
|
53466
|
-
}
|
|
53467
|
-
function structuredTypeRelatedToWorker(source, target, reportErrors, intersectionState) {
|
|
53468
53512
|
if (intersectionState & 4) {
|
|
53469
53513
|
return propertiesRelatedTo(source, target, reportErrors, undefined, 0);
|
|
53470
53514
|
}
|
|
53471
|
-
|
|
53472
|
-
|
|
53473
|
-
|
|
53474
|
-
|
|
53475
|
-
|
|
53476
|
-
|
|
53477
|
-
|
|
53478
|
-
|
|
53479
|
-
|
|
53480
|
-
|
|
53481
|
-
|
|
53482
|
-
}
|
|
53483
|
-
if (relation === comparableRelation && target.flags & 131068) {
|
|
53484
|
-
var constraints = ts.sameMap(source.types, getBaseConstraintOrType);
|
|
53485
|
-
if (constraints !== source.types) {
|
|
53486
|
-
source = getIntersectionType(constraints);
|
|
53487
|
-
if (!(source.flags & 2097152)) {
|
|
53488
|
-
return isRelatedTo(source, target, 1, false);
|
|
53489
|
-
}
|
|
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);
|
|
53490
53526
|
}
|
|
53527
|
+
return result_8;
|
|
53491
53528
|
}
|
|
53492
|
-
|
|
53493
|
-
}
|
|
53494
|
-
var flags = source.flags & target.flags;
|
|
53495
|
-
if (relation === identityRelation && !(flags & 524288)) {
|
|
53496
|
-
if (flags & 4194304) {
|
|
53529
|
+
if (sourceFlags & 4194304) {
|
|
53497
53530
|
return isRelatedTo(source.type, target.type, 3, false);
|
|
53498
53531
|
}
|
|
53499
|
-
|
|
53500
|
-
|
|
53501
|
-
|
|
53502
|
-
|
|
53503
|
-
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;
|
|
53504
53536
|
}
|
|
53505
53537
|
}
|
|
53506
53538
|
}
|
|
53507
|
-
if (
|
|
53539
|
+
if (sourceFlags & 16777216) {
|
|
53508
53540
|
if (source.root.isDistributive === target.root.isDistributive) {
|
|
53509
|
-
if (
|
|
53510
|
-
if (
|
|
53511
|
-
if (
|
|
53512
|
-
if (
|
|
53513
|
-
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;
|
|
53514
53546
|
}
|
|
53515
53547
|
}
|
|
53516
53548
|
}
|
|
53517
53549
|
}
|
|
53518
53550
|
}
|
|
53519
53551
|
}
|
|
53520
|
-
if (
|
|
53552
|
+
if (sourceFlags & 33554432) {
|
|
53521
53553
|
return isRelatedTo(source.substitute, target.substitute, 3, false);
|
|
53522
53554
|
}
|
|
53523
|
-
|
|
53555
|
+
if (!(sourceFlags & 524288)) {
|
|
53556
|
+
return 0;
|
|
53557
|
+
}
|
|
53524
53558
|
}
|
|
53525
|
-
|
|
53526
|
-
|
|
53527
|
-
|
|
53528
|
-
|
|
53529
|
-
|
|
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 &&
|
|
53530
53579
|
source.aliasTypeArguments && source.aliasSymbol === target.aliasSymbol &&
|
|
53531
53580
|
!(source.aliasTypeArgumentsContainsMarker || target.aliasTypeArgumentsContainsMarker)) {
|
|
53532
53581
|
var variances = getAliasVariances(source.aliasSymbol);
|
|
@@ -53542,7 +53591,7 @@ var ts;
|
|
|
53542
53591
|
isSingleElementGenericTupleType(target) && (target.target.readonly || isMutableArrayOrTuple(getBaseConstraintOfType(source) || source)) && (result = isRelatedTo(source, getTypeArguments(target)[0], 2))) {
|
|
53543
53592
|
return result;
|
|
53544
53593
|
}
|
|
53545
|
-
if (
|
|
53594
|
+
if (targetFlags & 262144) {
|
|
53546
53595
|
if (ts.getObjectFlags(source) & 32 && !source.declaration.nameType && isRelatedTo(getIndexType(target), getConstraintTypeFromMappedType(source), 3)) {
|
|
53547
53596
|
if (!(getMappedTypeModifiers(source) & 4)) {
|
|
53548
53597
|
var templateType = getTemplateTypeFromMappedType(source);
|
|
@@ -53553,9 +53602,9 @@ var ts;
|
|
|
53553
53602
|
}
|
|
53554
53603
|
}
|
|
53555
53604
|
}
|
|
53556
|
-
else if (
|
|
53605
|
+
else if (targetFlags & 4194304) {
|
|
53557
53606
|
var targetType_1 = target.type;
|
|
53558
|
-
if (
|
|
53607
|
+
if (sourceFlags & 4194304) {
|
|
53559
53608
|
if (result = isRelatedTo(targetType_1, source.type, 3, false)) {
|
|
53560
53609
|
return result;
|
|
53561
53610
|
}
|
|
@@ -53591,8 +53640,8 @@ var ts;
|
|
|
53591
53640
|
}
|
|
53592
53641
|
}
|
|
53593
53642
|
}
|
|
53594
|
-
else if (
|
|
53595
|
-
if (
|
|
53643
|
+
else if (targetFlags & 8388608) {
|
|
53644
|
+
if (sourceFlags & 8388608) {
|
|
53596
53645
|
if (result = isRelatedTo(source.objectType, target.objectType, 3, reportErrors)) {
|
|
53597
53646
|
result &= isRelatedTo(source.indexType, target.indexType, 3, reportErrors);
|
|
53598
53647
|
}
|
|
@@ -53671,7 +53720,7 @@ var ts;
|
|
|
53671
53720
|
}
|
|
53672
53721
|
}
|
|
53673
53722
|
}
|
|
53674
|
-
else if (
|
|
53723
|
+
else if (targetFlags & 16777216) {
|
|
53675
53724
|
if (isDeeplyNestedType(target, targetStack, targetDepth, 10)) {
|
|
53676
53725
|
resetErrorInfo(saveErrorInfo);
|
|
53677
53726
|
return 3;
|
|
@@ -53689,8 +53738,8 @@ var ts;
|
|
|
53689
53738
|
}
|
|
53690
53739
|
}
|
|
53691
53740
|
}
|
|
53692
|
-
else if (
|
|
53693
|
-
if (
|
|
53741
|
+
else if (targetFlags & 134217728) {
|
|
53742
|
+
if (sourceFlags & 134217728) {
|
|
53694
53743
|
if (relation === comparableRelation) {
|
|
53695
53744
|
return templateLiteralTypesDefinitelyUnrelated(source, target) ? 0 : -1;
|
|
53696
53745
|
}
|
|
@@ -53700,10 +53749,10 @@ var ts;
|
|
|
53700
53749
|
return -1;
|
|
53701
53750
|
}
|
|
53702
53751
|
}
|
|
53703
|
-
if (
|
|
53704
|
-
if (!(
|
|
53752
|
+
if (sourceFlags & 8650752) {
|
|
53753
|
+
if (!(sourceFlags & 8388608 && targetFlags & 8388608)) {
|
|
53705
53754
|
var constraint = getConstraintOfType(source);
|
|
53706
|
-
if (!constraint || (
|
|
53755
|
+
if (!constraint || (sourceFlags & 262144 && constraint.flags & 1)) {
|
|
53707
53756
|
if (result = isRelatedTo(emptyObjectType, extractTypesOfKind(target, ~67108864), 3)) {
|
|
53708
53757
|
resetErrorInfo(saveErrorInfo);
|
|
53709
53758
|
return result;
|
|
@@ -53713,7 +53762,7 @@ var ts;
|
|
|
53713
53762
|
resetErrorInfo(saveErrorInfo);
|
|
53714
53763
|
return result;
|
|
53715
53764
|
}
|
|
53716
|
-
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)) {
|
|
53717
53766
|
resetErrorInfo(saveErrorInfo);
|
|
53718
53767
|
return result;
|
|
53719
53768
|
}
|
|
@@ -53728,14 +53777,14 @@ var ts;
|
|
|
53728
53777
|
}
|
|
53729
53778
|
}
|
|
53730
53779
|
}
|
|
53731
|
-
else if (
|
|
53780
|
+
else if (sourceFlags & 4194304) {
|
|
53732
53781
|
if (result = isRelatedTo(keyofConstraintType, target, 1, reportErrors)) {
|
|
53733
53782
|
resetErrorInfo(saveErrorInfo);
|
|
53734
53783
|
return result;
|
|
53735
53784
|
}
|
|
53736
53785
|
}
|
|
53737
|
-
else if (
|
|
53738
|
-
if (!(
|
|
53786
|
+
else if (sourceFlags & 134217728 && !(targetFlags & 524288)) {
|
|
53787
|
+
if (!(targetFlags & 134217728)) {
|
|
53739
53788
|
var constraint = getBaseConstraintOfType(source);
|
|
53740
53789
|
if (constraint && constraint !== source && (result = isRelatedTo(constraint, target, 1, reportErrors))) {
|
|
53741
53790
|
resetErrorInfo(saveErrorInfo);
|
|
@@ -53743,8 +53792,8 @@ var ts;
|
|
|
53743
53792
|
}
|
|
53744
53793
|
}
|
|
53745
53794
|
}
|
|
53746
|
-
else if (
|
|
53747
|
-
if (
|
|
53795
|
+
else if (sourceFlags & 268435456) {
|
|
53796
|
+
if (targetFlags & 268435456 && source.symbol === target.symbol) {
|
|
53748
53797
|
if (result = isRelatedTo(source.type, target.type, 3, reportErrors)) {
|
|
53749
53798
|
resetErrorInfo(saveErrorInfo);
|
|
53750
53799
|
return result;
|
|
@@ -53758,12 +53807,12 @@ var ts;
|
|
|
53758
53807
|
}
|
|
53759
53808
|
}
|
|
53760
53809
|
}
|
|
53761
|
-
else if (
|
|
53810
|
+
else if (sourceFlags & 16777216) {
|
|
53762
53811
|
if (isDeeplyNestedType(source, sourceStack, sourceDepth, 10)) {
|
|
53763
53812
|
resetErrorInfo(saveErrorInfo);
|
|
53764
53813
|
return 3;
|
|
53765
53814
|
}
|
|
53766
|
-
if (
|
|
53815
|
+
if (targetFlags & 16777216) {
|
|
53767
53816
|
var sourceParams = source.root.inferTypeParameters;
|
|
53768
53817
|
var sourceExtends = source.extendsType;
|
|
53769
53818
|
var mapper = void 0;
|
|
@@ -53814,9 +53863,10 @@ var ts;
|
|
|
53814
53863
|
}
|
|
53815
53864
|
return 0;
|
|
53816
53865
|
}
|
|
53817
|
-
var sourceIsPrimitive = !!(
|
|
53866
|
+
var sourceIsPrimitive = !!(sourceFlags & 131068);
|
|
53818
53867
|
if (relation !== identityRelation) {
|
|
53819
53868
|
source = getApparentType(source);
|
|
53869
|
+
sourceFlags = source.flags;
|
|
53820
53870
|
}
|
|
53821
53871
|
else if (isGenericMappedType(source)) {
|
|
53822
53872
|
return 0;
|
|
@@ -53846,7 +53896,7 @@ var ts;
|
|
|
53846
53896
|
else if ((relation === subtypeRelation || relation === strictSubtypeRelation) && isEmptyObjectType(target) && ts.getObjectFlags(target) & 16384 && !isEmptyObjectType(source)) {
|
|
53847
53897
|
return 0;
|
|
53848
53898
|
}
|
|
53849
|
-
if (
|
|
53899
|
+
if (sourceFlags & (524288 | 2097152) && targetFlags & 524288) {
|
|
53850
53900
|
var reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo.errorInfo && !sourceIsPrimitive;
|
|
53851
53901
|
result = propertiesRelatedTo(source, target, reportStructuralErrors, undefined, intersectionState);
|
|
53852
53902
|
if (result) {
|
|
@@ -53865,7 +53915,7 @@ var ts;
|
|
|
53865
53915
|
return result;
|
|
53866
53916
|
}
|
|
53867
53917
|
}
|
|
53868
|
-
if (
|
|
53918
|
+
if (sourceFlags & (524288 | 2097152) && targetFlags & 1048576) {
|
|
53869
53919
|
var objectOnlyTarget = extractTypesOfKind(target, 524288 | 2097152 | 33554432);
|
|
53870
53920
|
if (objectOnlyTarget.flags & 1048576) {
|
|
53871
53921
|
var result_9 = typeRelatedToDiscriminatedType(source, objectOnlyTarget);
|
|
@@ -54315,7 +54365,6 @@ var ts;
|
|
|
54315
54365
|
}
|
|
54316
54366
|
}
|
|
54317
54367
|
var result = -1;
|
|
54318
|
-
var saveErrorInfo = captureErrorCalculationState();
|
|
54319
54368
|
var incompatibleReporter = kind === 1 ? reportIncompatibleConstructSignatureReturn : reportIncompatibleCallSignatureReturn;
|
|
54320
54369
|
var sourceObjectFlags = ts.getObjectFlags(source);
|
|
54321
54370
|
var targetObjectFlags = ts.getObjectFlags(target);
|
|
@@ -54347,6 +54396,7 @@ var ts;
|
|
|
54347
54396
|
else {
|
|
54348
54397
|
outer: for (var _i = 0, targetSignatures_1 = targetSignatures; _i < targetSignatures_1.length; _i++) {
|
|
54349
54398
|
var t = targetSignatures_1[_i];
|
|
54399
|
+
var saveErrorInfo = captureErrorCalculationState();
|
|
54350
54400
|
var shouldElaborateErrors = reportErrors;
|
|
54351
54401
|
for (var _c = 0, sourceSignatures_1 = sourceSignatures; _c < sourceSignatures_1.length; _c++) {
|
|
54352
54402
|
var s = sourceSignatures_1[_c];
|
|
@@ -57135,9 +57185,6 @@ var ts;
|
|
|
57135
57185
|
getUnionType(ts.map(type.types, mapper), 1, aliasSymbol, aliasTypeArguments) :
|
|
57136
57186
|
mapType(type, mapper);
|
|
57137
57187
|
}
|
|
57138
|
-
function getConstituentCount(type) {
|
|
57139
|
-
return type.flags & 1048576 ? type.types.length : 1;
|
|
57140
|
-
}
|
|
57141
57188
|
function extractTypesOfKind(type, kind) {
|
|
57142
57189
|
return filterType(type, function (t) { return (t.flags & kind) !== 0; });
|
|
57143
57190
|
}
|
|
@@ -59971,12 +60018,6 @@ var ts;
|
|
|
59971
60018
|
var elementTypes = [];
|
|
59972
60019
|
var elementFlags = [];
|
|
59973
60020
|
var contextualType = getApparentTypeOfContextualType(node);
|
|
59974
|
-
if (elementCount === 0 && contextualType && !checkMode) {
|
|
59975
|
-
var elementType = getElementTypeOfArrayType(contextualType);
|
|
59976
|
-
if (elementType) {
|
|
59977
|
-
return createArrayType(elementType);
|
|
59978
|
-
}
|
|
59979
|
-
}
|
|
59980
60021
|
var inDestructuringPattern = ts.isAssignmentTarget(node);
|
|
59981
60022
|
var inConstContext = isConstContext(node);
|
|
59982
60023
|
var hasOmittedExpression = false;
|
|
@@ -63652,19 +63693,20 @@ var ts;
|
|
|
63652
63693
|
if (links.type === unknownType) {
|
|
63653
63694
|
links.type = getTypeFromBindingPattern(declaration.name);
|
|
63654
63695
|
}
|
|
63655
|
-
assignBindingElementTypes(declaration.name);
|
|
63696
|
+
assignBindingElementTypes(declaration.name, links.type);
|
|
63656
63697
|
}
|
|
63657
63698
|
}
|
|
63658
63699
|
}
|
|
63659
|
-
function assignBindingElementTypes(pattern) {
|
|
63700
|
+
function assignBindingElementTypes(pattern, parentType) {
|
|
63660
63701
|
for (var _i = 0, _a = pattern.elements; _i < _a.length; _i++) {
|
|
63661
63702
|
var element = _a[_i];
|
|
63662
63703
|
if (!ts.isOmittedExpression(element)) {
|
|
63704
|
+
var type = getBindingElementTypeFromParentType(element, parentType);
|
|
63663
63705
|
if (element.name.kind === 79) {
|
|
63664
|
-
getSymbolLinks(getSymbolOfNode(element)).type =
|
|
63706
|
+
getSymbolLinks(getSymbolOfNode(element)).type = type;
|
|
63665
63707
|
}
|
|
63666
63708
|
else {
|
|
63667
|
-
assignBindingElementTypes(element.name);
|
|
63709
|
+
assignBindingElementTypes(element.name, type);
|
|
63668
63710
|
}
|
|
63669
63711
|
}
|
|
63670
63712
|
}
|
|
@@ -66859,26 +66901,24 @@ var ts;
|
|
|
66859
66901
|
if (returnType.flags & 1) {
|
|
66860
66902
|
return;
|
|
66861
66903
|
}
|
|
66904
|
+
var headMessage;
|
|
66862
66905
|
var expectedReturnType;
|
|
66863
|
-
var headMessage = getDiagnosticHeadMessageForDecoratorResolution(node);
|
|
66864
|
-
var errorInfo;
|
|
66865
66906
|
switch (node.parent.kind) {
|
|
66866
66907
|
case 256:
|
|
66908
|
+
headMessage = ts.Diagnostics.Decorator_function_return_type_0_is_not_assignable_to_type_1;
|
|
66867
66909
|
var classSymbol = getSymbolOfNode(node.parent);
|
|
66868
66910
|
var classConstructorType = getTypeOfSymbol(classSymbol);
|
|
66869
66911
|
expectedReturnType = getUnionType([classConstructorType, voidType]);
|
|
66870
66912
|
break;
|
|
66871
|
-
case 163:
|
|
66872
|
-
expectedReturnType = voidType;
|
|
66873
|
-
errorInfo = ts.chainDiagnosticMessages(undefined, ts.Diagnostics.The_return_type_of_a_parameter_decorator_function_must_be_either_void_or_any);
|
|
66874
|
-
break;
|
|
66875
66913
|
case 166:
|
|
66914
|
+
case 163:
|
|
66915
|
+
headMessage = ts.Diagnostics.Decorator_function_return_type_is_0_but_is_expected_to_be_void_or_any;
|
|
66876
66916
|
expectedReturnType = voidType;
|
|
66877
|
-
errorInfo = ts.chainDiagnosticMessages(undefined, ts.Diagnostics.The_return_type_of_a_property_decorator_function_must_be_either_void_or_any);
|
|
66878
66917
|
break;
|
|
66879
66918
|
case 168:
|
|
66880
66919
|
case 171:
|
|
66881
66920
|
case 172:
|
|
66921
|
+
headMessage = ts.Diagnostics.Decorator_function_return_type_0_is_not_assignable_to_type_1;
|
|
66882
66922
|
var methodType = getTypeOfNode(node.parent);
|
|
66883
66923
|
var descriptorType = createTypedPropertyDescriptorType(methodType);
|
|
66884
66924
|
expectedReturnType = getUnionType([descriptorType, voidType]);
|
|
@@ -66886,7 +66926,7 @@ var ts;
|
|
|
66886
66926
|
default:
|
|
66887
66927
|
return ts.Debug.fail();
|
|
66888
66928
|
}
|
|
66889
|
-
checkTypeAssignableTo(returnType, expectedReturnType, node, headMessage
|
|
66929
|
+
checkTypeAssignableTo(returnType, expectedReturnType, node, headMessage);
|
|
66890
66930
|
}
|
|
66891
66931
|
function markTypeNodeAsReferenced(node) {
|
|
66892
66932
|
markEntityNameOrEntityExpressionAsReference(node && ts.getEntityNameFromTypeNode(node));
|
|
@@ -71671,13 +71711,13 @@ var ts;
|
|
|
71671
71711
|
var fileToDirective;
|
|
71672
71712
|
if (resolvedTypeReferenceDirectives) {
|
|
71673
71713
|
fileToDirective = new ts.Map();
|
|
71674
|
-
resolvedTypeReferenceDirectives.forEach(function (resolvedDirective, key) {
|
|
71714
|
+
resolvedTypeReferenceDirectives.forEach(function (resolvedDirective, key, mode) {
|
|
71675
71715
|
if (!resolvedDirective || !resolvedDirective.resolvedFileName) {
|
|
71676
71716
|
return;
|
|
71677
71717
|
}
|
|
71678
71718
|
var file = host.getSourceFile(resolvedDirective.resolvedFileName);
|
|
71679
71719
|
if (file) {
|
|
71680
|
-
addReferencedFilesToTypeDirective(file, key);
|
|
71720
|
+
addReferencedFilesToTypeDirective(file, key, mode);
|
|
71681
71721
|
}
|
|
71682
71722
|
});
|
|
71683
71723
|
}
|
|
@@ -71855,16 +71895,16 @@ var ts;
|
|
|
71855
71895
|
}
|
|
71856
71896
|
return false;
|
|
71857
71897
|
}
|
|
71858
|
-
function addReferencedFilesToTypeDirective(file, key) {
|
|
71898
|
+
function addReferencedFilesToTypeDirective(file, key, mode) {
|
|
71859
71899
|
if (fileToDirective.has(file.path))
|
|
71860
71900
|
return;
|
|
71861
|
-
fileToDirective.set(file.path, key);
|
|
71901
|
+
fileToDirective.set(file.path, [key, mode]);
|
|
71862
71902
|
for (var _i = 0, _a = file.referencedFiles; _i < _a.length; _i++) {
|
|
71863
|
-
var
|
|
71903
|
+
var _b = _a[_i], fileName = _b.fileName, resolutionMode = _b.resolutionMode;
|
|
71864
71904
|
var resolvedFile = ts.resolveTripleslashReference(fileName, file.fileName);
|
|
71865
71905
|
var referencedFile = host.getSourceFile(resolvedFile);
|
|
71866
71906
|
if (referencedFile) {
|
|
71867
|
-
addReferencedFilesToTypeDirective(referencedFile, key);
|
|
71907
|
+
addReferencedFilesToTypeDirective(referencedFile, key, resolutionMode || file.impliedNodeFormat);
|
|
71868
71908
|
}
|
|
71869
71909
|
}
|
|
71870
71910
|
}
|
|
@@ -73455,25 +73495,24 @@ var ts;
|
|
|
73455
73495
|
}
|
|
73456
73496
|
function findMostOverlappyType(source, unionTarget) {
|
|
73457
73497
|
var bestMatch;
|
|
73458
|
-
|
|
73459
|
-
|
|
73460
|
-
var
|
|
73461
|
-
|
|
73462
|
-
|
|
73463
|
-
|
|
73464
|
-
|
|
73465
|
-
|
|
73466
|
-
|
|
73467
|
-
|
|
73468
|
-
|
|
73469
|
-
|
|
73470
|
-
|
|
73498
|
+
if (!(source.flags & (131068 | 406847488))) {
|
|
73499
|
+
var matchingCount = 0;
|
|
73500
|
+
for (var _i = 0, _a = unionTarget.types; _i < _a.length; _i++) {
|
|
73501
|
+
var target = _a[_i];
|
|
73502
|
+
if (!(target.flags & (131068 | 406847488))) {
|
|
73503
|
+
var overlap = getIntersectionType([getIndexType(source), getIndexType(target)]);
|
|
73504
|
+
if (overlap.flags & 4194304) {
|
|
73505
|
+
return target;
|
|
73506
|
+
}
|
|
73507
|
+
else if (isUnitType(overlap) || overlap.flags & 1048576) {
|
|
73508
|
+
var len = overlap.flags & 1048576 ? ts.countWhere(overlap.types, isUnitType) : 1;
|
|
73509
|
+
if (len >= matchingCount) {
|
|
73510
|
+
bestMatch = target;
|
|
73511
|
+
matchingCount = len;
|
|
73512
|
+
}
|
|
73513
|
+
}
|
|
73471
73514
|
}
|
|
73472
73515
|
}
|
|
73473
|
-
else if (isUnitType(overlap) && 1 >= matchingCount) {
|
|
73474
|
-
bestMatch = target;
|
|
73475
|
-
matchingCount = 1;
|
|
73476
|
-
}
|
|
73477
73516
|
}
|
|
73478
73517
|
return bestMatch;
|
|
73479
73518
|
}
|
|
@@ -87157,7 +87196,7 @@ var ts;
|
|
|
87157
87196
|
var sourceFile = ts.createUnparsedSourceFile(prepend, "dts", stripInternal);
|
|
87158
87197
|
hasNoDefaultLib_1 = hasNoDefaultLib_1 || !!sourceFile.hasNoDefaultLib;
|
|
87159
87198
|
collectReferences(sourceFile, refs);
|
|
87160
|
-
recordTypeReferenceDirectivesIfNecessary(sourceFile.typeReferenceDirectives);
|
|
87199
|
+
recordTypeReferenceDirectivesIfNecessary(ts.map(sourceFile.typeReferenceDirectives, function (ref) { return [ref.fileName, ref.resolutionMode]; }));
|
|
87161
87200
|
collectLibs(sourceFile, libs);
|
|
87162
87201
|
return sourceFile;
|
|
87163
87202
|
}
|
|
@@ -87211,9 +87250,10 @@ var ts;
|
|
|
87211
87250
|
return ts.map(ts.arrayFrom(libs.keys()), function (lib) { return ({ fileName: lib, pos: -1, end: -1 }); });
|
|
87212
87251
|
}
|
|
87213
87252
|
function getFileReferencesForUsedTypeReferences() {
|
|
87214
|
-
return necessaryTypeReferences ? ts.mapDefined(ts.arrayFrom(necessaryTypeReferences.keys()),
|
|
87253
|
+
return necessaryTypeReferences ? ts.mapDefined(ts.arrayFrom(necessaryTypeReferences.keys()), getFileReferenceForSpecifierModeTuple) : [];
|
|
87215
87254
|
}
|
|
87216
|
-
function
|
|
87255
|
+
function getFileReferenceForSpecifierModeTuple(_a) {
|
|
87256
|
+
var typeName = _a[0], mode = _a[1];
|
|
87217
87257
|
if (emittedImports) {
|
|
87218
87258
|
for (var _i = 0, emittedImports_1 = emittedImports; _i < emittedImports_1.length; _i++) {
|
|
87219
87259
|
var importStatement = emittedImports_1[_i];
|
|
@@ -87228,7 +87268,7 @@ var ts;
|
|
|
87228
87268
|
}
|
|
87229
87269
|
}
|
|
87230
87270
|
}
|
|
87231
|
-
return { fileName: typeName, pos: -1, end: -1 };
|
|
87271
|
+
return __assign({ fileName: typeName, pos: -1, end: -1 }, (mode ? { resolutionMode: mode } : undefined));
|
|
87232
87272
|
}
|
|
87233
87273
|
function mapReferencesIntoArray(references, outputFilePath) {
|
|
87234
87274
|
return function (file) {
|
|
@@ -87245,7 +87285,7 @@ var ts;
|
|
|
87245
87285
|
if (declFileName) {
|
|
87246
87286
|
var specifier = ts.moduleSpecifiers.getModuleSpecifier(options, currentSourceFile, ts.toPath(outputFilePath, host.getCurrentDirectory(), host.getCanonicalFileName), ts.toPath(declFileName, host.getCurrentDirectory(), host.getCanonicalFileName), host);
|
|
87247
87287
|
if (!ts.pathIsRelative(specifier)) {
|
|
87248
|
-
recordTypeReferenceDirectivesIfNecessary([specifier]);
|
|
87288
|
+
recordTypeReferenceDirectivesIfNecessary([[specifier, undefined]]);
|
|
87249
87289
|
return;
|
|
87250
87290
|
}
|
|
87251
87291
|
var fileName = ts.getRelativePathToDirectoryOrUrl(outputFilePath, declFileName, host.getCurrentDirectory(), host.getCanonicalFileName, false);
|
|
@@ -91880,9 +91920,12 @@ var ts;
|
|
|
91880
91920
|
for (var _d = 0, types_24 = types; _d < types_24.length; _d++) {
|
|
91881
91921
|
var directive = types_24[_d];
|
|
91882
91922
|
var pos = writer.getTextPos();
|
|
91883
|
-
|
|
91923
|
+
var resolutionMode = directive.resolutionMode && directive.resolutionMode !== (currentSourceFile === null || currentSourceFile === void 0 ? void 0 : currentSourceFile.impliedNodeFormat)
|
|
91924
|
+
? "resolution-mode=\"" + (directive.resolutionMode === ts.ModuleKind.ESNext ? "import" : "require") + "\""
|
|
91925
|
+
: "";
|
|
91926
|
+
writeComment("/// <reference types=\"" + directive.fileName + "\" " + resolutionMode + "/>");
|
|
91884
91927
|
if (bundleFileInfo)
|
|
91885
|
-
bundleFileInfo.sections.push({ pos: pos, end: writer.getTextPos(), kind: "type", data: directive.fileName });
|
|
91928
|
+
bundleFileInfo.sections.push({ pos: pos, end: writer.getTextPos(), kind: !directive.resolutionMode ? "type" : directive.resolutionMode === ts.ModuleKind.ESNext ? "type-import" : "type-require", data: directive.fileName });
|
|
91886
91929
|
writeLine();
|
|
91887
91930
|
}
|
|
91888
91931
|
for (var _e = 0, libs_1 = libs; _e < libs_1.length; _e++) {
|
|
@@ -94188,7 +94231,7 @@ var ts;
|
|
|
94188
94231
|
return result;
|
|
94189
94232
|
}
|
|
94190
94233
|
ts.flattenDiagnosticMessageText = flattenDiagnosticMessageText;
|
|
94191
|
-
function
|
|
94234
|
+
function loadWithTypeDirectiveCache(names, containingFile, redirectedReference, containingFileMode, loader) {
|
|
94192
94235
|
if (names.length === 0) {
|
|
94193
94236
|
return [];
|
|
94194
94237
|
}
|
|
@@ -94197,18 +94240,25 @@ var ts;
|
|
|
94197
94240
|
for (var _i = 0, names_2 = names; _i < names_2.length; _i++) {
|
|
94198
94241
|
var name = names_2[_i];
|
|
94199
94242
|
var result = void 0;
|
|
94200
|
-
|
|
94201
|
-
|
|
94243
|
+
var mode = getModeForFileReference(name, containingFileMode);
|
|
94244
|
+
var strName = ts.isString(name) ? name : name.fileName.toLowerCase();
|
|
94245
|
+
var cacheKey = mode !== undefined ? mode + "|" + strName : strName;
|
|
94246
|
+
if (cache.has(cacheKey)) {
|
|
94247
|
+
result = cache.get(cacheKey);
|
|
94202
94248
|
}
|
|
94203
94249
|
else {
|
|
94204
|
-
cache.set(
|
|
94250
|
+
cache.set(cacheKey, result = loader(strName, containingFile, redirectedReference, mode));
|
|
94205
94251
|
}
|
|
94206
94252
|
resolutions.push(result);
|
|
94207
94253
|
}
|
|
94208
94254
|
return resolutions;
|
|
94209
94255
|
}
|
|
94210
|
-
ts.
|
|
94256
|
+
ts.loadWithTypeDirectiveCache = loadWithTypeDirectiveCache;
|
|
94211
94257
|
;
|
|
94258
|
+
function getModeForFileReference(ref, containingFileMode) {
|
|
94259
|
+
return (ts.isString(ref) ? containingFileMode : ref.resolutionMode) || containingFileMode;
|
|
94260
|
+
}
|
|
94261
|
+
ts.getModeForFileReference = getModeForFileReference;
|
|
94212
94262
|
function getModeForResolutionAtIndex(file, index) {
|
|
94213
94263
|
if (file.impliedNodeFormat === undefined)
|
|
94214
94264
|
return undefined;
|
|
@@ -94297,7 +94347,7 @@ var ts;
|
|
|
94297
94347
|
var _d, _e, _f, _g;
|
|
94298
94348
|
var file = ts.Debug.checkDefined(getSourceFileByPath(ref.file));
|
|
94299
94349
|
var kind = ref.kind, index = ref.index;
|
|
94300
|
-
var pos, end, packageId;
|
|
94350
|
+
var pos, end, packageId, resolutionMode;
|
|
94301
94351
|
switch (kind) {
|
|
94302
94352
|
case ts.FileIncludeKind.Import:
|
|
94303
94353
|
var importLiteral = getModuleNameStringLiteralAt(file, index);
|
|
@@ -94311,8 +94361,8 @@ var ts;
|
|
|
94311
94361
|
(_a = file.referencedFiles[index], pos = _a.pos, end = _a.end);
|
|
94312
94362
|
break;
|
|
94313
94363
|
case ts.FileIncludeKind.TypeReferenceDirective:
|
|
94314
|
-
(_b = file.typeReferenceDirectives[index], pos = _b.pos, end = _b.end);
|
|
94315
|
-
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;
|
|
94364
|
+
(_b = file.typeReferenceDirectives[index], pos = _b.pos, end = _b.end, resolutionMode = _b.resolutionMode);
|
|
94365
|
+
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;
|
|
94316
94366
|
break;
|
|
94317
94367
|
case ts.FileIncludeKind.LibReferenceDirective:
|
|
94318
94368
|
(_c = file.libReferenceDirectives[index], pos = _c.pos, end = _c.end);
|
|
@@ -94518,7 +94568,7 @@ var ts;
|
|
|
94518
94568
|
var fileReasons = ts.createMultiMap();
|
|
94519
94569
|
var cachedBindAndCheckDiagnosticsForFile = {};
|
|
94520
94570
|
var cachedDeclarationDiagnosticsForFile = {};
|
|
94521
|
-
var resolvedTypeReferenceDirectives =
|
|
94571
|
+
var resolvedTypeReferenceDirectives = ts.createModeAwareCache();
|
|
94522
94572
|
var fileProcessingDiagnostics;
|
|
94523
94573
|
var maxNodeModuleJsDepth = typeof options.maxNodeModuleJsDepth === "number" ? options.maxNodeModuleJsDepth : 0;
|
|
94524
94574
|
var currentNodeModulesDepth = 0;
|
|
@@ -94559,12 +94609,12 @@ var ts;
|
|
|
94559
94609
|
}
|
|
94560
94610
|
var actualResolveTypeReferenceDirectiveNamesWorker;
|
|
94561
94611
|
if (host.resolveTypeReferenceDirectives) {
|
|
94562
|
-
actualResolveTypeReferenceDirectiveNamesWorker = function (typeDirectiveNames, containingFile, redirectedReference) { return host.resolveTypeReferenceDirectives(ts.Debug.checkEachDefined(typeDirectiveNames), containingFile, redirectedReference, options); };
|
|
94612
|
+
actualResolveTypeReferenceDirectiveNamesWorker = function (typeDirectiveNames, containingFile, redirectedReference, containingFileMode) { return host.resolveTypeReferenceDirectives(ts.Debug.checkEachDefined(typeDirectiveNames), containingFile, redirectedReference, options, containingFileMode); };
|
|
94563
94613
|
}
|
|
94564
94614
|
else {
|
|
94565
94615
|
typeReferenceDirectiveResolutionCache = ts.createTypeReferenceDirectiveResolutionCache(currentDirectory, getCanonicalFileName, undefined, moduleResolutionCache === null || moduleResolutionCache === void 0 ? void 0 : moduleResolutionCache.getPackageJsonInfoCache());
|
|
94566
|
-
var loader_2 = function (typesRef, containingFile, redirectedReference) { return ts.resolveTypeReferenceDirective(typesRef, containingFile, options, host, redirectedReference, typeReferenceDirectiveResolutionCache).resolvedTypeReferenceDirective; };
|
|
94567
|
-
actualResolveTypeReferenceDirectiveNamesWorker = function (typeReferenceDirectiveNames, containingFile, redirectedReference) { return
|
|
94616
|
+
var loader_2 = function (typesRef, containingFile, redirectedReference, resolutionMode) { return ts.resolveTypeReferenceDirective(typesRef, containingFile, options, host, redirectedReference, typeReferenceDirectiveResolutionCache, resolutionMode).resolvedTypeReferenceDirective; };
|
|
94617
|
+
actualResolveTypeReferenceDirectiveNamesWorker = function (typeReferenceDirectiveNames, containingFile, redirectedReference, containingFileMode) { return loadWithTypeDirectiveCache(ts.Debug.checkEachDefined(typeReferenceDirectiveNames), containingFile, redirectedReference, containingFileMode, loader_2); };
|
|
94568
94618
|
}
|
|
94569
94619
|
var packageIdToSourceFile = new ts.Map();
|
|
94570
94620
|
var sourceFileToPackageName = new ts.Map();
|
|
@@ -94643,7 +94693,7 @@ var ts;
|
|
|
94643
94693
|
var containingFilename = ts.combinePaths(containingDirectory, ts.inferredTypesContainingFile);
|
|
94644
94694
|
var resolutions = resolveTypeReferenceDirectiveNamesWorker(typeReferences, containingFilename);
|
|
94645
94695
|
for (var i = 0; i < typeReferences.length; i++) {
|
|
94646
|
-
processTypeReferenceDirective(typeReferences[i], resolutions[i], { kind: ts.FileIncludeKind.AutomaticTypeDirectiveFile, typeReference: typeReferences[i], packageId: (_c = resolutions[i]) === null || _c === void 0 ? void 0 : _c.packageId });
|
|
94696
|
+
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 });
|
|
94647
94697
|
}
|
|
94648
94698
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
94649
94699
|
}
|
|
@@ -94791,9 +94841,10 @@ var ts;
|
|
|
94791
94841
|
return [];
|
|
94792
94842
|
var containingFileName = !ts.isString(containingFile) ? ts.getNormalizedAbsolutePath(containingFile.originalFileName, currentDirectory) : containingFile;
|
|
94793
94843
|
var redirectedReference = !ts.isString(containingFile) ? getRedirectReferenceForResolution(containingFile) : undefined;
|
|
94844
|
+
var containingFileMode = !ts.isString(containingFile) ? containingFile.impliedNodeFormat : undefined;
|
|
94794
94845
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("program", "resolveTypeReferenceDirectiveNamesWorker", { containingFileName: containingFileName });
|
|
94795
94846
|
ts.performance.mark("beforeResolveTypeReference");
|
|
94796
|
-
var result = actualResolveTypeReferenceDirectiveNamesWorker(typeDirectiveNames, containingFileName, redirectedReference);
|
|
94847
|
+
var result = actualResolveTypeReferenceDirectiveNamesWorker(typeDirectiveNames, containingFileName, redirectedReference, containingFileMode);
|
|
94797
94848
|
ts.performance.mark("afterResolveTypeReference");
|
|
94798
94849
|
ts.performance.measure("ResolveTypeReference", "beforeResolveTypeReference", "afterResolveTypeReference");
|
|
94799
94850
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
@@ -95095,7 +95146,7 @@ var ts;
|
|
|
95095
95146
|
else {
|
|
95096
95147
|
newSourceFile.resolvedModules = oldSourceFile.resolvedModules;
|
|
95097
95148
|
}
|
|
95098
|
-
var typesReferenceDirectives =
|
|
95149
|
+
var typesReferenceDirectives = newSourceFile.typeReferenceDirectives;
|
|
95099
95150
|
var typeReferenceResolutions = resolveTypeReferenceDirectiveNamesWorker(typesReferenceDirectives, newSourceFile);
|
|
95100
95151
|
var typeReferenceResolutionsChanged = ts.hasChangesInResolutions(typesReferenceDirectives, typeReferenceResolutions, oldSourceFile.resolvedTypeReferenceDirectiveNames, oldSourceFile, ts.typeDirectiveIsEqualTo);
|
|
95101
95152
|
if (typeReferenceResolutionsChanged) {
|
|
@@ -96046,7 +96097,7 @@ var ts;
|
|
|
96046
96097
|
});
|
|
96047
96098
|
}
|
|
96048
96099
|
function processTypeReferenceDirectives(file) {
|
|
96049
|
-
var typeDirectives =
|
|
96100
|
+
var typeDirectives = file.typeReferenceDirectives;
|
|
96050
96101
|
if (!typeDirectives) {
|
|
96051
96102
|
return;
|
|
96052
96103
|
}
|
|
@@ -96056,16 +96107,20 @@ var ts;
|
|
|
96056
96107
|
var resolvedTypeReferenceDirective = resolutions[index];
|
|
96057
96108
|
var fileName = ts.toFileNameLowerCase(ref.fileName);
|
|
96058
96109
|
ts.setResolvedTypeReferenceDirective(file, fileName, resolvedTypeReferenceDirective);
|
|
96059
|
-
|
|
96110
|
+
var mode = ref.resolutionMode || file.impliedNodeFormat;
|
|
96111
|
+
if (mode && ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.Node12 && ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.NodeNext) {
|
|
96112
|
+
programDiagnostics.add(ts.createDiagnosticForRange(file, ref, ts.Diagnostics.Resolution_modes_are_only_supported_when_moduleResolution_is_node12_or_nodenext));
|
|
96113
|
+
}
|
|
96114
|
+
processTypeReferenceDirective(fileName, mode, resolvedTypeReferenceDirective, { kind: ts.FileIncludeKind.TypeReferenceDirective, file: file.path, index: index, });
|
|
96060
96115
|
}
|
|
96061
96116
|
}
|
|
96062
|
-
function processTypeReferenceDirective(typeReferenceDirective, resolvedTypeReferenceDirective, reason) {
|
|
96117
|
+
function processTypeReferenceDirective(typeReferenceDirective, mode, resolvedTypeReferenceDirective, reason) {
|
|
96063
96118
|
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 });
|
|
96064
|
-
processTypeReferenceDirectiveWorker(typeReferenceDirective, resolvedTypeReferenceDirective, reason);
|
|
96119
|
+
processTypeReferenceDirectiveWorker(typeReferenceDirective, mode, resolvedTypeReferenceDirective, reason);
|
|
96065
96120
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
96066
96121
|
}
|
|
96067
|
-
function processTypeReferenceDirectiveWorker(typeReferenceDirective, resolvedTypeReferenceDirective, reason) {
|
|
96068
|
-
var previousResolution = resolvedTypeReferenceDirectives.get(typeReferenceDirective);
|
|
96122
|
+
function processTypeReferenceDirectiveWorker(typeReferenceDirective, mode, resolvedTypeReferenceDirective, reason) {
|
|
96123
|
+
var previousResolution = resolvedTypeReferenceDirectives.get(typeReferenceDirective, mode);
|
|
96069
96124
|
if (previousResolution && previousResolution.primary) {
|
|
96070
96125
|
return;
|
|
96071
96126
|
}
|
|
@@ -96098,7 +96153,7 @@ var ts;
|
|
|
96098
96153
|
addFilePreprocessingFileExplainingDiagnostic(undefined, reason, ts.Diagnostics.Cannot_find_type_definition_file_for_0, [typeReferenceDirective]);
|
|
96099
96154
|
}
|
|
96100
96155
|
if (saveResolution) {
|
|
96101
|
-
resolvedTypeReferenceDirectives.set(typeReferenceDirective, resolvedTypeReferenceDirective);
|
|
96156
|
+
resolvedTypeReferenceDirectives.set(typeReferenceDirective, mode, resolvedTypeReferenceDirective);
|
|
96102
96157
|
}
|
|
96103
96158
|
}
|
|
96104
96159
|
function pathForLibFile(libFileName) {
|
|
@@ -98507,9 +98562,9 @@ var ts;
|
|
|
98507
98562
|
});
|
|
98508
98563
|
hasChangedAutomaticTypeDirectiveNames = false;
|
|
98509
98564
|
}
|
|
98510
|
-
function resolveModuleName(moduleName, containingFile, compilerOptions, host, redirectedReference) {
|
|
98565
|
+
function resolveModuleName(moduleName, containingFile, compilerOptions, host, redirectedReference, _containingSourceFile, mode) {
|
|
98511
98566
|
var _a;
|
|
98512
|
-
var primaryResult = ts.resolveModuleName(moduleName, containingFile, compilerOptions, host, moduleResolutionCache, redirectedReference);
|
|
98567
|
+
var primaryResult = ts.resolveModuleName(moduleName, containingFile, compilerOptions, host, moduleResolutionCache, redirectedReference, mode);
|
|
98513
98568
|
if (!resolutionHost.getGlobalCache) {
|
|
98514
98569
|
return primaryResult;
|
|
98515
98570
|
}
|
|
@@ -98524,12 +98579,12 @@ var ts;
|
|
|
98524
98579
|
}
|
|
98525
98580
|
return primaryResult;
|
|
98526
98581
|
}
|
|
98527
|
-
function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFile, options, host, redirectedReference) {
|
|
98528
|
-
return ts.resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFile, options, host, redirectedReference, typeReferenceDirectiveResolutionCache);
|
|
98582
|
+
function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFile, options, host, redirectedReference, _containingSourceFile, resolutionMode) {
|
|
98583
|
+
return ts.resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFile, options, host, redirectedReference, typeReferenceDirectiveResolutionCache, resolutionMode);
|
|
98529
98584
|
}
|
|
98530
98585
|
function resolveNamesWithLocalCache(_a) {
|
|
98531
98586
|
var _b, _c, _d;
|
|
98532
|
-
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;
|
|
98587
|
+
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;
|
|
98533
98588
|
var path = resolutionHost.toPath(containingFile);
|
|
98534
98589
|
var resolutionsInFile = cache.get(path) || cache.set(path, ts.createModeAwareCache()).get(path);
|
|
98535
98590
|
var dirPath = ts.getDirectoryPath(path);
|
|
@@ -98550,8 +98605,10 @@ var ts;
|
|
|
98550
98605
|
var seenNamesInFile = ts.createModeAwareCache();
|
|
98551
98606
|
var i = 0;
|
|
98552
98607
|
for (var _i = 0, names_4 = names; _i < names_4.length; _i++) {
|
|
98553
|
-
var
|
|
98554
|
-
var
|
|
98608
|
+
var entry = names_4[_i];
|
|
98609
|
+
var name = ts.isString(entry) ? entry : entry.fileName.toLowerCase();
|
|
98610
|
+
var mode = !ts.isString(entry) ? ts.getModeForFileReference(entry, containingSourceFileMode) :
|
|
98611
|
+
containingSourceFile ? ts.getModeForResolutionAtIndex(containingSourceFile, i) : undefined;
|
|
98555
98612
|
i++;
|
|
98556
98613
|
var resolution = resolutionsInFile.get(name, mode);
|
|
98557
98614
|
if (!seenNamesInFile.has(name, mode) &&
|
|
@@ -98578,7 +98635,7 @@ var ts;
|
|
|
98578
98635
|
}
|
|
98579
98636
|
}
|
|
98580
98637
|
else {
|
|
98581
|
-
resolution = loader(name, containingFile, compilerOptions, ((_c = resolutionHost.getCompilerHost) === null || _c === void 0 ? void 0 : _c.call(resolutionHost)) || resolutionHost, redirectedReference, containingSourceFile);
|
|
98638
|
+
resolution = loader(name, containingFile, compilerOptions, ((_c = resolutionHost.getCompilerHost) === null || _c === void 0 ? void 0 : _c.call(resolutionHost)) || resolutionHost, redirectedReference, containingSourceFile, mode);
|
|
98582
98639
|
perDirectoryResolution.set(name, mode, resolution);
|
|
98583
98640
|
if (resolutionHost.onDiscoveredSymlink && resolutionIsSymlink(resolution)) {
|
|
98584
98641
|
resolutionHost.onDiscoveredSymlink();
|
|
@@ -98640,7 +98697,7 @@ var ts;
|
|
|
98640
98697
|
return oldResult.resolvedFileName === newResult.resolvedFileName;
|
|
98641
98698
|
}
|
|
98642
98699
|
}
|
|
98643
|
-
function resolveTypeReferenceDirectives(typeDirectiveNames, containingFile, redirectedReference) {
|
|
98700
|
+
function resolveTypeReferenceDirectives(typeDirectiveNames, containingFile, redirectedReference, containingFileMode) {
|
|
98644
98701
|
return resolveNamesWithLocalCache({
|
|
98645
98702
|
names: typeDirectiveNames,
|
|
98646
98703
|
containingFile: containingFile,
|
|
@@ -98650,6 +98707,7 @@ var ts;
|
|
|
98650
98707
|
loader: resolveTypeReferenceDirective,
|
|
98651
98708
|
getResolutionWithResolvedFileName: getResolvedTypeReferenceDirective,
|
|
98652
98709
|
shouldRetryResolution: function (resolution) { return resolution.resolvedTypeReferenceDirective === undefined; },
|
|
98710
|
+
containingSourceFileMode: containingFileMode
|
|
98653
98711
|
});
|
|
98654
98712
|
}
|
|
98655
98713
|
function resolveModuleNames(moduleNames, containingFile, reusedNames, redirectedReference, containingSourceFile) {
|
|
@@ -100341,7 +100399,7 @@ var ts;
|
|
|
100341
100399
|
}
|
|
100342
100400
|
return host.resolveTypeReferenceDirectives.apply(host, args);
|
|
100343
100401
|
}) :
|
|
100344
|
-
(function (typeDirectiveNames, containingFile, redirectedReference) { return resolutionCache.resolveTypeReferenceDirectives(typeDirectiveNames, containingFile, redirectedReference); });
|
|
100402
|
+
(function (typeDirectiveNames, containingFile, redirectedReference, _options, containingFileMode) { return resolutionCache.resolveTypeReferenceDirectives(typeDirectiveNames, containingFile, redirectedReference, containingFileMode); });
|
|
100345
100403
|
var userProvidedResolution = !!host.resolveModuleNames || !!host.resolveTypeReferenceDirectives;
|
|
100346
100404
|
builderProgram = readBuilderProgram(compilerOptions, compilerHost);
|
|
100347
100405
|
synchronizeProgram();
|
|
@@ -100995,9 +101053,9 @@ var ts;
|
|
|
100995
101053
|
compilerHost.getModuleResolutionCache = function () { return moduleResolutionCache; };
|
|
100996
101054
|
}
|
|
100997
101055
|
if (!compilerHost.resolveTypeReferenceDirectives) {
|
|
100998
|
-
var loader_4 = function (moduleName, containingFile, redirectedReference) { return ts.resolveTypeReferenceDirective(moduleName, containingFile, state.projectCompilerOptions, compilerHost, redirectedReference, state.typeReferenceDirectiveResolutionCache).resolvedTypeReferenceDirective; };
|
|
100999
|
-
compilerHost.resolveTypeReferenceDirectives = function (typeReferenceDirectiveNames, containingFile, redirectedReference) {
|
|
101000
|
-
return ts.
|
|
101056
|
+
var loader_4 = function (moduleName, containingFile, redirectedReference, containingFileMode) { return ts.resolveTypeReferenceDirective(moduleName, containingFile, state.projectCompilerOptions, compilerHost, redirectedReference, state.typeReferenceDirectiveResolutionCache, containingFileMode).resolvedTypeReferenceDirective; };
|
|
101057
|
+
compilerHost.resolveTypeReferenceDirectives = function (typeReferenceDirectiveNames, containingFile, redirectedReference, _options, containingFileMode) {
|
|
101058
|
+
return ts.loadWithTypeDirectiveCache(ts.Debug.checkEachDefined(typeReferenceDirectiveNames), containingFile, redirectedReference, containingFileMode, loader_4);
|
|
101001
101059
|
};
|
|
101002
101060
|
}
|
|
101003
101061
|
var _a = ts.createWatchFactory(hostWithWatch, options), watchFile = _a.watchFile, watchDirectory = _a.watchDirectory, writeLog = _a.writeLog;
|