@typescript-deploys/pr-build 5.0.0-pr-52059-5 → 5.0.0-pr-52577-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/tsc.js +122 -50
- package/lib/tsserver.js +135 -56
- package/lib/tsserverlibrary.d.ts +16 -0
- package/lib/tsserverlibrary.js +135 -56
- package/lib/typescript.d.ts +16 -0
- package/lib/typescript.js +135 -56
- package/lib/typingsInstaller.js +33 -15
- package/package.json +1 -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.20230202`;
|
|
27
27
|
|
|
28
28
|
// src/compiler/core.ts
|
|
29
29
|
var emptyArray = [];
|
|
@@ -10711,6 +10711,9 @@ function isFunctionLikeOrClassStaticBlockDeclaration(node) {
|
|
|
10711
10711
|
function isFunctionLikeDeclaration(node) {
|
|
10712
10712
|
return node && isFunctionLikeDeclarationKind(node.kind);
|
|
10713
10713
|
}
|
|
10714
|
+
function isBooleanLiteral(node) {
|
|
10715
|
+
return node.kind === 110 /* TrueKeyword */ || node.kind === 95 /* FalseKeyword */;
|
|
10716
|
+
}
|
|
10714
10717
|
function isFunctionLikeDeclarationKind(kind) {
|
|
10715
10718
|
switch (kind) {
|
|
10716
10719
|
case 259 /* FunctionDeclaration */:
|
|
@@ -35952,6 +35955,22 @@ function resolvedTypeScriptOnly(resolved) {
|
|
|
35952
35955
|
Debug.assert(extensionIsTS(resolved.extension));
|
|
35953
35956
|
return { fileName: resolved.path, packageId: resolved.packageId };
|
|
35954
35957
|
}
|
|
35958
|
+
function createResolvedModuleWithFailedLookupLocationsHandlingSymlink(moduleName, resolved, isExternalLibraryImport, failedLookupLocations, affectingLocations, diagnostics, state, legacyResult) {
|
|
35959
|
+
if (!state.resultFromCache && !state.compilerOptions.preserveSymlinks && resolved && isExternalLibraryImport && !resolved.originalPath && !isExternalModuleNameRelative(moduleName)) {
|
|
35960
|
+
const { resolvedFileName, originalPath } = getOriginalAndResolvedFileName(resolved.path, state.host, state.traceEnabled);
|
|
35961
|
+
if (originalPath)
|
|
35962
|
+
resolved = { ...resolved, path: resolvedFileName, originalPath };
|
|
35963
|
+
}
|
|
35964
|
+
return createResolvedModuleWithFailedLookupLocations(
|
|
35965
|
+
resolved,
|
|
35966
|
+
isExternalLibraryImport,
|
|
35967
|
+
failedLookupLocations,
|
|
35968
|
+
affectingLocations,
|
|
35969
|
+
diagnostics,
|
|
35970
|
+
state.resultFromCache,
|
|
35971
|
+
legacyResult
|
|
35972
|
+
);
|
|
35973
|
+
}
|
|
35955
35974
|
function createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations, affectingLocations, diagnostics, resultFromCache, legacyResult) {
|
|
35956
35975
|
if (resultFromCache) {
|
|
35957
35976
|
resultFromCache.failedLookupLocations = updateResolutionField(resultFromCache.failedLookupLocations, failedLookupLocations);
|
|
@@ -36112,6 +36131,15 @@ function arePathsEqual(path1, path2, host) {
|
|
|
36112
36131
|
const useCaseSensitiveFileNames = typeof host.useCaseSensitiveFileNames === "function" ? host.useCaseSensitiveFileNames() : host.useCaseSensitiveFileNames;
|
|
36113
36132
|
return comparePaths(path1, path2, !useCaseSensitiveFileNames) === 0 /* EqualTo */;
|
|
36114
36133
|
}
|
|
36134
|
+
function getOriginalAndResolvedFileName(fileName, host, traceEnabled) {
|
|
36135
|
+
const resolvedFileName = realPath(fileName, host, traceEnabled);
|
|
36136
|
+
const pathsAreEqual = arePathsEqual(fileName, resolvedFileName, host);
|
|
36137
|
+
return {
|
|
36138
|
+
// If the fileName and realpath are differing only in casing prefer fileName so that we can issue correct errors for casing under forceConsistentCasingInFileNames
|
|
36139
|
+
resolvedFileName: pathsAreEqual ? fileName : resolvedFileName,
|
|
36140
|
+
originalPath: pathsAreEqual ? void 0 : fileName
|
|
36141
|
+
};
|
|
36142
|
+
}
|
|
36115
36143
|
function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFile, options, host, redirectedReference, cache, resolutionMode) {
|
|
36116
36144
|
Debug.assert(typeof typeReferenceDirectiveName === "string", "Non-string value passed to `ts.resolveTypeReferenceDirective`, likely by a wrapping package working with an outdated `resolveTypeReferenceDirectives` signature. This is probably not a problem in TS itself.");
|
|
36117
36145
|
const traceEnabled = isTraceEnabled(options, host);
|
|
@@ -36183,13 +36211,13 @@ function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFil
|
|
|
36183
36211
|
let resolvedTypeReferenceDirective;
|
|
36184
36212
|
if (resolved) {
|
|
36185
36213
|
const { fileName, packageId } = resolved;
|
|
36186
|
-
|
|
36187
|
-
|
|
36214
|
+
let resolvedFileName = fileName, originalPath;
|
|
36215
|
+
if (!options.preserveSymlinks)
|
|
36216
|
+
({ resolvedFileName, originalPath } = getOriginalAndResolvedFileName(fileName, host, traceEnabled));
|
|
36188
36217
|
resolvedTypeReferenceDirective = {
|
|
36189
36218
|
primary,
|
|
36190
|
-
|
|
36191
|
-
|
|
36192
|
-
originalPath: pathsAreEqual ? void 0 : fileName,
|
|
36219
|
+
resolvedFileName,
|
|
36220
|
+
originalPath,
|
|
36193
36221
|
packageId,
|
|
36194
36222
|
isExternalLibraryImport: pathContainsNodeModules(fileName)
|
|
36195
36223
|
};
|
|
@@ -37047,13 +37075,14 @@ function nodeModuleNameResolverWorker(features, moduleName, containingDirectory,
|
|
|
37047
37075
|
legacyResult = diagnosticResult.value.resolved.path;
|
|
37048
37076
|
}
|
|
37049
37077
|
}
|
|
37050
|
-
return
|
|
37078
|
+
return createResolvedModuleWithFailedLookupLocationsHandlingSymlink(
|
|
37079
|
+
moduleName,
|
|
37051
37080
|
(_c = result == null ? void 0 : result.value) == null ? void 0 : _c.resolved,
|
|
37052
37081
|
(_d = result == null ? void 0 : result.value) == null ? void 0 : _d.isExternalLibraryImport,
|
|
37053
37082
|
failedLookupLocations,
|
|
37054
37083
|
affectingLocations,
|
|
37055
37084
|
diagnostics,
|
|
37056
|
-
state
|
|
37085
|
+
state,
|
|
37057
37086
|
legacyResult
|
|
37058
37087
|
);
|
|
37059
37088
|
function tryResolve(extensions2, state2) {
|
|
@@ -37083,16 +37112,7 @@ function nodeModuleNameResolverWorker(features, moduleName, containingDirectory,
|
|
|
37083
37112
|
}
|
|
37084
37113
|
resolved2 = loadModuleFromNearestNodeModulesDirectory(extensions2, moduleName, containingDirectory, state2, cache, redirectedReference);
|
|
37085
37114
|
}
|
|
37086
|
-
|
|
37087
|
-
return void 0;
|
|
37088
|
-
let resolvedValue = resolved2.value;
|
|
37089
|
-
if (!compilerOptions.preserveSymlinks && resolvedValue && !resolvedValue.originalPath) {
|
|
37090
|
-
const path = realPath(resolvedValue.path, host, traceEnabled);
|
|
37091
|
-
const pathsAreEqual = arePathsEqual(path, resolvedValue.path, host);
|
|
37092
|
-
const originalPath = pathsAreEqual ? void 0 : resolvedValue.path;
|
|
37093
|
-
resolvedValue = { ...resolvedValue, path: pathsAreEqual ? resolvedValue.path : path, originalPath };
|
|
37094
|
-
}
|
|
37095
|
-
return { value: resolvedValue && { resolved: resolvedValue, isExternalLibraryImport: true } };
|
|
37115
|
+
return resolved2 && { value: resolved2.value && { resolved: resolved2.value, isExternalLibraryImport: true } };
|
|
37096
37116
|
} else {
|
|
37097
37117
|
const { path: candidate, parts } = normalizePathForCJSResolution(containingDirectory, moduleName);
|
|
37098
37118
|
const resolved2 = nodeLoadModuleByRelativeName(
|
|
@@ -38147,13 +38167,14 @@ function classicNameResolver(moduleName, containingFile, compilerOptions, host,
|
|
|
38147
38167
|
candidateIsFromPackageJsonField: false
|
|
38148
38168
|
};
|
|
38149
38169
|
const resolved = tryResolve(1 /* TypeScript */ | 4 /* Declaration */) || tryResolve(2 /* JavaScript */ | (compilerOptions.resolveJsonModule ? 8 /* Json */ : 0));
|
|
38150
|
-
return
|
|
38170
|
+
return createResolvedModuleWithFailedLookupLocationsHandlingSymlink(
|
|
38171
|
+
moduleName,
|
|
38151
38172
|
resolved && resolved.value,
|
|
38152
38173
|
(resolved == null ? void 0 : resolved.value) && pathContainsNodeModules(resolved.value.path),
|
|
38153
38174
|
failedLookupLocations,
|
|
38154
38175
|
affectingLocations,
|
|
38155
38176
|
diagnostics,
|
|
38156
|
-
state
|
|
38177
|
+
state
|
|
38157
38178
|
);
|
|
38158
38179
|
function tryResolve(extensions) {
|
|
38159
38180
|
const resolvedUsingSettings = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loadModuleFromFileNoPackageId, state);
|
|
@@ -44301,7 +44322,12 @@ function createTypeChecker(host) {
|
|
|
44301
44322
|
}
|
|
44302
44323
|
function resolveExportByName(moduleSymbol, name, sourceNode, dontResolveAlias) {
|
|
44303
44324
|
const exportValue = moduleSymbol.exports.get("export=" /* ExportEquals */);
|
|
44304
|
-
const exportSymbol = exportValue ? getPropertyOfType(
|
|
44325
|
+
const exportSymbol = exportValue ? getPropertyOfType(
|
|
44326
|
+
getTypeOfSymbol(exportValue),
|
|
44327
|
+
name,
|
|
44328
|
+
/*skipObjectFunctionPropertyAugment*/
|
|
44329
|
+
true
|
|
44330
|
+
) : moduleSymbol.exports.get(name);
|
|
44305
44331
|
const resolved = resolveSymbol(exportSymbol, dontResolveAlias);
|
|
44306
44332
|
markSymbolOfAliasDeclarationIfTypeOnly(
|
|
44307
44333
|
sourceNode,
|
|
@@ -53716,7 +53742,7 @@ function createTypeChecker(host) {
|
|
|
53716
53742
|
for (const tag of node.tags) {
|
|
53717
53743
|
if (isJSDocOverloadTag(tag)) {
|
|
53718
53744
|
const jsDocSignature = tag.typeExpression;
|
|
53719
|
-
if (jsDocSignature.type === void 0) {
|
|
53745
|
+
if (jsDocSignature.type === void 0 && !isConstructorDeclaration(decl)) {
|
|
53720
53746
|
reportImplicitAny(jsDocSignature, anyType);
|
|
53721
53747
|
}
|
|
53722
53748
|
result.push(getSignatureFromDeclaration(jsDocSignature));
|
|
@@ -53828,6 +53854,12 @@ function createTypeChecker(host) {
|
|
|
53828
53854
|
if (declaration.kind === 173 /* Constructor */) {
|
|
53829
53855
|
return getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol));
|
|
53830
53856
|
}
|
|
53857
|
+
if (isJSDocSignature(declaration)) {
|
|
53858
|
+
const root = getJSDocRoot(declaration);
|
|
53859
|
+
if (root && isConstructorDeclaration(root.parent)) {
|
|
53860
|
+
return getDeclaredTypeOfClassOrInterface(getMergedSymbol(root.parent.parent.symbol));
|
|
53861
|
+
}
|
|
53862
|
+
}
|
|
53831
53863
|
if (isJSDocConstructSignature(declaration)) {
|
|
53832
53864
|
return getTypeFromTypeNode(declaration.parameters[0].type);
|
|
53833
53865
|
}
|
|
@@ -55418,7 +55450,7 @@ function createTypeChecker(host) {
|
|
|
55418
55450
|
function typePredicateKindsMatch(a, b) {
|
|
55419
55451
|
return a.kind === b.kind && a.parameterIndex === b.parameterIndex;
|
|
55420
55452
|
}
|
|
55421
|
-
function getUnionTypeFromSortedList(types,
|
|
55453
|
+
function getUnionTypeFromSortedList(types, precomputedObjectFlags, aliasSymbol, aliasTypeArguments, origin) {
|
|
55422
55454
|
if (types.length === 0) {
|
|
55423
55455
|
return neverType;
|
|
55424
55456
|
}
|
|
@@ -55430,7 +55462,7 @@ function createTypeChecker(host) {
|
|
|
55430
55462
|
let type = unionTypes.get(id);
|
|
55431
55463
|
if (!type) {
|
|
55432
55464
|
type = createType(1048576 /* Union */);
|
|
55433
|
-
type.objectFlags =
|
|
55465
|
+
type.objectFlags = precomputedObjectFlags | getPropagatingFlagsOfTypes(
|
|
55434
55466
|
types,
|
|
55435
55467
|
/*excludeKinds*/
|
|
55436
55468
|
98304 /* Nullable */
|
|
@@ -58548,7 +58580,6 @@ function createTypeChecker(host) {
|
|
|
58548
58580
|
let overrideNextErrorInfo = 0;
|
|
58549
58581
|
let lastSkippedInfo;
|
|
58550
58582
|
let incompatibleStack;
|
|
58551
|
-
let inPropertyCheck = false;
|
|
58552
58583
|
Debug.assert(relation !== identityRelation || !errorNode, "no error reporting in identity checking");
|
|
58553
58584
|
const result = isRelatedTo(
|
|
58554
58585
|
source,
|
|
@@ -59507,14 +59538,15 @@ function createTypeChecker(host) {
|
|
|
59507
59538
|
);
|
|
59508
59539
|
}
|
|
59509
59540
|
}
|
|
59510
|
-
if (result2 && !
|
|
59511
|
-
inPropertyCheck = true;
|
|
59541
|
+
if (result2 && !(intersectionState & 2 /* Target */) && target2.flags & 2097152 /* Intersection */ && !isGenericObjectType(target2) && source2.flags & (524288 /* Object */ | 2097152 /* Intersection */)) {
|
|
59512
59542
|
result2 &= propertiesRelatedTo(
|
|
59513
59543
|
source2,
|
|
59514
59544
|
target2,
|
|
59515
59545
|
reportErrors2,
|
|
59516
59546
|
/*excludedProperties*/
|
|
59517
59547
|
void 0,
|
|
59548
|
+
/*optionalsOnly*/
|
|
59549
|
+
false,
|
|
59518
59550
|
0 /* None */
|
|
59519
59551
|
);
|
|
59520
59552
|
if (result2 && isObjectLiteralType(source2) && getObjectFlags(source2) & 8192 /* FreshLiteral */) {
|
|
@@ -59527,7 +59559,17 @@ function createTypeChecker(host) {
|
|
|
59527
59559
|
0 /* None */
|
|
59528
59560
|
);
|
|
59529
59561
|
}
|
|
59530
|
-
|
|
59562
|
+
} else if (result2 && isNonGenericObjectType(target2) && !isArrayOrTupleType(target2) && source2.flags & 2097152 /* Intersection */ && getApparentType(source2).flags & 3670016 /* StructuredType */ && !some(source2.types, (t) => !!(getObjectFlags(t) & 262144 /* NonInferrableType */))) {
|
|
59563
|
+
result2 &= propertiesRelatedTo(
|
|
59564
|
+
source2,
|
|
59565
|
+
target2,
|
|
59566
|
+
reportErrors2,
|
|
59567
|
+
/*excludedProperties*/
|
|
59568
|
+
void 0,
|
|
59569
|
+
/*optionalsOnly*/
|
|
59570
|
+
true,
|
|
59571
|
+
intersectionState
|
|
59572
|
+
);
|
|
59531
59573
|
}
|
|
59532
59574
|
}
|
|
59533
59575
|
if (result2) {
|
|
@@ -60017,12 +60059,14 @@ function createTypeChecker(host) {
|
|
|
60017
60059
|
reportStructuralErrors,
|
|
60018
60060
|
/*excludedProperties*/
|
|
60019
60061
|
void 0,
|
|
60062
|
+
/*optionalsOnly*/
|
|
60063
|
+
false,
|
|
60020
60064
|
intersectionState
|
|
60021
60065
|
);
|
|
60022
60066
|
if (result2) {
|
|
60023
|
-
result2 &= signaturesRelatedTo(source2, target2, 0 /* Call */, reportStructuralErrors);
|
|
60067
|
+
result2 &= signaturesRelatedTo(source2, target2, 0 /* Call */, reportStructuralErrors, intersectionState);
|
|
60024
60068
|
if (result2) {
|
|
60025
|
-
result2 &= signaturesRelatedTo(source2, target2, 1 /* Construct */, reportStructuralErrors);
|
|
60069
|
+
result2 &= signaturesRelatedTo(source2, target2, 1 /* Construct */, reportStructuralErrors, intersectionState);
|
|
60026
60070
|
if (result2) {
|
|
60027
60071
|
result2 &= indexSignaturesRelatedTo(source2, target2, sourceIsPrimitive, reportStructuralErrors, intersectionState);
|
|
60028
60072
|
}
|
|
@@ -60151,6 +60195,8 @@ function createTypeChecker(host) {
|
|
|
60151
60195
|
/*reportErrors*/
|
|
60152
60196
|
false,
|
|
60153
60197
|
excludedProperties,
|
|
60198
|
+
/*optionalsOnly*/
|
|
60199
|
+
false,
|
|
60154
60200
|
0 /* None */
|
|
60155
60201
|
);
|
|
60156
60202
|
if (result2) {
|
|
@@ -60159,7 +60205,8 @@ function createTypeChecker(host) {
|
|
|
60159
60205
|
type,
|
|
60160
60206
|
0 /* Call */,
|
|
60161
60207
|
/*reportStructuralErrors*/
|
|
60162
|
-
false
|
|
60208
|
+
false,
|
|
60209
|
+
0 /* None */
|
|
60163
60210
|
);
|
|
60164
60211
|
if (result2) {
|
|
60165
60212
|
result2 &= signaturesRelatedTo(
|
|
@@ -60167,7 +60214,8 @@ function createTypeChecker(host) {
|
|
|
60167
60214
|
type,
|
|
60168
60215
|
1 /* Construct */,
|
|
60169
60216
|
/*reportStructuralErrors*/
|
|
60170
|
-
false
|
|
60217
|
+
false,
|
|
60218
|
+
0 /* None */
|
|
60171
60219
|
);
|
|
60172
60220
|
if (result2 && !(isTupleType(source2) && isTupleType(type))) {
|
|
60173
60221
|
result2 &= indexSignaturesRelatedTo(
|
|
@@ -60345,7 +60393,7 @@ function createTypeChecker(host) {
|
|
|
60345
60393
|
}
|
|
60346
60394
|
}
|
|
60347
60395
|
}
|
|
60348
|
-
function propertiesRelatedTo(source2, target2, reportErrors2, excludedProperties, intersectionState) {
|
|
60396
|
+
function propertiesRelatedTo(source2, target2, reportErrors2, excludedProperties, optionalsOnly, intersectionState) {
|
|
60349
60397
|
if (relation === identityRelation) {
|
|
60350
60398
|
return propertiesIdenticalTo(source2, target2, excludedProperties);
|
|
60351
60399
|
}
|
|
@@ -60481,7 +60529,7 @@ function createTypeChecker(host) {
|
|
|
60481
60529
|
const numericNamesOnly = isTupleType(source2) && isTupleType(target2);
|
|
60482
60530
|
for (const targetProp of excludeProperties(properties, excludedProperties)) {
|
|
60483
60531
|
const name = targetProp.escapedName;
|
|
60484
|
-
if (!(targetProp.flags & 4194304 /* Prototype */) && (!numericNamesOnly || isNumericLiteralName(name) || name === "length")) {
|
|
60532
|
+
if (!(targetProp.flags & 4194304 /* Prototype */) && (!numericNamesOnly || isNumericLiteralName(name) || name === "length") && (!optionalsOnly || targetProp.flags & 16777216 /* Optional */)) {
|
|
60485
60533
|
const sourceProp = getPropertyOfType(source2, name);
|
|
60486
60534
|
if (sourceProp && sourceProp !== targetProp) {
|
|
60487
60535
|
const related = propertyRelatedTo(source2, target2, sourceProp, targetProp, getNonMissingTypeOfSymbol, reportErrors2, intersectionState, relation === comparableRelation);
|
|
@@ -60517,7 +60565,7 @@ function createTypeChecker(host) {
|
|
|
60517
60565
|
}
|
|
60518
60566
|
return result2;
|
|
60519
60567
|
}
|
|
60520
|
-
function signaturesRelatedTo(source2, target2, kind, reportErrors2) {
|
|
60568
|
+
function signaturesRelatedTo(source2, target2, kind, reportErrors2, intersectionState) {
|
|
60521
60569
|
var _a3, _b;
|
|
60522
60570
|
if (relation === identityRelation) {
|
|
60523
60571
|
return signaturesIdenticalTo(source2, target2, kind);
|
|
@@ -60554,6 +60602,7 @@ function createTypeChecker(host) {
|
|
|
60554
60602
|
/*erase*/
|
|
60555
60603
|
true,
|
|
60556
60604
|
reportErrors2,
|
|
60605
|
+
intersectionState,
|
|
60557
60606
|
incompatibleReporter(sourceSignatures[i], targetSignatures[i])
|
|
60558
60607
|
);
|
|
60559
60608
|
if (!related) {
|
|
@@ -60565,7 +60614,7 @@ function createTypeChecker(host) {
|
|
|
60565
60614
|
const eraseGenerics = relation === comparableRelation || !!compilerOptions.noStrictGenericChecks;
|
|
60566
60615
|
const sourceSignature = first(sourceSignatures);
|
|
60567
60616
|
const targetSignature = first(targetSignatures);
|
|
60568
|
-
result2 = signatureRelatedTo(sourceSignature, targetSignature, eraseGenerics, reportErrors2, incompatibleReporter(sourceSignature, targetSignature));
|
|
60617
|
+
result2 = signatureRelatedTo(sourceSignature, targetSignature, eraseGenerics, reportErrors2, intersectionState, incompatibleReporter(sourceSignature, targetSignature));
|
|
60569
60618
|
if (!result2 && reportErrors2 && kind === 1 /* Construct */ && sourceObjectFlags & targetObjectFlags && (((_a3 = targetSignature.declaration) == null ? void 0 : _a3.kind) === 173 /* Constructor */ || ((_b = sourceSignature.declaration) == null ? void 0 : _b.kind) === 173 /* Constructor */)) {
|
|
60570
60619
|
const constructSignatureToString = (signature) => signatureToString(
|
|
60571
60620
|
signature,
|
|
@@ -60590,6 +60639,7 @@ function createTypeChecker(host) {
|
|
|
60590
60639
|
/*erase*/
|
|
60591
60640
|
true,
|
|
60592
60641
|
shouldElaborateErrors,
|
|
60642
|
+
intersectionState,
|
|
60593
60643
|
incompatibleReporter(s, t)
|
|
60594
60644
|
);
|
|
60595
60645
|
if (related) {
|
|
@@ -60642,7 +60692,7 @@ function createTypeChecker(host) {
|
|
|
60642
60692
|
}
|
|
60643
60693
|
return (source2, target2) => reportIncompatibleError(Diagnostics.Construct_signature_return_types_0_and_1_are_incompatible, typeToString(source2), typeToString(target2));
|
|
60644
60694
|
}
|
|
60645
|
-
function signatureRelatedTo(source2, target2, erase, reportErrors2, incompatibleReporter) {
|
|
60695
|
+
function signatureRelatedTo(source2, target2, erase, reportErrors2, intersectionState, incompatibleReporter) {
|
|
60646
60696
|
return compareSignaturesRelated(
|
|
60647
60697
|
erase ? getErasedSignature(source2) : source2,
|
|
60648
60698
|
erase ? getErasedSignature(target2) : target2,
|
|
@@ -60650,9 +60700,20 @@ function createTypeChecker(host) {
|
|
|
60650
60700
|
reportErrors2,
|
|
60651
60701
|
reportError,
|
|
60652
60702
|
incompatibleReporter,
|
|
60653
|
-
|
|
60703
|
+
isRelatedToWorker2,
|
|
60654
60704
|
reportUnreliableMapper
|
|
60655
60705
|
);
|
|
60706
|
+
function isRelatedToWorker2(source3, target3, reportErrors3) {
|
|
60707
|
+
return isRelatedTo(
|
|
60708
|
+
source3,
|
|
60709
|
+
target3,
|
|
60710
|
+
3 /* Both */,
|
|
60711
|
+
reportErrors3,
|
|
60712
|
+
/*headMessage*/
|
|
60713
|
+
void 0,
|
|
60714
|
+
intersectionState
|
|
60715
|
+
);
|
|
60716
|
+
}
|
|
60656
60717
|
}
|
|
60657
60718
|
function signaturesIdenticalTo(source2, target2, kind) {
|
|
60658
60719
|
const sourceSignatures = getSignaturesOfType(source2, kind);
|
|
@@ -60711,7 +60772,7 @@ function createTypeChecker(host) {
|
|
|
60711
60772
|
}
|
|
60712
60773
|
for (const info of getIndexInfosOfType(source2)) {
|
|
60713
60774
|
if (isApplicableIndexType(info.keyType, keyType)) {
|
|
60714
|
-
const related = indexInfoRelatedTo(info, targetInfo, reportErrors2);
|
|
60775
|
+
const related = indexInfoRelatedTo(info, targetInfo, reportErrors2, intersectionState);
|
|
60715
60776
|
if (!related) {
|
|
60716
60777
|
return 0 /* False */;
|
|
60717
60778
|
}
|
|
@@ -60720,8 +60781,16 @@ function createTypeChecker(host) {
|
|
|
60720
60781
|
}
|
|
60721
60782
|
return result2;
|
|
60722
60783
|
}
|
|
60723
|
-
function indexInfoRelatedTo(sourceInfo, targetInfo, reportErrors2) {
|
|
60724
|
-
const related = isRelatedTo(
|
|
60784
|
+
function indexInfoRelatedTo(sourceInfo, targetInfo, reportErrors2, intersectionState) {
|
|
60785
|
+
const related = isRelatedTo(
|
|
60786
|
+
sourceInfo.type,
|
|
60787
|
+
targetInfo.type,
|
|
60788
|
+
3 /* Both */,
|
|
60789
|
+
reportErrors2,
|
|
60790
|
+
/*headMessage*/
|
|
60791
|
+
void 0,
|
|
60792
|
+
intersectionState
|
|
60793
|
+
);
|
|
60725
60794
|
if (!related && reportErrors2) {
|
|
60726
60795
|
if (sourceInfo.keyType === targetInfo.keyType) {
|
|
60727
60796
|
reportError(Diagnostics._0_index_signatures_are_incompatible, typeToString(sourceInfo.keyType));
|
|
@@ -60750,7 +60819,7 @@ function createTypeChecker(host) {
|
|
|
60750
60819
|
function typeRelatedToIndexInfo(source2, targetInfo, reportErrors2, intersectionState) {
|
|
60751
60820
|
const sourceInfo = getApplicableIndexInfo(source2, targetInfo.keyType);
|
|
60752
60821
|
if (sourceInfo) {
|
|
60753
|
-
return indexInfoRelatedTo(sourceInfo, targetInfo, reportErrors2);
|
|
60822
|
+
return indexInfoRelatedTo(sourceInfo, targetInfo, reportErrors2, intersectionState);
|
|
60754
60823
|
}
|
|
60755
60824
|
if (!(intersectionState & 1 /* Source */) && isObjectTypeWithInferableIndex(source2)) {
|
|
60756
60825
|
return membersRelatedToIndexInfo(source2, targetInfo, reportErrors2, intersectionState);
|
|
@@ -61041,12 +61110,15 @@ function createTypeChecker(host) {
|
|
|
61041
61110
|
}
|
|
61042
61111
|
function isDeeplyNestedType(type, stack, depth, maxDepth = 3) {
|
|
61043
61112
|
if (depth >= maxDepth) {
|
|
61113
|
+
if (type.flags & 2097152 /* Intersection */) {
|
|
61114
|
+
return some(type.types, (t) => isDeeplyNestedType(t, stack, depth, maxDepth));
|
|
61115
|
+
}
|
|
61044
61116
|
const identity2 = getRecursionIdentity(type);
|
|
61045
61117
|
let count = 0;
|
|
61046
61118
|
let lastTypeId = 0;
|
|
61047
61119
|
for (let i = 0; i < depth; i++) {
|
|
61048
61120
|
const t = stack[i];
|
|
61049
|
-
if (getRecursionIdentity(t) === identity2) {
|
|
61121
|
+
if (t.flags & 2097152 /* Intersection */ ? some(t.types, (u) => getRecursionIdentity(u) === identity2) : getRecursionIdentity(t) === identity2) {
|
|
61050
61122
|
if (t.id >= lastTypeId) {
|
|
61051
61123
|
count++;
|
|
61052
61124
|
if (count >= maxDepth) {
|
|
@@ -63414,7 +63486,7 @@ function createTypeChecker(host) {
|
|
|
63414
63486
|
}
|
|
63415
63487
|
return getUnionTypeFromSortedList(
|
|
63416
63488
|
filtered,
|
|
63417
|
-
type.objectFlags,
|
|
63489
|
+
type.objectFlags & (32768 /* PrimitiveUnion */ | 16777216 /* ContainsIntersections */),
|
|
63418
63490
|
/*aliasSymbol*/
|
|
63419
63491
|
void 0,
|
|
63420
63492
|
/*aliasTypeArguments*/
|
|
@@ -63921,7 +63993,7 @@ function createTypeChecker(host) {
|
|
|
63921
63993
|
}
|
|
63922
63994
|
return declaredType;
|
|
63923
63995
|
}
|
|
63924
|
-
if (isVariableDeclaration(node) && node.parent.parent.kind === 246 /* ForInStatement */ &&
|
|
63996
|
+
if (isVariableDeclaration(node) && node.parent.parent.kind === 246 /* ForInStatement */ && isMatchingReference(reference, node.parent.parent.expression)) {
|
|
63925
63997
|
return getNonNullableTypeIfNeeded(finalizeEvolvingArrayType(getTypeFromFlowType(getTypeAtFlowNode(flow.antecedent))));
|
|
63926
63998
|
}
|
|
63927
63999
|
return void 0;
|
|
@@ -70065,7 +70137,7 @@ function createTypeChecker(host) {
|
|
|
70065
70137
|
}
|
|
70066
70138
|
}
|
|
70067
70139
|
function checkCallExpression(node, checkMode) {
|
|
70068
|
-
var _a2;
|
|
70140
|
+
var _a2, _b, _c;
|
|
70069
70141
|
checkGrammarTypeArguments(node, node.typeArguments);
|
|
70070
70142
|
const signature = getResolvedSignature(
|
|
70071
70143
|
node,
|
|
@@ -70082,7 +70154,7 @@ function createTypeChecker(host) {
|
|
|
70082
70154
|
}
|
|
70083
70155
|
if (node.kind === 211 /* NewExpression */) {
|
|
70084
70156
|
const declaration = signature.declaration;
|
|
70085
|
-
if (declaration && declaration.kind !== 173 /* Constructor */ && declaration.kind !== 177 /* ConstructSignature */ && declaration.kind !== 182 /* ConstructorType */ && !isJSDocConstructSignature(declaration) && !isJSConstructor(declaration)) {
|
|
70157
|
+
if (declaration && declaration.kind !== 173 /* Constructor */ && declaration.kind !== 177 /* ConstructSignature */ && declaration.kind !== 182 /* ConstructorType */ && !(isJSDocSignature(declaration) && ((_b = (_a2 = getJSDocRoot(declaration)) == null ? void 0 : _a2.parent) == null ? void 0 : _b.kind) === 173 /* Constructor */) && !isJSDocConstructSignature(declaration) && !isJSConstructor(declaration)) {
|
|
70086
70158
|
if (noImplicitAny) {
|
|
70087
70159
|
error(node, Diagnostics.new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type);
|
|
70088
70160
|
}
|
|
@@ -70110,7 +70182,7 @@ function createTypeChecker(host) {
|
|
|
70110
70182
|
/*allowDeclaration*/
|
|
70111
70183
|
false
|
|
70112
70184
|
);
|
|
70113
|
-
if ((
|
|
70185
|
+
if ((_c = jsSymbol == null ? void 0 : jsSymbol.exports) == null ? void 0 : _c.size) {
|
|
70114
70186
|
const jsAssignmentType = createAnonymousType(jsSymbol, jsSymbol.exports, emptyArray, emptyArray, emptyArray);
|
|
70115
70187
|
jsAssignmentType.objectFlags |= 4096 /* JSLiteral */;
|
|
70116
70188
|
return getIntersectionType([returnType, jsAssignmentType]);
|
|
@@ -73037,7 +73109,7 @@ function createTypeChecker(host) {
|
|
|
73037
73109
|
return isCallChain(expr) ? getReturnTypeOfSingleNonGenericSignatureOfCallChain(expr) : getReturnTypeOfSingleNonGenericCallSignature(checkNonNullExpression(expr.expression));
|
|
73038
73110
|
} else if (isAssertionExpression(expr) && !isConstTypeReference(expr.type)) {
|
|
73039
73111
|
return getTypeFromTypeNode(expr.type);
|
|
73040
|
-
} else if (node
|
|
73112
|
+
} else if (isLiteralExpression(node) || isBooleanLiteral(node)) {
|
|
73041
73113
|
return checkExpression(node);
|
|
73042
73114
|
}
|
|
73043
73115
|
return void 0;
|
|
@@ -103891,7 +103963,7 @@ function transformDeclarations(context) {
|
|
|
103891
103963
|
if (elem.kind === 229 /* OmittedExpression */) {
|
|
103892
103964
|
return elem;
|
|
103893
103965
|
}
|
|
103894
|
-
if (elem.propertyName && isIdentifier(elem.propertyName) && isIdentifier(elem.name) && !elem.symbol.isReferenced) {
|
|
103966
|
+
if (elem.propertyName && isIdentifier(elem.propertyName) && isIdentifier(elem.name) && !elem.symbol.isReferenced && !isIdentifierANonContextualKeyword(elem.propertyName)) {
|
|
103895
103967
|
return factory2.updateBindingElement(
|
|
103896
103968
|
elem,
|
|
103897
103969
|
elem.dotDotDotToken,
|