@typescript-deploys/pr-build 5.0.0-pr-52577-2 → 5.0.0-pr-52282-27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/tsc.js +69 -48
- package/lib/tsserver.js +2926 -2855
- package/lib/tsserverlibrary.d.ts +0 -2
- package/lib/tsserverlibrary.js +194 -125
- package/lib/typescript.d.ts +0 -2
- package/lib/typescript.js +185 -122
- package/lib/typingsInstaller.js +12 -2
- package/package.json +2 -1
package/lib/tsc.js
CHANGED
|
@@ -23,7 +23,7 @@ var __export = (target, all) => {
|
|
|
23
23
|
|
|
24
24
|
// src/compiler/corePublic.ts
|
|
25
25
|
var versionMajorMinor = "5.0";
|
|
26
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
26
|
+
var version = `${versionMajorMinor}.0-insiders.20230207`;
|
|
27
27
|
|
|
28
28
|
// src/compiler/core.ts
|
|
29
29
|
var emptyArray = [];
|
|
@@ -6572,7 +6572,6 @@ var Diagnostics = {
|
|
|
6572
6572
|
Cannot_find_type_definition_file_for_0: diag(2688, 1 /* Error */, "Cannot_find_type_definition_file_for_0_2688", "Cannot find type definition file for '{0}'."),
|
|
6573
6573
|
Cannot_extend_an_interface_0_Did_you_mean_implements: diag(2689, 1 /* Error */, "Cannot_extend_an_interface_0_Did_you_mean_implements_2689", "Cannot extend an interface '{0}'. Did you mean 'implements'?"),
|
|
6574
6574
|
_0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Did_you_mean_to_use_1_in_0: diag(2690, 1 /* Error */, "_0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Did_you_mean_to_use_1_in_0_2690", "'{0}' only refers to a type, but is being used as a value here. Did you mean to use '{1} in {0}'?"),
|
|
6575
|
-
An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead: diag(2691, 1 /* Error */, "An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead_2691", "An import path cannot end with a '{0}' extension. Consider importing '{1}' instead."),
|
|
6576
6575
|
_0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible: diag(2692, 1 /* Error */, "_0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible_2692", "'{0}' is a primitive, but '{1}' is a wrapper object. Prefer using '{0}' when possible."),
|
|
6577
6576
|
_0_only_refers_to_a_type_but_is_being_used_as_a_value_here: diag(2693, 1 /* Error */, "_0_only_refers_to_a_type_but_is_being_used_as_a_value_here_2693", "'{0}' only refers to a type, but is being used as a value here."),
|
|
6578
6577
|
Namespace_0_has_no_exported_member_1: diag(2694, 1 /* Error */, "Namespace_0_has_no_exported_member_1_2694", "Namespace '{0}' has no exported member '{1}'."),
|
|
@@ -7273,6 +7272,10 @@ var Diagnostics = {
|
|
|
7273
7272
|
Conditions_to_set_in_addition_to_the_resolver_specific_defaults_when_resolving_imports: diag(6410, 3 /* Message */, "Conditions_to_set_in_addition_to_the_resolver_specific_defaults_when_resolving_imports_6410", "Conditions to set in addition to the resolver-specific defaults when resolving imports."),
|
|
7274
7273
|
true_when_moduleResolution_is_node16_nodenext_or_bundler_otherwise_false: diag(6411, 3 /* Message */, "true_when_moduleResolution_is_node16_nodenext_or_bundler_otherwise_false_6411", "`true` when 'moduleResolution' is 'node16', 'nodenext', or 'bundler'; otherwise `false`."),
|
|
7275
7274
|
Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_file_2_was_root_file_of_compilation_but_not_any_more: diag(6412, 3 /* Message */, "Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_file_2_was_root_file_of_compilation_6412", "Project '{0}' is out of date because buildinfo file '{1}' indicates that file '{2}' was root file of compilation but not any more."),
|
|
7275
|
+
Entering_conditional_exports: diag(6413, 3 /* Message */, "Entering_conditional_exports_6413", "Entering conditional exports."),
|
|
7276
|
+
Resolved_under_condition_0: diag(6414, 3 /* Message */, "Resolved_under_condition_0_6414", "Resolved under condition '{0}'."),
|
|
7277
|
+
Failed_to_resolve_under_condition_0: diag(6415, 3 /* Message */, "Failed_to_resolve_under_condition_0_6415", "Failed to resolve under condition '{0}'."),
|
|
7278
|
+
Exiting_conditional_exports: diag(6416, 3 /* Message */, "Exiting_conditional_exports_6416", "Exiting conditional exports."),
|
|
7276
7279
|
The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1: diag(6500, 3 /* Message */, "The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1_6500", "The expected type comes from property '{0}' which is declared here on type '{1}'"),
|
|
7277
7280
|
The_expected_type_comes_from_this_index_signature: diag(6501, 3 /* Message */, "The_expected_type_comes_from_this_index_signature_6501", "The expected type comes from this index signature."),
|
|
7278
7281
|
The_expected_type_comes_from_the_return_type_of_this_signature: diag(6502, 3 /* Message */, "The_expected_type_comes_from_the_return_type_of_this_signature_6502", "The expected type comes from the return type of this signature."),
|
|
@@ -37789,18 +37792,24 @@ function getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirec
|
|
|
37789
37792
|
)));
|
|
37790
37793
|
} else if (typeof target === "object" && target !== null) {
|
|
37791
37794
|
if (!Array.isArray(target)) {
|
|
37795
|
+
traceIfEnabled(state, Diagnostics.Entering_conditional_exports);
|
|
37792
37796
|
for (const condition of getOwnKeys(target)) {
|
|
37793
37797
|
if (condition === "default" || state.conditions.indexOf(condition) >= 0 || isApplicableVersionedTypesKey(state.conditions, condition)) {
|
|
37794
37798
|
traceIfEnabled(state, Diagnostics.Matched_0_condition_1, isImports ? "imports" : "exports", condition);
|
|
37795
37799
|
const subTarget = target[condition];
|
|
37796
37800
|
const result = loadModuleFromTargetImportOrExport(subTarget, subpath, pattern, key);
|
|
37797
37801
|
if (result) {
|
|
37802
|
+
traceIfEnabled(state, Diagnostics.Resolved_under_condition_0, condition);
|
|
37803
|
+
traceIfEnabled(state, Diagnostics.Exiting_conditional_exports);
|
|
37798
37804
|
return result;
|
|
37805
|
+
} else {
|
|
37806
|
+
traceIfEnabled(state, Diagnostics.Failed_to_resolve_under_condition_0, condition);
|
|
37799
37807
|
}
|
|
37800
37808
|
} else {
|
|
37801
37809
|
traceIfEnabled(state, Diagnostics.Saw_non_matching_condition_0, condition);
|
|
37802
37810
|
}
|
|
37803
37811
|
}
|
|
37812
|
+
traceIfEnabled(state, Diagnostics.Exiting_conditional_exports);
|
|
37804
37813
|
return void 0;
|
|
37805
37814
|
} else {
|
|
37806
37815
|
if (!length(target)) {
|
|
@@ -41430,7 +41439,7 @@ function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFi
|
|
|
41430
41439
|
let redirectPathsSpecifiers;
|
|
41431
41440
|
let relativeSpecifiers;
|
|
41432
41441
|
for (const modulePath of modulePaths) {
|
|
41433
|
-
const specifier = tryGetModuleNameAsNodeModule(
|
|
41442
|
+
const specifier = modulePath.isInNodeModules ? tryGetModuleNameAsNodeModule(
|
|
41434
41443
|
modulePath,
|
|
41435
41444
|
info,
|
|
41436
41445
|
importingSourceFile,
|
|
@@ -41440,7 +41449,7 @@ function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFi
|
|
|
41440
41449
|
/*packageNameOnly*/
|
|
41441
41450
|
void 0,
|
|
41442
41451
|
options.overrideImportMode
|
|
41443
|
-
);
|
|
41452
|
+
) : void 0;
|
|
41444
41453
|
nodeModulesSpecifiers = append(nodeModulesSpecifiers, specifier);
|
|
41445
41454
|
if (specifier && modulePath.isRedirect) {
|
|
41446
41455
|
return nodeModulesSpecifiers;
|
|
@@ -42113,6 +42122,7 @@ var SignatureCheckMode = /* @__PURE__ */ ((SignatureCheckMode3) => {
|
|
|
42113
42122
|
SignatureCheckMode3[SignatureCheckMode3["StrictCallback"] = 2] = "StrictCallback";
|
|
42114
42123
|
SignatureCheckMode3[SignatureCheckMode3["IgnoreReturnTypes"] = 4] = "IgnoreReturnTypes";
|
|
42115
42124
|
SignatureCheckMode3[SignatureCheckMode3["StrictArity"] = 8] = "StrictArity";
|
|
42125
|
+
SignatureCheckMode3[SignatureCheckMode3["StrictTopSignature"] = 16] = "StrictTopSignature";
|
|
42116
42126
|
SignatureCheckMode3[SignatureCheckMode3["Callback"] = 3] = "Callback";
|
|
42117
42127
|
return SignatureCheckMode3;
|
|
42118
42128
|
})(SignatureCheckMode || {});
|
|
@@ -42500,6 +42510,7 @@ function createTypeChecker(host) {
|
|
|
42500
42510
|
isArrayType,
|
|
42501
42511
|
isTupleType,
|
|
42502
42512
|
isArrayLikeType,
|
|
42513
|
+
isEmptyAnonymousObjectType,
|
|
42503
42514
|
isTypeInvalidDueToUnionDiscriminant,
|
|
42504
42515
|
getExactOptionalProperties,
|
|
42505
42516
|
getAllPossiblePropertiesOfTypes,
|
|
@@ -45362,12 +45373,9 @@ function createTypeChecker(host) {
|
|
|
45362
45373
|
if (resolutionDiagnostic) {
|
|
45363
45374
|
error(errorNode, resolutionDiagnostic, moduleReference, resolvedModule.resolvedFileName);
|
|
45364
45375
|
} else {
|
|
45365
|
-
const tsExtension = tryExtractTSExtension(moduleReference);
|
|
45366
45376
|
const isExtensionlessRelativePathImport = pathIsRelative(moduleReference) && !hasExtension(moduleReference);
|
|
45367
45377
|
const resolutionIsNode16OrNext = moduleResolutionKind === 3 /* Node16 */ || moduleResolutionKind === 99 /* NodeNext */;
|
|
45368
|
-
if (
|
|
45369
|
-
errorOnTSExtensionImport(tsExtension);
|
|
45370
|
-
} else if (!getResolveJsonModule(compilerOptions) && fileExtensionIs(moduleReference, ".json" /* Json */) && moduleResolutionKind !== 1 /* Classic */ && hasJsonModuleEmitEnabled(compilerOptions)) {
|
|
45378
|
+
if (!getResolveJsonModule(compilerOptions) && fileExtensionIs(moduleReference, ".json" /* Json */) && moduleResolutionKind !== 1 /* Classic */ && hasJsonModuleEmitEnabled(compilerOptions)) {
|
|
45371
45379
|
error(errorNode, Diagnostics.Cannot_find_module_0_Consider_using_resolveJsonModule_to_import_module_with_json_extension, moduleReference);
|
|
45372
45380
|
} else if (mode === 99 /* ESNext */ && resolutionIsNode16OrNext && isExtensionlessRelativePathImport) {
|
|
45373
45381
|
const absoluteRef = getNormalizedAbsolutePath(moduleReference, getDirectoryPath(currentSourceFile.path));
|
|
@@ -45387,10 +45395,6 @@ function createTypeChecker(host) {
|
|
|
45387
45395
|
}
|
|
45388
45396
|
}
|
|
45389
45397
|
return void 0;
|
|
45390
|
-
function errorOnTSExtensionImport(tsExtension) {
|
|
45391
|
-
const diag2 = Diagnostics.An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead;
|
|
45392
|
-
error(errorNode, diag2, tsExtension, getSuggestedImportSource(tsExtension));
|
|
45393
|
-
}
|
|
45394
45398
|
function getSuggestedImportSource(tsExtension) {
|
|
45395
45399
|
const importSourceWithoutExtension = removeExtension(moduleReference, tsExtension);
|
|
45396
45400
|
if (emitModuleKindIsNonNodeESM(moduleKind) || mode === 99 /* ESNext */) {
|
|
@@ -47523,7 +47527,7 @@ function createTypeChecker(host) {
|
|
|
47523
47527
|
if (signature.thisParameter) {
|
|
47524
47528
|
return symbolToParameterDeclaration(signature.thisParameter, context);
|
|
47525
47529
|
}
|
|
47526
|
-
if (signature.declaration) {
|
|
47530
|
+
if (signature.declaration && isInJSFile(signature.declaration)) {
|
|
47527
47531
|
const thisTag = getJSDocThisTag(signature.declaration);
|
|
47528
47532
|
if (thisTag && thisTag.typeExpression) {
|
|
47529
47533
|
return factory.createParameterDeclaration(
|
|
@@ -50504,7 +50508,7 @@ function createTypeChecker(host) {
|
|
|
50504
50508
|
function getWidenedTypeForAssignmentDeclaration(symbol, resolvedSymbol) {
|
|
50505
50509
|
const container = getAssignedExpandoInitializer(symbol.valueDeclaration);
|
|
50506
50510
|
if (container) {
|
|
50507
|
-
const tag = getJSDocTypeTag(container);
|
|
50511
|
+
const tag = isInJSFile(container) ? getJSDocTypeTag(container) : void 0;
|
|
50508
50512
|
if (tag && tag.typeExpression) {
|
|
50509
50513
|
return getTypeFromTypeNode(tag.typeExpression);
|
|
50510
50514
|
}
|
|
@@ -54388,7 +54392,7 @@ function createTypeChecker(host) {
|
|
|
54388
54392
|
return links.resolvedJSDocType;
|
|
54389
54393
|
}
|
|
54390
54394
|
function getSubstitutionType(baseType, constraint) {
|
|
54391
|
-
if (constraint.flags & 3 /* AnyOrUnknown */ || constraint === baseType) {
|
|
54395
|
+
if (constraint.flags & 3 /* AnyOrUnknown */ || constraint === baseType || baseType.flags & 1 /* Any */) {
|
|
54392
54396
|
return baseType;
|
|
54393
54397
|
}
|
|
54394
54398
|
const id = `${getTypeId(baseType)}>${getTypeId(constraint)}`;
|
|
@@ -56075,7 +56079,7 @@ function createTypeChecker(host) {
|
|
|
56075
56079
|
}
|
|
56076
56080
|
}
|
|
56077
56081
|
const propType = getTypeOfSymbol(prop);
|
|
56078
|
-
return accessExpression && getAssignmentTargetKind(accessExpression) !== 1 /* Definite */ ? getFlowTypeOfReference(accessExpression, propType) : propType;
|
|
56082
|
+
return accessExpression && getAssignmentTargetKind(accessExpression) !== 1 /* Definite */ ? getFlowTypeOfReference(accessExpression, propType) : accessNode && isIndexedAccessTypeNode(accessNode) && containsMissingType(propType) ? getUnionType([propType, undefinedType]) : propType;
|
|
56079
56083
|
}
|
|
56080
56084
|
if (everyType(objectType, isTupleType) && isNumericLiteralName(propName)) {
|
|
56081
56085
|
const index = +propName;
|
|
@@ -58226,16 +58230,24 @@ function createTypeChecker(host) {
|
|
|
58226
58230
|
void 0
|
|
58227
58231
|
) !== 0 /* False */;
|
|
58228
58232
|
}
|
|
58229
|
-
function
|
|
58230
|
-
|
|
58233
|
+
function isTopSignature(s) {
|
|
58234
|
+
if (!s.typeParameters && (!s.thisParameter || isTypeAny(getTypeOfParameter(s.thisParameter))) && s.parameters.length === 1 && signatureHasRestParameter(s)) {
|
|
58235
|
+
const paramType = getTypeOfParameter(s.parameters[0]);
|
|
58236
|
+
const restType = isArrayType(paramType) ? getTypeArguments(paramType)[0] : paramType;
|
|
58237
|
+
return !!(restType.flags & (1 /* Any */ | 131072 /* Never */) && getReturnTypeOfSignature(s).flags & 3 /* AnyOrUnknown */);
|
|
58238
|
+
}
|
|
58239
|
+
return false;
|
|
58231
58240
|
}
|
|
58232
58241
|
function compareSignaturesRelated(source, target, checkMode, reportErrors2, errorReporter, incompatibleErrorReporter, compareTypes, reportUnreliableMarkers) {
|
|
58233
58242
|
if (source === target) {
|
|
58234
58243
|
return -1 /* True */;
|
|
58235
58244
|
}
|
|
58236
|
-
if (
|
|
58245
|
+
if (!(checkMode & 16 /* StrictTopSignature */ && isTopSignature(source)) && isTopSignature(target)) {
|
|
58237
58246
|
return -1 /* True */;
|
|
58238
58247
|
}
|
|
58248
|
+
if (checkMode & 16 /* StrictTopSignature */ && isTopSignature(source) && !isTopSignature(target)) {
|
|
58249
|
+
return 0 /* False */;
|
|
58250
|
+
}
|
|
58239
58251
|
const targetCount = getParameterCount(target);
|
|
58240
58252
|
const sourceHasMoreParameters = !hasEffectiveRestParameter(target) && (checkMode & 8 /* StrictArity */ ? hasEffectiveRestParameter(source) || getParameterCount(source) > targetCount : getMinArgumentCount(source) > targetCount);
|
|
58241
58253
|
if (sourceHasMoreParameters) {
|
|
@@ -58453,7 +58465,9 @@ function createTypeChecker(host) {
|
|
|
58453
58465
|
function isSimpleTypeRelatedTo(source, target, relation, errorReporter) {
|
|
58454
58466
|
const s = source.flags;
|
|
58455
58467
|
const t = target.flags;
|
|
58456
|
-
if (t &
|
|
58468
|
+
if (t & 1 /* Any */ || s & 131072 /* Never */ || source === wildcardType)
|
|
58469
|
+
return true;
|
|
58470
|
+
if (t & 2 /* Unknown */ && !(relation === strictSubtypeRelation && s & 1 /* Any */))
|
|
58457
58471
|
return true;
|
|
58458
58472
|
if (t & 131072 /* Never */)
|
|
58459
58473
|
return false;
|
|
@@ -60693,10 +60707,11 @@ function createTypeChecker(host) {
|
|
|
60693
60707
|
return (source2, target2) => reportIncompatibleError(Diagnostics.Construct_signature_return_types_0_and_1_are_incompatible, typeToString(source2), typeToString(target2));
|
|
60694
60708
|
}
|
|
60695
60709
|
function signatureRelatedTo(source2, target2, erase, reportErrors2, intersectionState, incompatibleReporter) {
|
|
60710
|
+
const checkMode = relation === subtypeRelation ? 16 /* StrictTopSignature */ : relation === strictSubtypeRelation ? 16 /* StrictTopSignature */ | 8 /* StrictArity */ : 0 /* None */;
|
|
60696
60711
|
return compareSignaturesRelated(
|
|
60697
60712
|
erase ? getErasedSignature(source2) : source2,
|
|
60698
60713
|
erase ? getErasedSignature(target2) : target2,
|
|
60699
|
-
|
|
60714
|
+
checkMode,
|
|
60700
60715
|
reportErrors2,
|
|
60701
60716
|
reportError,
|
|
60702
60717
|
incompatibleReporter,
|
|
@@ -60821,7 +60836,7 @@ function createTypeChecker(host) {
|
|
|
60821
60836
|
if (sourceInfo) {
|
|
60822
60837
|
return indexInfoRelatedTo(sourceInfo, targetInfo, reportErrors2, intersectionState);
|
|
60823
60838
|
}
|
|
60824
|
-
if (!(intersectionState & 1 /* Source */) && isObjectTypeWithInferableIndex(source2)) {
|
|
60839
|
+
if (!(intersectionState & 1 /* Source */) && (relation !== strictSubtypeRelation || getObjectFlags(source2) & 8192 /* FreshLiteral */) && isObjectTypeWithInferableIndex(source2)) {
|
|
60825
60840
|
return membersRelatedToIndexInfo(source2, targetInfo, reportErrors2, intersectionState);
|
|
60826
60841
|
}
|
|
60827
60842
|
if (reportErrors2) {
|
|
@@ -64679,52 +64694,58 @@ function createTypeChecker(host) {
|
|
|
64679
64694
|
if (!isTypeDerivedFrom(rightType, globalFunctionType)) {
|
|
64680
64695
|
return type;
|
|
64681
64696
|
}
|
|
64682
|
-
|
|
64683
|
-
|
|
64684
|
-
if (prototypeProperty) {
|
|
64685
|
-
const prototypePropertyType = getTypeOfSymbol(prototypeProperty);
|
|
64686
|
-
if (!isTypeAny(prototypePropertyType)) {
|
|
64687
|
-
targetType = prototypePropertyType;
|
|
64688
|
-
}
|
|
64689
|
-
}
|
|
64690
|
-
if (isTypeAny(type) && (targetType === globalObjectType || targetType === globalFunctionType)) {
|
|
64697
|
+
const instanceType = mapType(rightType, getInstanceType);
|
|
64698
|
+
if (isTypeAny(type) && (instanceType === globalObjectType || instanceType === globalFunctionType) || !assumeTrue && !(instanceType.flags & 524288 /* Object */ && !isEmptyAnonymousObjectType(instanceType))) {
|
|
64691
64699
|
return type;
|
|
64692
64700
|
}
|
|
64693
|
-
if (!targetType) {
|
|
64694
|
-
const constructSignatures = getSignaturesOfType(rightType, 1 /* Construct */);
|
|
64695
|
-
targetType = constructSignatures.length ? getUnionType(map(constructSignatures, (signature) => getReturnTypeOfSignature(getErasedSignature(signature)))) : emptyObjectType;
|
|
64696
|
-
}
|
|
64697
|
-
if (!assumeTrue && rightType.flags & 1048576 /* Union */) {
|
|
64698
|
-
const nonConstructorTypeInUnion = find(rightType.types, (t) => !isConstructorType(t));
|
|
64699
|
-
if (!nonConstructorTypeInUnion)
|
|
64700
|
-
return type;
|
|
64701
|
-
}
|
|
64702
64701
|
return getNarrowedType(
|
|
64703
64702
|
type,
|
|
64704
|
-
|
|
64703
|
+
instanceType,
|
|
64705
64704
|
assumeTrue,
|
|
64706
64705
|
/*checkDerived*/
|
|
64707
64706
|
true
|
|
64708
64707
|
);
|
|
64709
64708
|
}
|
|
64709
|
+
function getInstanceType(constructorType) {
|
|
64710
|
+
const prototypePropertyType = getTypeOfPropertyOfType(constructorType, "prototype");
|
|
64711
|
+
if (prototypePropertyType && !isTypeAny(prototypePropertyType)) {
|
|
64712
|
+
return prototypePropertyType;
|
|
64713
|
+
}
|
|
64714
|
+
const constructSignatures = getSignaturesOfType(constructorType, 1 /* Construct */);
|
|
64715
|
+
if (constructSignatures.length) {
|
|
64716
|
+
return getUnionType(map(constructSignatures, (signature) => getReturnTypeOfSignature(getErasedSignature(signature))));
|
|
64717
|
+
}
|
|
64718
|
+
return emptyObjectType;
|
|
64719
|
+
}
|
|
64710
64720
|
function getNarrowedType(type, candidate, assumeTrue, checkDerived) {
|
|
64711
64721
|
var _a3;
|
|
64712
64722
|
const key2 = type.flags & 1048576 /* Union */ ? `N${getTypeId(type)},${getTypeId(candidate)},${(assumeTrue ? 1 : 0) | (checkDerived ? 2 : 0)}` : void 0;
|
|
64713
64723
|
return (_a3 = getCachedType(key2)) != null ? _a3 : setCachedType(key2, getNarrowedTypeWorker(type, candidate, assumeTrue, checkDerived));
|
|
64714
64724
|
}
|
|
64715
64725
|
function getNarrowedTypeWorker(type, candidate, assumeTrue, checkDerived) {
|
|
64716
|
-
const isRelated = checkDerived ? isTypeDerivedFrom : isTypeSubtypeOf;
|
|
64717
64726
|
if (!assumeTrue) {
|
|
64718
|
-
|
|
64727
|
+
if (checkDerived) {
|
|
64728
|
+
return filterType(type, (t) => !isTypeDerivedFrom(t, candidate));
|
|
64729
|
+
}
|
|
64730
|
+
const trueType2 = getNarrowedType(
|
|
64731
|
+
type,
|
|
64732
|
+
candidate,
|
|
64733
|
+
/*assumeTrue*/
|
|
64734
|
+
true,
|
|
64735
|
+
/*checkDerived*/
|
|
64736
|
+
false
|
|
64737
|
+
);
|
|
64738
|
+
return filterType(type, (t) => !isTypeSubsetOf(t, trueType2));
|
|
64719
64739
|
}
|
|
64720
64740
|
if (type.flags & 3 /* AnyOrUnknown */) {
|
|
64721
64741
|
return candidate;
|
|
64722
64742
|
}
|
|
64743
|
+
const isRelated = checkDerived ? isTypeDerivedFrom : isTypeSubtypeOf;
|
|
64723
64744
|
const keyPropertyName = type.flags & 1048576 /* Union */ ? getKeyPropertyName(type) : void 0;
|
|
64724
64745
|
const narrowedType = mapType(candidate, (c) => {
|
|
64725
64746
|
const discriminant = keyPropertyName && getTypeOfPropertyOfType(c, keyPropertyName);
|
|
64726
64747
|
const matching = discriminant && getConstituentTypeForKeyType(type, discriminant);
|
|
64727
|
-
const directlyRelated = mapType(matching || type, checkDerived ? (t) => isTypeDerivedFrom(t, c) ? t : isTypeDerivedFrom(c, t) ? c : neverType : (t) => isTypeSubtypeOf(c, t) ? c : isTypeSubtypeOf(t, c) ? t : neverType);
|
|
64748
|
+
const directlyRelated = mapType(matching || type, checkDerived ? (t) => isTypeDerivedFrom(t, c) ? t : isTypeDerivedFrom(c, t) ? c : neverType : (t) => isTypeSubtypeOf(c, t) && !isTypeIdenticalTo(c, t) ? c : isTypeSubtypeOf(t, c) ? t : neverType);
|
|
64728
64749
|
return directlyRelated.flags & 131072 /* Never */ ? mapType(type, (t) => maybeTypeOfKind(t, 465829888 /* Instantiable */) && isRelated(c, getBaseConstraintOfType(t) || unknownType) ? getIntersectionType([t, c]) : neverType) : directlyRelated;
|
|
64729
64750
|
});
|
|
64730
64751
|
return !(narrowedType.flags & 131072 /* Never */) ? narrowedType : isTypeSubtypeOf(candidate, type) ? candidate : isTypeAssignableTo(type, candidate) ? type : isTypeAssignableTo(candidate, type) ? candidate : getIntersectionType([type, candidate]);
|
|
@@ -72480,7 +72501,7 @@ function createTypeChecker(host) {
|
|
|
72480
72501
|
return leftType;
|
|
72481
72502
|
} else {
|
|
72482
72503
|
checkAssignmentOperator(rightType);
|
|
72483
|
-
return
|
|
72504
|
+
return rightType;
|
|
72484
72505
|
}
|
|
72485
72506
|
case 27 /* CommaToken */:
|
|
72486
72507
|
if (!compilerOptions.allowUnreachableCode && isSideEffectFree(left) && !isIndirectCall(left.parent)) {
|
|
@@ -77892,7 +77913,7 @@ function createTypeChecker(host) {
|
|
|
77892
77913
|
getNodeLinks(node).flags |= 2048 /* LexicalModuleMergesWithClass */;
|
|
77893
77914
|
}
|
|
77894
77915
|
}
|
|
77895
|
-
if (compilerOptions.verbatimModuleSyntax && node.parent.kind === 308 /* SourceFile */) {
|
|
77916
|
+
if (compilerOptions.verbatimModuleSyntax && node.parent.kind === 308 /* SourceFile */ && (moduleKind === 1 /* CommonJS */ || node.parent.impliedNodeFormat === 1 /* CommonJS */)) {
|
|
77896
77917
|
const exportModifier = (_b = node.modifiers) == null ? void 0 : _b.find((m) => m.kind === 93 /* ExportKeyword */);
|
|
77897
77918
|
if (exportModifier) {
|
|
77898
77919
|
error(exportModifier, Diagnostics.A_top_level_export_modifier_cannot_be_used_on_value_declarations_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled);
|
|
@@ -111979,14 +112000,14 @@ var moduleResolutionNameAndModeGetter = {
|
|
|
111979
112000
|
function createModuleResolutionLoader(containingFile, redirectedReference, options, host, cache) {
|
|
111980
112001
|
return {
|
|
111981
112002
|
nameAndMode: moduleResolutionNameAndModeGetter,
|
|
111982
|
-
resolve: (moduleName,
|
|
112003
|
+
resolve: (moduleName, resolutionMode) => resolveModuleName(
|
|
111983
112004
|
moduleName,
|
|
111984
112005
|
containingFile,
|
|
111985
112006
|
options,
|
|
111986
112007
|
host,
|
|
111987
112008
|
cache,
|
|
111988
112009
|
redirectedReference,
|
|
111989
|
-
|
|
112010
|
+
resolutionMode
|
|
111990
112011
|
)
|
|
111991
112012
|
};
|
|
111992
112013
|
}
|