@typescript-deploys/pr-build 5.0.0-pr-52059-5 → 5.0.0-pr-52617-10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/tsc.js +129 -63
- package/lib/tsserver.js +2893 -2810
- package/lib/tsserverlibrary.d.ts +16 -0
- package/lib/tsserverlibrary.js +162 -80
- package/lib/typescript.d.ts +16 -0
- package/lib/typescript.js +158 -77
- package/lib/typingsInstaller.js +33 -16
- 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.20230205`;
|
|
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}'."),
|
|
@@ -10711,6 +10710,9 @@ function isFunctionLikeOrClassStaticBlockDeclaration(node) {
|
|
|
10711
10710
|
function isFunctionLikeDeclaration(node) {
|
|
10712
10711
|
return node && isFunctionLikeDeclarationKind(node.kind);
|
|
10713
10712
|
}
|
|
10713
|
+
function isBooleanLiteral(node) {
|
|
10714
|
+
return node.kind === 110 /* TrueKeyword */ || node.kind === 95 /* FalseKeyword */;
|
|
10715
|
+
}
|
|
10714
10716
|
function isFunctionLikeDeclarationKind(kind) {
|
|
10715
10717
|
switch (kind) {
|
|
10716
10718
|
case 259 /* FunctionDeclaration */:
|
|
@@ -35952,6 +35954,22 @@ function resolvedTypeScriptOnly(resolved) {
|
|
|
35952
35954
|
Debug.assert(extensionIsTS(resolved.extension));
|
|
35953
35955
|
return { fileName: resolved.path, packageId: resolved.packageId };
|
|
35954
35956
|
}
|
|
35957
|
+
function createResolvedModuleWithFailedLookupLocationsHandlingSymlink(moduleName, resolved, isExternalLibraryImport, failedLookupLocations, affectingLocations, diagnostics, state, legacyResult) {
|
|
35958
|
+
if (!state.resultFromCache && !state.compilerOptions.preserveSymlinks && resolved && isExternalLibraryImport && !resolved.originalPath && !isExternalModuleNameRelative(moduleName)) {
|
|
35959
|
+
const { resolvedFileName, originalPath } = getOriginalAndResolvedFileName(resolved.path, state.host, state.traceEnabled);
|
|
35960
|
+
if (originalPath)
|
|
35961
|
+
resolved = { ...resolved, path: resolvedFileName, originalPath };
|
|
35962
|
+
}
|
|
35963
|
+
return createResolvedModuleWithFailedLookupLocations(
|
|
35964
|
+
resolved,
|
|
35965
|
+
isExternalLibraryImport,
|
|
35966
|
+
failedLookupLocations,
|
|
35967
|
+
affectingLocations,
|
|
35968
|
+
diagnostics,
|
|
35969
|
+
state.resultFromCache,
|
|
35970
|
+
legacyResult
|
|
35971
|
+
);
|
|
35972
|
+
}
|
|
35955
35973
|
function createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations, affectingLocations, diagnostics, resultFromCache, legacyResult) {
|
|
35956
35974
|
if (resultFromCache) {
|
|
35957
35975
|
resultFromCache.failedLookupLocations = updateResolutionField(resultFromCache.failedLookupLocations, failedLookupLocations);
|
|
@@ -36112,6 +36130,15 @@ function arePathsEqual(path1, path2, host) {
|
|
|
36112
36130
|
const useCaseSensitiveFileNames = typeof host.useCaseSensitiveFileNames === "function" ? host.useCaseSensitiveFileNames() : host.useCaseSensitiveFileNames;
|
|
36113
36131
|
return comparePaths(path1, path2, !useCaseSensitiveFileNames) === 0 /* EqualTo */;
|
|
36114
36132
|
}
|
|
36133
|
+
function getOriginalAndResolvedFileName(fileName, host, traceEnabled) {
|
|
36134
|
+
const resolvedFileName = realPath(fileName, host, traceEnabled);
|
|
36135
|
+
const pathsAreEqual = arePathsEqual(fileName, resolvedFileName, host);
|
|
36136
|
+
return {
|
|
36137
|
+
// If the fileName and realpath are differing only in casing prefer fileName so that we can issue correct errors for casing under forceConsistentCasingInFileNames
|
|
36138
|
+
resolvedFileName: pathsAreEqual ? fileName : resolvedFileName,
|
|
36139
|
+
originalPath: pathsAreEqual ? void 0 : fileName
|
|
36140
|
+
};
|
|
36141
|
+
}
|
|
36115
36142
|
function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFile, options, host, redirectedReference, cache, resolutionMode) {
|
|
36116
36143
|
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
36144
|
const traceEnabled = isTraceEnabled(options, host);
|
|
@@ -36183,13 +36210,13 @@ function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFil
|
|
|
36183
36210
|
let resolvedTypeReferenceDirective;
|
|
36184
36211
|
if (resolved) {
|
|
36185
36212
|
const { fileName, packageId } = resolved;
|
|
36186
|
-
|
|
36187
|
-
|
|
36213
|
+
let resolvedFileName = fileName, originalPath;
|
|
36214
|
+
if (!options.preserveSymlinks)
|
|
36215
|
+
({ resolvedFileName, originalPath } = getOriginalAndResolvedFileName(fileName, host, traceEnabled));
|
|
36188
36216
|
resolvedTypeReferenceDirective = {
|
|
36189
36217
|
primary,
|
|
36190
|
-
|
|
36191
|
-
|
|
36192
|
-
originalPath: pathsAreEqual ? void 0 : fileName,
|
|
36218
|
+
resolvedFileName,
|
|
36219
|
+
originalPath,
|
|
36193
36220
|
packageId,
|
|
36194
36221
|
isExternalLibraryImport: pathContainsNodeModules(fileName)
|
|
36195
36222
|
};
|
|
@@ -37047,13 +37074,14 @@ function nodeModuleNameResolverWorker(features, moduleName, containingDirectory,
|
|
|
37047
37074
|
legacyResult = diagnosticResult.value.resolved.path;
|
|
37048
37075
|
}
|
|
37049
37076
|
}
|
|
37050
|
-
return
|
|
37077
|
+
return createResolvedModuleWithFailedLookupLocationsHandlingSymlink(
|
|
37078
|
+
moduleName,
|
|
37051
37079
|
(_c = result == null ? void 0 : result.value) == null ? void 0 : _c.resolved,
|
|
37052
37080
|
(_d = result == null ? void 0 : result.value) == null ? void 0 : _d.isExternalLibraryImport,
|
|
37053
37081
|
failedLookupLocations,
|
|
37054
37082
|
affectingLocations,
|
|
37055
37083
|
diagnostics,
|
|
37056
|
-
state
|
|
37084
|
+
state,
|
|
37057
37085
|
legacyResult
|
|
37058
37086
|
);
|
|
37059
37087
|
function tryResolve(extensions2, state2) {
|
|
@@ -37083,16 +37111,7 @@ function nodeModuleNameResolverWorker(features, moduleName, containingDirectory,
|
|
|
37083
37111
|
}
|
|
37084
37112
|
resolved2 = loadModuleFromNearestNodeModulesDirectory(extensions2, moduleName, containingDirectory, state2, cache, redirectedReference);
|
|
37085
37113
|
}
|
|
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 } };
|
|
37114
|
+
return resolved2 && { value: resolved2.value && { resolved: resolved2.value, isExternalLibraryImport: true } };
|
|
37096
37115
|
} else {
|
|
37097
37116
|
const { path: candidate, parts } = normalizePathForCJSResolution(containingDirectory, moduleName);
|
|
37098
37117
|
const resolved2 = nodeLoadModuleByRelativeName(
|
|
@@ -38147,13 +38166,14 @@ function classicNameResolver(moduleName, containingFile, compilerOptions, host,
|
|
|
38147
38166
|
candidateIsFromPackageJsonField: false
|
|
38148
38167
|
};
|
|
38149
38168
|
const resolved = tryResolve(1 /* TypeScript */ | 4 /* Declaration */) || tryResolve(2 /* JavaScript */ | (compilerOptions.resolveJsonModule ? 8 /* Json */ : 0));
|
|
38150
|
-
return
|
|
38169
|
+
return createResolvedModuleWithFailedLookupLocationsHandlingSymlink(
|
|
38170
|
+
moduleName,
|
|
38151
38171
|
resolved && resolved.value,
|
|
38152
38172
|
(resolved == null ? void 0 : resolved.value) && pathContainsNodeModules(resolved.value.path),
|
|
38153
38173
|
failedLookupLocations,
|
|
38154
38174
|
affectingLocations,
|
|
38155
38175
|
diagnostics,
|
|
38156
|
-
state
|
|
38176
|
+
state
|
|
38157
38177
|
);
|
|
38158
38178
|
function tryResolve(extensions) {
|
|
38159
38179
|
const resolvedUsingSettings = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loadModuleFromFileNoPackageId, state);
|
|
@@ -42479,6 +42499,7 @@ function createTypeChecker(host) {
|
|
|
42479
42499
|
isArrayType,
|
|
42480
42500
|
isTupleType,
|
|
42481
42501
|
isArrayLikeType,
|
|
42502
|
+
isEmptyAnonymousObjectType,
|
|
42482
42503
|
isTypeInvalidDueToUnionDiscriminant,
|
|
42483
42504
|
getExactOptionalProperties,
|
|
42484
42505
|
getAllPossiblePropertiesOfTypes,
|
|
@@ -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,
|
|
@@ -45336,12 +45362,9 @@ function createTypeChecker(host) {
|
|
|
45336
45362
|
if (resolutionDiagnostic) {
|
|
45337
45363
|
error(errorNode, resolutionDiagnostic, moduleReference, resolvedModule.resolvedFileName);
|
|
45338
45364
|
} else {
|
|
45339
|
-
const tsExtension = tryExtractTSExtension(moduleReference);
|
|
45340
45365
|
const isExtensionlessRelativePathImport = pathIsRelative(moduleReference) && !hasExtension(moduleReference);
|
|
45341
45366
|
const resolutionIsNode16OrNext = moduleResolutionKind === 3 /* Node16 */ || moduleResolutionKind === 99 /* NodeNext */;
|
|
45342
|
-
if (
|
|
45343
|
-
errorOnTSExtensionImport(tsExtension);
|
|
45344
|
-
} else if (!getResolveJsonModule(compilerOptions) && fileExtensionIs(moduleReference, ".json" /* Json */) && moduleResolutionKind !== 1 /* Classic */ && hasJsonModuleEmitEnabled(compilerOptions)) {
|
|
45367
|
+
if (!getResolveJsonModule(compilerOptions) && fileExtensionIs(moduleReference, ".json" /* Json */) && moduleResolutionKind !== 1 /* Classic */ && hasJsonModuleEmitEnabled(compilerOptions)) {
|
|
45345
45368
|
error(errorNode, Diagnostics.Cannot_find_module_0_Consider_using_resolveJsonModule_to_import_module_with_json_extension, moduleReference);
|
|
45346
45369
|
} else if (mode === 99 /* ESNext */ && resolutionIsNode16OrNext && isExtensionlessRelativePathImport) {
|
|
45347
45370
|
const absoluteRef = getNormalizedAbsolutePath(moduleReference, getDirectoryPath(currentSourceFile.path));
|
|
@@ -45361,10 +45384,6 @@ function createTypeChecker(host) {
|
|
|
45361
45384
|
}
|
|
45362
45385
|
}
|
|
45363
45386
|
return void 0;
|
|
45364
|
-
function errorOnTSExtensionImport(tsExtension) {
|
|
45365
|
-
const diag2 = Diagnostics.An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead;
|
|
45366
|
-
error(errorNode, diag2, tsExtension, getSuggestedImportSource(tsExtension));
|
|
45367
|
-
}
|
|
45368
45387
|
function getSuggestedImportSource(tsExtension) {
|
|
45369
45388
|
const importSourceWithoutExtension = removeExtension(moduleReference, tsExtension);
|
|
45370
45389
|
if (emitModuleKindIsNonNodeESM(moduleKind) || mode === 99 /* ESNext */) {
|
|
@@ -53716,7 +53735,7 @@ function createTypeChecker(host) {
|
|
|
53716
53735
|
for (const tag of node.tags) {
|
|
53717
53736
|
if (isJSDocOverloadTag(tag)) {
|
|
53718
53737
|
const jsDocSignature = tag.typeExpression;
|
|
53719
|
-
if (jsDocSignature.type === void 0) {
|
|
53738
|
+
if (jsDocSignature.type === void 0 && !isConstructorDeclaration(decl)) {
|
|
53720
53739
|
reportImplicitAny(jsDocSignature, anyType);
|
|
53721
53740
|
}
|
|
53722
53741
|
result.push(getSignatureFromDeclaration(jsDocSignature));
|
|
@@ -53828,6 +53847,12 @@ function createTypeChecker(host) {
|
|
|
53828
53847
|
if (declaration.kind === 173 /* Constructor */) {
|
|
53829
53848
|
return getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol));
|
|
53830
53849
|
}
|
|
53850
|
+
if (isJSDocSignature(declaration)) {
|
|
53851
|
+
const root = getJSDocRoot(declaration);
|
|
53852
|
+
if (root && isConstructorDeclaration(root.parent)) {
|
|
53853
|
+
return getDeclaredTypeOfClassOrInterface(getMergedSymbol(root.parent.parent.symbol));
|
|
53854
|
+
}
|
|
53855
|
+
}
|
|
53831
53856
|
if (isJSDocConstructSignature(declaration)) {
|
|
53832
53857
|
return getTypeFromTypeNode(declaration.parameters[0].type);
|
|
53833
53858
|
}
|
|
@@ -54356,7 +54381,7 @@ function createTypeChecker(host) {
|
|
|
54356
54381
|
return links.resolvedJSDocType;
|
|
54357
54382
|
}
|
|
54358
54383
|
function getSubstitutionType(baseType, constraint) {
|
|
54359
|
-
if (constraint.flags & 3 /* AnyOrUnknown */ || constraint === baseType) {
|
|
54384
|
+
if (constraint.flags & 3 /* AnyOrUnknown */ || constraint === baseType || baseType.flags & 1 /* Any */) {
|
|
54360
54385
|
return baseType;
|
|
54361
54386
|
}
|
|
54362
54387
|
const id = `${getTypeId(baseType)}>${getTypeId(constraint)}`;
|
|
@@ -55418,7 +55443,7 @@ function createTypeChecker(host) {
|
|
|
55418
55443
|
function typePredicateKindsMatch(a, b) {
|
|
55419
55444
|
return a.kind === b.kind && a.parameterIndex === b.parameterIndex;
|
|
55420
55445
|
}
|
|
55421
|
-
function getUnionTypeFromSortedList(types,
|
|
55446
|
+
function getUnionTypeFromSortedList(types, precomputedObjectFlags, aliasSymbol, aliasTypeArguments, origin) {
|
|
55422
55447
|
if (types.length === 0) {
|
|
55423
55448
|
return neverType;
|
|
55424
55449
|
}
|
|
@@ -55430,7 +55455,7 @@ function createTypeChecker(host) {
|
|
|
55430
55455
|
let type = unionTypes.get(id);
|
|
55431
55456
|
if (!type) {
|
|
55432
55457
|
type = createType(1048576 /* Union */);
|
|
55433
|
-
type.objectFlags =
|
|
55458
|
+
type.objectFlags = precomputedObjectFlags | getPropagatingFlagsOfTypes(
|
|
55434
55459
|
types,
|
|
55435
55460
|
/*excludeKinds*/
|
|
55436
55461
|
98304 /* Nullable */
|
|
@@ -56043,7 +56068,7 @@ function createTypeChecker(host) {
|
|
|
56043
56068
|
}
|
|
56044
56069
|
}
|
|
56045
56070
|
const propType = getTypeOfSymbol(prop);
|
|
56046
|
-
return accessExpression && getAssignmentTargetKind(accessExpression) !== 1 /* Definite */ ? getFlowTypeOfReference(accessExpression, propType) : propType;
|
|
56071
|
+
return accessExpression && getAssignmentTargetKind(accessExpression) !== 1 /* Definite */ ? getFlowTypeOfReference(accessExpression, propType) : accessNode && isIndexedAccessTypeNode(accessNode) && containsMissingType(propType) ? getUnionType([propType, undefinedType]) : propType;
|
|
56047
56072
|
}
|
|
56048
56073
|
if (everyType(objectType, isTupleType) && isNumericLiteralName(propName)) {
|
|
56049
56074
|
const index = +propName;
|
|
@@ -58548,7 +58573,6 @@ function createTypeChecker(host) {
|
|
|
58548
58573
|
let overrideNextErrorInfo = 0;
|
|
58549
58574
|
let lastSkippedInfo;
|
|
58550
58575
|
let incompatibleStack;
|
|
58551
|
-
let inPropertyCheck = false;
|
|
58552
58576
|
Debug.assert(relation !== identityRelation || !errorNode, "no error reporting in identity checking");
|
|
58553
58577
|
const result = isRelatedTo(
|
|
58554
58578
|
source,
|
|
@@ -59507,14 +59531,15 @@ function createTypeChecker(host) {
|
|
|
59507
59531
|
);
|
|
59508
59532
|
}
|
|
59509
59533
|
}
|
|
59510
|
-
if (result2 && !
|
|
59511
|
-
inPropertyCheck = true;
|
|
59534
|
+
if (result2 && !(intersectionState & 2 /* Target */) && target2.flags & 2097152 /* Intersection */ && !isGenericObjectType(target2) && source2.flags & (524288 /* Object */ | 2097152 /* Intersection */)) {
|
|
59512
59535
|
result2 &= propertiesRelatedTo(
|
|
59513
59536
|
source2,
|
|
59514
59537
|
target2,
|
|
59515
59538
|
reportErrors2,
|
|
59516
59539
|
/*excludedProperties*/
|
|
59517
59540
|
void 0,
|
|
59541
|
+
/*optionalsOnly*/
|
|
59542
|
+
false,
|
|
59518
59543
|
0 /* None */
|
|
59519
59544
|
);
|
|
59520
59545
|
if (result2 && isObjectLiteralType(source2) && getObjectFlags(source2) & 8192 /* FreshLiteral */) {
|
|
@@ -59527,7 +59552,17 @@ function createTypeChecker(host) {
|
|
|
59527
59552
|
0 /* None */
|
|
59528
59553
|
);
|
|
59529
59554
|
}
|
|
59530
|
-
|
|
59555
|
+
} else if (result2 && isNonGenericObjectType(target2) && !isArrayOrTupleType(target2) && source2.flags & 2097152 /* Intersection */ && getApparentType(source2).flags & 3670016 /* StructuredType */ && !some(source2.types, (t) => !!(getObjectFlags(t) & 262144 /* NonInferrableType */))) {
|
|
59556
|
+
result2 &= propertiesRelatedTo(
|
|
59557
|
+
source2,
|
|
59558
|
+
target2,
|
|
59559
|
+
reportErrors2,
|
|
59560
|
+
/*excludedProperties*/
|
|
59561
|
+
void 0,
|
|
59562
|
+
/*optionalsOnly*/
|
|
59563
|
+
true,
|
|
59564
|
+
intersectionState
|
|
59565
|
+
);
|
|
59531
59566
|
}
|
|
59532
59567
|
}
|
|
59533
59568
|
if (result2) {
|
|
@@ -60017,12 +60052,14 @@ function createTypeChecker(host) {
|
|
|
60017
60052
|
reportStructuralErrors,
|
|
60018
60053
|
/*excludedProperties*/
|
|
60019
60054
|
void 0,
|
|
60055
|
+
/*optionalsOnly*/
|
|
60056
|
+
false,
|
|
60020
60057
|
intersectionState
|
|
60021
60058
|
);
|
|
60022
60059
|
if (result2) {
|
|
60023
|
-
result2 &= signaturesRelatedTo(source2, target2, 0 /* Call */, reportStructuralErrors);
|
|
60060
|
+
result2 &= signaturesRelatedTo(source2, target2, 0 /* Call */, reportStructuralErrors, intersectionState);
|
|
60024
60061
|
if (result2) {
|
|
60025
|
-
result2 &= signaturesRelatedTo(source2, target2, 1 /* Construct */, reportStructuralErrors);
|
|
60062
|
+
result2 &= signaturesRelatedTo(source2, target2, 1 /* Construct */, reportStructuralErrors, intersectionState);
|
|
60026
60063
|
if (result2) {
|
|
60027
60064
|
result2 &= indexSignaturesRelatedTo(source2, target2, sourceIsPrimitive, reportStructuralErrors, intersectionState);
|
|
60028
60065
|
}
|
|
@@ -60151,6 +60188,8 @@ function createTypeChecker(host) {
|
|
|
60151
60188
|
/*reportErrors*/
|
|
60152
60189
|
false,
|
|
60153
60190
|
excludedProperties,
|
|
60191
|
+
/*optionalsOnly*/
|
|
60192
|
+
false,
|
|
60154
60193
|
0 /* None */
|
|
60155
60194
|
);
|
|
60156
60195
|
if (result2) {
|
|
@@ -60159,7 +60198,8 @@ function createTypeChecker(host) {
|
|
|
60159
60198
|
type,
|
|
60160
60199
|
0 /* Call */,
|
|
60161
60200
|
/*reportStructuralErrors*/
|
|
60162
|
-
false
|
|
60201
|
+
false,
|
|
60202
|
+
0 /* None */
|
|
60163
60203
|
);
|
|
60164
60204
|
if (result2) {
|
|
60165
60205
|
result2 &= signaturesRelatedTo(
|
|
@@ -60167,7 +60207,8 @@ function createTypeChecker(host) {
|
|
|
60167
60207
|
type,
|
|
60168
60208
|
1 /* Construct */,
|
|
60169
60209
|
/*reportStructuralErrors*/
|
|
60170
|
-
false
|
|
60210
|
+
false,
|
|
60211
|
+
0 /* None */
|
|
60171
60212
|
);
|
|
60172
60213
|
if (result2 && !(isTupleType(source2) && isTupleType(type))) {
|
|
60173
60214
|
result2 &= indexSignaturesRelatedTo(
|
|
@@ -60345,7 +60386,7 @@ function createTypeChecker(host) {
|
|
|
60345
60386
|
}
|
|
60346
60387
|
}
|
|
60347
60388
|
}
|
|
60348
|
-
function propertiesRelatedTo(source2, target2, reportErrors2, excludedProperties, intersectionState) {
|
|
60389
|
+
function propertiesRelatedTo(source2, target2, reportErrors2, excludedProperties, optionalsOnly, intersectionState) {
|
|
60349
60390
|
if (relation === identityRelation) {
|
|
60350
60391
|
return propertiesIdenticalTo(source2, target2, excludedProperties);
|
|
60351
60392
|
}
|
|
@@ -60481,7 +60522,7 @@ function createTypeChecker(host) {
|
|
|
60481
60522
|
const numericNamesOnly = isTupleType(source2) && isTupleType(target2);
|
|
60482
60523
|
for (const targetProp of excludeProperties(properties, excludedProperties)) {
|
|
60483
60524
|
const name = targetProp.escapedName;
|
|
60484
|
-
if (!(targetProp.flags & 4194304 /* Prototype */) && (!numericNamesOnly || isNumericLiteralName(name) || name === "length")) {
|
|
60525
|
+
if (!(targetProp.flags & 4194304 /* Prototype */) && (!numericNamesOnly || isNumericLiteralName(name) || name === "length") && (!optionalsOnly || targetProp.flags & 16777216 /* Optional */)) {
|
|
60485
60526
|
const sourceProp = getPropertyOfType(source2, name);
|
|
60486
60527
|
if (sourceProp && sourceProp !== targetProp) {
|
|
60487
60528
|
const related = propertyRelatedTo(source2, target2, sourceProp, targetProp, getNonMissingTypeOfSymbol, reportErrors2, intersectionState, relation === comparableRelation);
|
|
@@ -60517,7 +60558,7 @@ function createTypeChecker(host) {
|
|
|
60517
60558
|
}
|
|
60518
60559
|
return result2;
|
|
60519
60560
|
}
|
|
60520
|
-
function signaturesRelatedTo(source2, target2, kind, reportErrors2) {
|
|
60561
|
+
function signaturesRelatedTo(source2, target2, kind, reportErrors2, intersectionState) {
|
|
60521
60562
|
var _a3, _b;
|
|
60522
60563
|
if (relation === identityRelation) {
|
|
60523
60564
|
return signaturesIdenticalTo(source2, target2, kind);
|
|
@@ -60554,6 +60595,7 @@ function createTypeChecker(host) {
|
|
|
60554
60595
|
/*erase*/
|
|
60555
60596
|
true,
|
|
60556
60597
|
reportErrors2,
|
|
60598
|
+
intersectionState,
|
|
60557
60599
|
incompatibleReporter(sourceSignatures[i], targetSignatures[i])
|
|
60558
60600
|
);
|
|
60559
60601
|
if (!related) {
|
|
@@ -60565,7 +60607,7 @@ function createTypeChecker(host) {
|
|
|
60565
60607
|
const eraseGenerics = relation === comparableRelation || !!compilerOptions.noStrictGenericChecks;
|
|
60566
60608
|
const sourceSignature = first(sourceSignatures);
|
|
60567
60609
|
const targetSignature = first(targetSignatures);
|
|
60568
|
-
result2 = signatureRelatedTo(sourceSignature, targetSignature, eraseGenerics, reportErrors2, incompatibleReporter(sourceSignature, targetSignature));
|
|
60610
|
+
result2 = signatureRelatedTo(sourceSignature, targetSignature, eraseGenerics, reportErrors2, intersectionState, incompatibleReporter(sourceSignature, targetSignature));
|
|
60569
60611
|
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
60612
|
const constructSignatureToString = (signature) => signatureToString(
|
|
60571
60613
|
signature,
|
|
@@ -60590,6 +60632,7 @@ function createTypeChecker(host) {
|
|
|
60590
60632
|
/*erase*/
|
|
60591
60633
|
true,
|
|
60592
60634
|
shouldElaborateErrors,
|
|
60635
|
+
intersectionState,
|
|
60593
60636
|
incompatibleReporter(s, t)
|
|
60594
60637
|
);
|
|
60595
60638
|
if (related) {
|
|
@@ -60642,7 +60685,7 @@ function createTypeChecker(host) {
|
|
|
60642
60685
|
}
|
|
60643
60686
|
return (source2, target2) => reportIncompatibleError(Diagnostics.Construct_signature_return_types_0_and_1_are_incompatible, typeToString(source2), typeToString(target2));
|
|
60644
60687
|
}
|
|
60645
|
-
function signatureRelatedTo(source2, target2, erase, reportErrors2, incompatibleReporter) {
|
|
60688
|
+
function signatureRelatedTo(source2, target2, erase, reportErrors2, intersectionState, incompatibleReporter) {
|
|
60646
60689
|
return compareSignaturesRelated(
|
|
60647
60690
|
erase ? getErasedSignature(source2) : source2,
|
|
60648
60691
|
erase ? getErasedSignature(target2) : target2,
|
|
@@ -60650,9 +60693,20 @@ function createTypeChecker(host) {
|
|
|
60650
60693
|
reportErrors2,
|
|
60651
60694
|
reportError,
|
|
60652
60695
|
incompatibleReporter,
|
|
60653
|
-
|
|
60696
|
+
isRelatedToWorker2,
|
|
60654
60697
|
reportUnreliableMapper
|
|
60655
60698
|
);
|
|
60699
|
+
function isRelatedToWorker2(source3, target3, reportErrors3) {
|
|
60700
|
+
return isRelatedTo(
|
|
60701
|
+
source3,
|
|
60702
|
+
target3,
|
|
60703
|
+
3 /* Both */,
|
|
60704
|
+
reportErrors3,
|
|
60705
|
+
/*headMessage*/
|
|
60706
|
+
void 0,
|
|
60707
|
+
intersectionState
|
|
60708
|
+
);
|
|
60709
|
+
}
|
|
60656
60710
|
}
|
|
60657
60711
|
function signaturesIdenticalTo(source2, target2, kind) {
|
|
60658
60712
|
const sourceSignatures = getSignaturesOfType(source2, kind);
|
|
@@ -60711,7 +60765,7 @@ function createTypeChecker(host) {
|
|
|
60711
60765
|
}
|
|
60712
60766
|
for (const info of getIndexInfosOfType(source2)) {
|
|
60713
60767
|
if (isApplicableIndexType(info.keyType, keyType)) {
|
|
60714
|
-
const related = indexInfoRelatedTo(info, targetInfo, reportErrors2);
|
|
60768
|
+
const related = indexInfoRelatedTo(info, targetInfo, reportErrors2, intersectionState);
|
|
60715
60769
|
if (!related) {
|
|
60716
60770
|
return 0 /* False */;
|
|
60717
60771
|
}
|
|
@@ -60720,8 +60774,16 @@ function createTypeChecker(host) {
|
|
|
60720
60774
|
}
|
|
60721
60775
|
return result2;
|
|
60722
60776
|
}
|
|
60723
|
-
function indexInfoRelatedTo(sourceInfo, targetInfo, reportErrors2) {
|
|
60724
|
-
const related = isRelatedTo(
|
|
60777
|
+
function indexInfoRelatedTo(sourceInfo, targetInfo, reportErrors2, intersectionState) {
|
|
60778
|
+
const related = isRelatedTo(
|
|
60779
|
+
sourceInfo.type,
|
|
60780
|
+
targetInfo.type,
|
|
60781
|
+
3 /* Both */,
|
|
60782
|
+
reportErrors2,
|
|
60783
|
+
/*headMessage*/
|
|
60784
|
+
void 0,
|
|
60785
|
+
intersectionState
|
|
60786
|
+
);
|
|
60725
60787
|
if (!related && reportErrors2) {
|
|
60726
60788
|
if (sourceInfo.keyType === targetInfo.keyType) {
|
|
60727
60789
|
reportError(Diagnostics._0_index_signatures_are_incompatible, typeToString(sourceInfo.keyType));
|
|
@@ -60750,7 +60812,7 @@ function createTypeChecker(host) {
|
|
|
60750
60812
|
function typeRelatedToIndexInfo(source2, targetInfo, reportErrors2, intersectionState) {
|
|
60751
60813
|
const sourceInfo = getApplicableIndexInfo(source2, targetInfo.keyType);
|
|
60752
60814
|
if (sourceInfo) {
|
|
60753
|
-
return indexInfoRelatedTo(sourceInfo, targetInfo, reportErrors2);
|
|
60815
|
+
return indexInfoRelatedTo(sourceInfo, targetInfo, reportErrors2, intersectionState);
|
|
60754
60816
|
}
|
|
60755
60817
|
if (!(intersectionState & 1 /* Source */) && isObjectTypeWithInferableIndex(source2)) {
|
|
60756
60818
|
return membersRelatedToIndexInfo(source2, targetInfo, reportErrors2, intersectionState);
|
|
@@ -61041,12 +61103,15 @@ function createTypeChecker(host) {
|
|
|
61041
61103
|
}
|
|
61042
61104
|
function isDeeplyNestedType(type, stack, depth, maxDepth = 3) {
|
|
61043
61105
|
if (depth >= maxDepth) {
|
|
61106
|
+
if (type.flags & 2097152 /* Intersection */) {
|
|
61107
|
+
return some(type.types, (t) => isDeeplyNestedType(t, stack, depth, maxDepth));
|
|
61108
|
+
}
|
|
61044
61109
|
const identity2 = getRecursionIdentity(type);
|
|
61045
61110
|
let count = 0;
|
|
61046
61111
|
let lastTypeId = 0;
|
|
61047
61112
|
for (let i = 0; i < depth; i++) {
|
|
61048
61113
|
const t = stack[i];
|
|
61049
|
-
if (getRecursionIdentity(t) === identity2) {
|
|
61114
|
+
if (t.flags & 2097152 /* Intersection */ ? some(t.types, (u) => getRecursionIdentity(u) === identity2) : getRecursionIdentity(t) === identity2) {
|
|
61050
61115
|
if (t.id >= lastTypeId) {
|
|
61051
61116
|
count++;
|
|
61052
61117
|
if (count >= maxDepth) {
|
|
@@ -61268,7 +61333,8 @@ function createTypeChecker(host) {
|
|
|
61268
61333
|
return !!elementType && isEmptyLiteralType(elementType);
|
|
61269
61334
|
}
|
|
61270
61335
|
function isTupleLikeType(type) {
|
|
61271
|
-
|
|
61336
|
+
let lengthType;
|
|
61337
|
+
return isTupleType(type) || !!getPropertyOfType(type, "0") || isArrayLikeType(type) && !!(lengthType = getTypeOfPropertyOfType(type, "length")) && everyType(lengthType, (t) => !!(t.flags & 256 /* NumberLiteral */));
|
|
61272
61338
|
}
|
|
61273
61339
|
function isArrayOrTupleLikeType(type) {
|
|
61274
61340
|
return isArrayLikeType(type) || isTupleLikeType(type);
|
|
@@ -63414,7 +63480,7 @@ function createTypeChecker(host) {
|
|
|
63414
63480
|
}
|
|
63415
63481
|
return getUnionTypeFromSortedList(
|
|
63416
63482
|
filtered,
|
|
63417
|
-
type.objectFlags,
|
|
63483
|
+
type.objectFlags & (32768 /* PrimitiveUnion */ | 16777216 /* ContainsIntersections */),
|
|
63418
63484
|
/*aliasSymbol*/
|
|
63419
63485
|
void 0,
|
|
63420
63486
|
/*aliasTypeArguments*/
|
|
@@ -63921,7 +63987,7 @@ function createTypeChecker(host) {
|
|
|
63921
63987
|
}
|
|
63922
63988
|
return declaredType;
|
|
63923
63989
|
}
|
|
63924
|
-
if (isVariableDeclaration(node) && node.parent.parent.kind === 246 /* ForInStatement */ &&
|
|
63990
|
+
if (isVariableDeclaration(node) && node.parent.parent.kind === 246 /* ForInStatement */ && isMatchingReference(reference, node.parent.parent.expression)) {
|
|
63925
63991
|
return getNonNullableTypeIfNeeded(finalizeEvolvingArrayType(getTypeFromFlowType(getTypeAtFlowNode(flow.antecedent))));
|
|
63926
63992
|
}
|
|
63927
63993
|
return void 0;
|
|
@@ -70065,7 +70131,7 @@ function createTypeChecker(host) {
|
|
|
70065
70131
|
}
|
|
70066
70132
|
}
|
|
70067
70133
|
function checkCallExpression(node, checkMode) {
|
|
70068
|
-
var _a2;
|
|
70134
|
+
var _a2, _b, _c;
|
|
70069
70135
|
checkGrammarTypeArguments(node, node.typeArguments);
|
|
70070
70136
|
const signature = getResolvedSignature(
|
|
70071
70137
|
node,
|
|
@@ -70082,7 +70148,7 @@ function createTypeChecker(host) {
|
|
|
70082
70148
|
}
|
|
70083
70149
|
if (node.kind === 211 /* NewExpression */) {
|
|
70084
70150
|
const declaration = signature.declaration;
|
|
70085
|
-
if (declaration && declaration.kind !== 173 /* Constructor */ && declaration.kind !== 177 /* ConstructSignature */ && declaration.kind !== 182 /* ConstructorType */ && !isJSDocConstructSignature(declaration) && !isJSConstructor(declaration)) {
|
|
70151
|
+
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
70152
|
if (noImplicitAny) {
|
|
70087
70153
|
error(node, Diagnostics.new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type);
|
|
70088
70154
|
}
|
|
@@ -70110,7 +70176,7 @@ function createTypeChecker(host) {
|
|
|
70110
70176
|
/*allowDeclaration*/
|
|
70111
70177
|
false
|
|
70112
70178
|
);
|
|
70113
|
-
if ((
|
|
70179
|
+
if ((_c = jsSymbol == null ? void 0 : jsSymbol.exports) == null ? void 0 : _c.size) {
|
|
70114
70180
|
const jsAssignmentType = createAnonymousType(jsSymbol, jsSymbol.exports, emptyArray, emptyArray, emptyArray);
|
|
70115
70181
|
jsAssignmentType.objectFlags |= 4096 /* JSLiteral */;
|
|
70116
70182
|
return getIntersectionType([returnType, jsAssignmentType]);
|
|
@@ -73037,7 +73103,7 @@ function createTypeChecker(host) {
|
|
|
73037
73103
|
return isCallChain(expr) ? getReturnTypeOfSingleNonGenericSignatureOfCallChain(expr) : getReturnTypeOfSingleNonGenericCallSignature(checkNonNullExpression(expr.expression));
|
|
73038
73104
|
} else if (isAssertionExpression(expr) && !isConstTypeReference(expr.type)) {
|
|
73039
73105
|
return getTypeFromTypeNode(expr.type);
|
|
73040
|
-
} else if (node
|
|
73106
|
+
} else if (isLiteralExpression(node) || isBooleanLiteral(node)) {
|
|
73041
73107
|
return checkExpression(node);
|
|
73042
73108
|
}
|
|
73043
73109
|
return void 0;
|
|
@@ -77820,7 +77886,7 @@ function createTypeChecker(host) {
|
|
|
77820
77886
|
getNodeLinks(node).flags |= 2048 /* LexicalModuleMergesWithClass */;
|
|
77821
77887
|
}
|
|
77822
77888
|
}
|
|
77823
|
-
if (compilerOptions.verbatimModuleSyntax && node.parent.kind === 308 /* SourceFile */) {
|
|
77889
|
+
if (compilerOptions.verbatimModuleSyntax && node.parent.kind === 308 /* SourceFile */ && (moduleKind === 1 /* CommonJS */ || node.parent.impliedNodeFormat === 1 /* CommonJS */)) {
|
|
77824
77890
|
const exportModifier = (_b = node.modifiers) == null ? void 0 : _b.find((m) => m.kind === 93 /* ExportKeyword */);
|
|
77825
77891
|
if (exportModifier) {
|
|
77826
77892
|
error(exportModifier, Diagnostics.A_top_level_export_modifier_cannot_be_used_on_value_declarations_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled);
|
|
@@ -103891,7 +103957,7 @@ function transformDeclarations(context) {
|
|
|
103891
103957
|
if (elem.kind === 229 /* OmittedExpression */) {
|
|
103892
103958
|
return elem;
|
|
103893
103959
|
}
|
|
103894
|
-
if (elem.propertyName && isIdentifier(elem.propertyName) && isIdentifier(elem.name) && !elem.symbol.isReferenced) {
|
|
103960
|
+
if (elem.propertyName && isIdentifier(elem.propertyName) && isIdentifier(elem.name) && !elem.symbol.isReferenced && !isIdentifierANonContextualKeyword(elem.propertyName)) {
|
|
103895
103961
|
return factory2.updateBindingElement(
|
|
103896
103962
|
elem,
|
|
103897
103963
|
elem.dotDotDotToken,
|