typescript 5.0.0-dev.20230202 → 5.0.0-dev.20230204
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 +118 -56
- package/lib/tsserver.js +2871 -2798
- package/lib/tsserverlibrary.js +140 -68
- package/lib/typescript.js +136 -65
- package/lib/typingsInstaller.js +33 -16
- package/package.json +2 -1
package/lib/typescript.js
CHANGED
|
@@ -35,7 +35,7 @@ var ts = (() => {
|
|
|
35
35
|
"src/compiler/corePublic.ts"() {
|
|
36
36
|
"use strict";
|
|
37
37
|
versionMajorMinor = "5.0";
|
|
38
|
-
version = `${versionMajorMinor}.0-dev.
|
|
38
|
+
version = `${versionMajorMinor}.0-dev.20230204`;
|
|
39
39
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
40
40
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
41
41
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -7859,7 +7859,6 @@ ${lanes.join("\n")}
|
|
|
7859
7859
|
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}'."),
|
|
7860
7860
|
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'?"),
|
|
7861
7861
|
_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}'?"),
|
|
7862
|
-
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."),
|
|
7863
7862
|
_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."),
|
|
7864
7863
|
_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."),
|
|
7865
7864
|
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}'."),
|
|
@@ -38241,6 +38240,22 @@ ${lanes.join("\n")}
|
|
|
38241
38240
|
Debug.assert(extensionIsTS(resolved.extension));
|
|
38242
38241
|
return { fileName: resolved.path, packageId: resolved.packageId };
|
|
38243
38242
|
}
|
|
38243
|
+
function createResolvedModuleWithFailedLookupLocationsHandlingSymlink(moduleName, resolved, isExternalLibraryImport, failedLookupLocations, affectingLocations, diagnostics, state, legacyResult) {
|
|
38244
|
+
if (!state.resultFromCache && !state.compilerOptions.preserveSymlinks && resolved && isExternalLibraryImport && !resolved.originalPath && !isExternalModuleNameRelative(moduleName)) {
|
|
38245
|
+
const { resolvedFileName, originalPath } = getOriginalAndResolvedFileName(resolved.path, state.host, state.traceEnabled);
|
|
38246
|
+
if (originalPath)
|
|
38247
|
+
resolved = { ...resolved, path: resolvedFileName, originalPath };
|
|
38248
|
+
}
|
|
38249
|
+
return createResolvedModuleWithFailedLookupLocations(
|
|
38250
|
+
resolved,
|
|
38251
|
+
isExternalLibraryImport,
|
|
38252
|
+
failedLookupLocations,
|
|
38253
|
+
affectingLocations,
|
|
38254
|
+
diagnostics,
|
|
38255
|
+
state.resultFromCache,
|
|
38256
|
+
legacyResult
|
|
38257
|
+
);
|
|
38258
|
+
}
|
|
38244
38259
|
function createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations, affectingLocations, diagnostics, resultFromCache, legacyResult) {
|
|
38245
38260
|
if (resultFromCache) {
|
|
38246
38261
|
resultFromCache.failedLookupLocations = updateResolutionField(resultFromCache.failedLookupLocations, failedLookupLocations);
|
|
@@ -38399,6 +38414,15 @@ ${lanes.join("\n")}
|
|
|
38399
38414
|
const useCaseSensitiveFileNames = typeof host.useCaseSensitiveFileNames === "function" ? host.useCaseSensitiveFileNames() : host.useCaseSensitiveFileNames;
|
|
38400
38415
|
return comparePaths(path1, path2, !useCaseSensitiveFileNames) === 0 /* EqualTo */;
|
|
38401
38416
|
}
|
|
38417
|
+
function getOriginalAndResolvedFileName(fileName, host, traceEnabled) {
|
|
38418
|
+
const resolvedFileName = realPath(fileName, host, traceEnabled);
|
|
38419
|
+
const pathsAreEqual = arePathsEqual(fileName, resolvedFileName, host);
|
|
38420
|
+
return {
|
|
38421
|
+
// If the fileName and realpath are differing only in casing prefer fileName so that we can issue correct errors for casing under forceConsistentCasingInFileNames
|
|
38422
|
+
resolvedFileName: pathsAreEqual ? fileName : resolvedFileName,
|
|
38423
|
+
originalPath: pathsAreEqual ? void 0 : fileName
|
|
38424
|
+
};
|
|
38425
|
+
}
|
|
38402
38426
|
function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFile, options, host, redirectedReference, cache, resolutionMode) {
|
|
38403
38427
|
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.");
|
|
38404
38428
|
const traceEnabled = isTraceEnabled(options, host);
|
|
@@ -38470,13 +38494,13 @@ ${lanes.join("\n")}
|
|
|
38470
38494
|
let resolvedTypeReferenceDirective;
|
|
38471
38495
|
if (resolved) {
|
|
38472
38496
|
const { fileName, packageId } = resolved;
|
|
38473
|
-
|
|
38474
|
-
|
|
38497
|
+
let resolvedFileName = fileName, originalPath;
|
|
38498
|
+
if (!options.preserveSymlinks)
|
|
38499
|
+
({ resolvedFileName, originalPath } = getOriginalAndResolvedFileName(fileName, host, traceEnabled));
|
|
38475
38500
|
resolvedTypeReferenceDirective = {
|
|
38476
38501
|
primary,
|
|
38477
|
-
|
|
38478
|
-
|
|
38479
|
-
originalPath: pathsAreEqual ? void 0 : fileName,
|
|
38502
|
+
resolvedFileName,
|
|
38503
|
+
originalPath,
|
|
38480
38504
|
packageId,
|
|
38481
38505
|
isExternalLibraryImport: pathContainsNodeModules(fileName)
|
|
38482
38506
|
};
|
|
@@ -39346,13 +39370,14 @@ ${lanes.join("\n")}
|
|
|
39346
39370
|
legacyResult = diagnosticResult.value.resolved.path;
|
|
39347
39371
|
}
|
|
39348
39372
|
}
|
|
39349
|
-
return
|
|
39373
|
+
return createResolvedModuleWithFailedLookupLocationsHandlingSymlink(
|
|
39374
|
+
moduleName,
|
|
39350
39375
|
(_c = result == null ? void 0 : result.value) == null ? void 0 : _c.resolved,
|
|
39351
39376
|
(_d = result == null ? void 0 : result.value) == null ? void 0 : _d.isExternalLibraryImport,
|
|
39352
39377
|
failedLookupLocations,
|
|
39353
39378
|
affectingLocations,
|
|
39354
39379
|
diagnostics,
|
|
39355
|
-
state
|
|
39380
|
+
state,
|
|
39356
39381
|
legacyResult
|
|
39357
39382
|
);
|
|
39358
39383
|
function tryResolve(extensions2, state2) {
|
|
@@ -39382,16 +39407,7 @@ ${lanes.join("\n")}
|
|
|
39382
39407
|
}
|
|
39383
39408
|
resolved2 = loadModuleFromNearestNodeModulesDirectory(extensions2, moduleName, containingDirectory, state2, cache, redirectedReference);
|
|
39384
39409
|
}
|
|
39385
|
-
|
|
39386
|
-
return void 0;
|
|
39387
|
-
let resolvedValue = resolved2.value;
|
|
39388
|
-
if (!compilerOptions.preserveSymlinks && resolvedValue && !resolvedValue.originalPath) {
|
|
39389
|
-
const path = realPath(resolvedValue.path, host, traceEnabled);
|
|
39390
|
-
const pathsAreEqual = arePathsEqual(path, resolvedValue.path, host);
|
|
39391
|
-
const originalPath = pathsAreEqual ? void 0 : resolvedValue.path;
|
|
39392
|
-
resolvedValue = { ...resolvedValue, path: pathsAreEqual ? resolvedValue.path : path, originalPath };
|
|
39393
|
-
}
|
|
39394
|
-
return { value: resolvedValue && { resolved: resolvedValue, isExternalLibraryImport: true } };
|
|
39410
|
+
return resolved2 && { value: resolved2.value && { resolved: resolved2.value, isExternalLibraryImport: true } };
|
|
39395
39411
|
} else {
|
|
39396
39412
|
const { path: candidate, parts } = normalizePathForCJSResolution(containingDirectory, moduleName);
|
|
39397
39413
|
const resolved2 = nodeLoadModuleByRelativeName(
|
|
@@ -40545,13 +40561,14 @@ ${lanes.join("\n")}
|
|
|
40545
40561
|
candidateIsFromPackageJsonField: false
|
|
40546
40562
|
};
|
|
40547
40563
|
const resolved = tryResolve(1 /* TypeScript */ | 4 /* Declaration */) || tryResolve(2 /* JavaScript */ | (compilerOptions.resolveJsonModule ? 8 /* Json */ : 0));
|
|
40548
|
-
return
|
|
40564
|
+
return createResolvedModuleWithFailedLookupLocationsHandlingSymlink(
|
|
40565
|
+
moduleName,
|
|
40549
40566
|
resolved && resolved.value,
|
|
40550
40567
|
(resolved == null ? void 0 : resolved.value) && pathContainsNodeModules(resolved.value.path),
|
|
40551
40568
|
failedLookupLocations,
|
|
40552
40569
|
affectingLocations,
|
|
40553
40570
|
diagnostics,
|
|
40554
|
-
state
|
|
40571
|
+
state
|
|
40555
40572
|
);
|
|
40556
40573
|
function tryResolve(extensions) {
|
|
40557
40574
|
const resolvedUsingSettings = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loadModuleFromFileNoPackageId, state);
|
|
@@ -44856,6 +44873,7 @@ ${lanes.join("\n")}
|
|
|
44856
44873
|
isArrayType,
|
|
44857
44874
|
isTupleType,
|
|
44858
44875
|
isArrayLikeType,
|
|
44876
|
+
isEmptyAnonymousObjectType,
|
|
44859
44877
|
isTypeInvalidDueToUnionDiscriminant,
|
|
44860
44878
|
getExactOptionalProperties,
|
|
44861
44879
|
getAllPossiblePropertiesOfTypes,
|
|
@@ -46678,7 +46696,12 @@ ${lanes.join("\n")}
|
|
|
46678
46696
|
}
|
|
46679
46697
|
function resolveExportByName(moduleSymbol, name, sourceNode, dontResolveAlias) {
|
|
46680
46698
|
const exportValue = moduleSymbol.exports.get("export=" /* ExportEquals */);
|
|
46681
|
-
const exportSymbol = exportValue ? getPropertyOfType(
|
|
46699
|
+
const exportSymbol = exportValue ? getPropertyOfType(
|
|
46700
|
+
getTypeOfSymbol(exportValue),
|
|
46701
|
+
name,
|
|
46702
|
+
/*skipObjectFunctionPropertyAugment*/
|
|
46703
|
+
true
|
|
46704
|
+
) : moduleSymbol.exports.get(name);
|
|
46682
46705
|
const resolved = resolveSymbol(exportSymbol, dontResolveAlias);
|
|
46683
46706
|
markSymbolOfAliasDeclarationIfTypeOnly(
|
|
46684
46707
|
sourceNode,
|
|
@@ -47713,12 +47736,9 @@ ${lanes.join("\n")}
|
|
|
47713
47736
|
if (resolutionDiagnostic) {
|
|
47714
47737
|
error(errorNode, resolutionDiagnostic, moduleReference, resolvedModule.resolvedFileName);
|
|
47715
47738
|
} else {
|
|
47716
|
-
const tsExtension = tryExtractTSExtension(moduleReference);
|
|
47717
47739
|
const isExtensionlessRelativePathImport = pathIsRelative(moduleReference) && !hasExtension(moduleReference);
|
|
47718
47740
|
const resolutionIsNode16OrNext = moduleResolutionKind === 3 /* Node16 */ || moduleResolutionKind === 99 /* NodeNext */;
|
|
47719
|
-
if (
|
|
47720
|
-
errorOnTSExtensionImport(tsExtension);
|
|
47721
|
-
} else if (!getResolveJsonModule(compilerOptions) && fileExtensionIs(moduleReference, ".json" /* Json */) && moduleResolutionKind !== 1 /* Classic */ && hasJsonModuleEmitEnabled(compilerOptions)) {
|
|
47741
|
+
if (!getResolveJsonModule(compilerOptions) && fileExtensionIs(moduleReference, ".json" /* Json */) && moduleResolutionKind !== 1 /* Classic */ && hasJsonModuleEmitEnabled(compilerOptions)) {
|
|
47722
47742
|
error(errorNode, Diagnostics.Cannot_find_module_0_Consider_using_resolveJsonModule_to_import_module_with_json_extension, moduleReference);
|
|
47723
47743
|
} else if (mode === 99 /* ESNext */ && resolutionIsNode16OrNext && isExtensionlessRelativePathImport) {
|
|
47724
47744
|
const absoluteRef = getNormalizedAbsolutePath(moduleReference, getDirectoryPath(currentSourceFile.path));
|
|
@@ -47738,10 +47758,6 @@ ${lanes.join("\n")}
|
|
|
47738
47758
|
}
|
|
47739
47759
|
}
|
|
47740
47760
|
return void 0;
|
|
47741
|
-
function errorOnTSExtensionImport(tsExtension) {
|
|
47742
|
-
const diag2 = Diagnostics.An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead;
|
|
47743
|
-
error(errorNode, diag2, tsExtension, getSuggestedImportSource(tsExtension));
|
|
47744
|
-
}
|
|
47745
47761
|
function getSuggestedImportSource(tsExtension) {
|
|
47746
47762
|
const importSourceWithoutExtension = removeExtension(moduleReference, tsExtension);
|
|
47747
47763
|
if (emitModuleKindIsNonNodeESM(moduleKind) || mode === 99 /* ESNext */) {
|
|
@@ -56093,7 +56109,7 @@ ${lanes.join("\n")}
|
|
|
56093
56109
|
for (const tag of node.tags) {
|
|
56094
56110
|
if (isJSDocOverloadTag(tag)) {
|
|
56095
56111
|
const jsDocSignature = tag.typeExpression;
|
|
56096
|
-
if (jsDocSignature.type === void 0) {
|
|
56112
|
+
if (jsDocSignature.type === void 0 && !isConstructorDeclaration(decl)) {
|
|
56097
56113
|
reportImplicitAny(jsDocSignature, anyType);
|
|
56098
56114
|
}
|
|
56099
56115
|
result.push(getSignatureFromDeclaration(jsDocSignature));
|
|
@@ -56205,6 +56221,12 @@ ${lanes.join("\n")}
|
|
|
56205
56221
|
if (declaration.kind === 173 /* Constructor */) {
|
|
56206
56222
|
return getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol));
|
|
56207
56223
|
}
|
|
56224
|
+
if (isJSDocSignature(declaration)) {
|
|
56225
|
+
const root = getJSDocRoot(declaration);
|
|
56226
|
+
if (root && isConstructorDeclaration(root.parent)) {
|
|
56227
|
+
return getDeclaredTypeOfClassOrInterface(getMergedSymbol(root.parent.parent.symbol));
|
|
56228
|
+
}
|
|
56229
|
+
}
|
|
56208
56230
|
if (isJSDocConstructSignature(declaration)) {
|
|
56209
56231
|
return getTypeFromTypeNode(declaration.parameters[0].type);
|
|
56210
56232
|
}
|
|
@@ -56733,7 +56755,7 @@ ${lanes.join("\n")}
|
|
|
56733
56755
|
return links.resolvedJSDocType;
|
|
56734
56756
|
}
|
|
56735
56757
|
function getSubstitutionType(baseType, constraint) {
|
|
56736
|
-
if (constraint.flags & 3 /* AnyOrUnknown */ || constraint === baseType) {
|
|
56758
|
+
if (constraint.flags & 3 /* AnyOrUnknown */ || constraint === baseType || baseType.flags & 1 /* Any */) {
|
|
56737
56759
|
return baseType;
|
|
56738
56760
|
}
|
|
56739
56761
|
const id = `${getTypeId(baseType)}>${getTypeId(constraint)}`;
|
|
@@ -58420,7 +58442,7 @@ ${lanes.join("\n")}
|
|
|
58420
58442
|
}
|
|
58421
58443
|
}
|
|
58422
58444
|
const propType = getTypeOfSymbol(prop);
|
|
58423
|
-
return accessExpression && getAssignmentTargetKind(accessExpression) !== 1 /* Definite */ ? getFlowTypeOfReference(accessExpression, propType) : propType;
|
|
58445
|
+
return accessExpression && getAssignmentTargetKind(accessExpression) !== 1 /* Definite */ ? getFlowTypeOfReference(accessExpression, propType) : accessNode && isIndexedAccessTypeNode(accessNode) && containsMissingType(propType) ? getUnionType([propType, undefinedType]) : propType;
|
|
58424
58446
|
}
|
|
58425
58447
|
if (everyType(objectType, isTupleType) && isNumericLiteralName(propName)) {
|
|
58426
58448
|
const index = +propName;
|
|
@@ -60925,7 +60947,6 @@ ${lanes.join("\n")}
|
|
|
60925
60947
|
let overrideNextErrorInfo = 0;
|
|
60926
60948
|
let lastSkippedInfo;
|
|
60927
60949
|
let incompatibleStack;
|
|
60928
|
-
let inPropertyCheck = false;
|
|
60929
60950
|
Debug.assert(relation !== identityRelation || !errorNode, "no error reporting in identity checking");
|
|
60930
60951
|
const result = isRelatedTo(
|
|
60931
60952
|
source,
|
|
@@ -61884,14 +61905,15 @@ ${lanes.join("\n")}
|
|
|
61884
61905
|
);
|
|
61885
61906
|
}
|
|
61886
61907
|
}
|
|
61887
|
-
if (result2 && !
|
|
61888
|
-
inPropertyCheck = true;
|
|
61908
|
+
if (result2 && !(intersectionState & 2 /* Target */) && target2.flags & 2097152 /* Intersection */ && !isGenericObjectType(target2) && source2.flags & (524288 /* Object */ | 2097152 /* Intersection */)) {
|
|
61889
61909
|
result2 &= propertiesRelatedTo(
|
|
61890
61910
|
source2,
|
|
61891
61911
|
target2,
|
|
61892
61912
|
reportErrors2,
|
|
61893
61913
|
/*excludedProperties*/
|
|
61894
61914
|
void 0,
|
|
61915
|
+
/*optionalsOnly*/
|
|
61916
|
+
false,
|
|
61895
61917
|
0 /* None */
|
|
61896
61918
|
);
|
|
61897
61919
|
if (result2 && isObjectLiteralType2(source2) && getObjectFlags(source2) & 8192 /* FreshLiteral */) {
|
|
@@ -61904,7 +61926,17 @@ ${lanes.join("\n")}
|
|
|
61904
61926
|
0 /* None */
|
|
61905
61927
|
);
|
|
61906
61928
|
}
|
|
61907
|
-
|
|
61929
|
+
} else if (result2 && isNonGenericObjectType(target2) && !isArrayOrTupleType(target2) && source2.flags & 2097152 /* Intersection */ && getApparentType(source2).flags & 3670016 /* StructuredType */ && !some(source2.types, (t) => !!(getObjectFlags(t) & 262144 /* NonInferrableType */))) {
|
|
61930
|
+
result2 &= propertiesRelatedTo(
|
|
61931
|
+
source2,
|
|
61932
|
+
target2,
|
|
61933
|
+
reportErrors2,
|
|
61934
|
+
/*excludedProperties*/
|
|
61935
|
+
void 0,
|
|
61936
|
+
/*optionalsOnly*/
|
|
61937
|
+
true,
|
|
61938
|
+
intersectionState
|
|
61939
|
+
);
|
|
61908
61940
|
}
|
|
61909
61941
|
}
|
|
61910
61942
|
if (result2) {
|
|
@@ -62394,12 +62426,14 @@ ${lanes.join("\n")}
|
|
|
62394
62426
|
reportStructuralErrors,
|
|
62395
62427
|
/*excludedProperties*/
|
|
62396
62428
|
void 0,
|
|
62429
|
+
/*optionalsOnly*/
|
|
62430
|
+
false,
|
|
62397
62431
|
intersectionState
|
|
62398
62432
|
);
|
|
62399
62433
|
if (result2) {
|
|
62400
|
-
result2 &= signaturesRelatedTo(source2, target2, 0 /* Call */, reportStructuralErrors);
|
|
62434
|
+
result2 &= signaturesRelatedTo(source2, target2, 0 /* Call */, reportStructuralErrors, intersectionState);
|
|
62401
62435
|
if (result2) {
|
|
62402
|
-
result2 &= signaturesRelatedTo(source2, target2, 1 /* Construct */, reportStructuralErrors);
|
|
62436
|
+
result2 &= signaturesRelatedTo(source2, target2, 1 /* Construct */, reportStructuralErrors, intersectionState);
|
|
62403
62437
|
if (result2) {
|
|
62404
62438
|
result2 &= indexSignaturesRelatedTo(source2, target2, sourceIsPrimitive, reportStructuralErrors, intersectionState);
|
|
62405
62439
|
}
|
|
@@ -62528,6 +62562,8 @@ ${lanes.join("\n")}
|
|
|
62528
62562
|
/*reportErrors*/
|
|
62529
62563
|
false,
|
|
62530
62564
|
excludedProperties,
|
|
62565
|
+
/*optionalsOnly*/
|
|
62566
|
+
false,
|
|
62531
62567
|
0 /* None */
|
|
62532
62568
|
);
|
|
62533
62569
|
if (result2) {
|
|
@@ -62536,7 +62572,8 @@ ${lanes.join("\n")}
|
|
|
62536
62572
|
type,
|
|
62537
62573
|
0 /* Call */,
|
|
62538
62574
|
/*reportStructuralErrors*/
|
|
62539
|
-
false
|
|
62575
|
+
false,
|
|
62576
|
+
0 /* None */
|
|
62540
62577
|
);
|
|
62541
62578
|
if (result2) {
|
|
62542
62579
|
result2 &= signaturesRelatedTo(
|
|
@@ -62544,7 +62581,8 @@ ${lanes.join("\n")}
|
|
|
62544
62581
|
type,
|
|
62545
62582
|
1 /* Construct */,
|
|
62546
62583
|
/*reportStructuralErrors*/
|
|
62547
|
-
false
|
|
62584
|
+
false,
|
|
62585
|
+
0 /* None */
|
|
62548
62586
|
);
|
|
62549
62587
|
if (result2 && !(isTupleType(source2) && isTupleType(type))) {
|
|
62550
62588
|
result2 &= indexSignaturesRelatedTo(
|
|
@@ -62722,7 +62760,7 @@ ${lanes.join("\n")}
|
|
|
62722
62760
|
}
|
|
62723
62761
|
}
|
|
62724
62762
|
}
|
|
62725
|
-
function propertiesRelatedTo(source2, target2, reportErrors2, excludedProperties, intersectionState) {
|
|
62763
|
+
function propertiesRelatedTo(source2, target2, reportErrors2, excludedProperties, optionalsOnly, intersectionState) {
|
|
62726
62764
|
if (relation === identityRelation) {
|
|
62727
62765
|
return propertiesIdenticalTo(source2, target2, excludedProperties);
|
|
62728
62766
|
}
|
|
@@ -62858,7 +62896,7 @@ ${lanes.join("\n")}
|
|
|
62858
62896
|
const numericNamesOnly = isTupleType(source2) && isTupleType(target2);
|
|
62859
62897
|
for (const targetProp of excludeProperties(properties, excludedProperties)) {
|
|
62860
62898
|
const name = targetProp.escapedName;
|
|
62861
|
-
if (!(targetProp.flags & 4194304 /* Prototype */) && (!numericNamesOnly || isNumericLiteralName(name) || name === "length")) {
|
|
62899
|
+
if (!(targetProp.flags & 4194304 /* Prototype */) && (!numericNamesOnly || isNumericLiteralName(name) || name === "length") && (!optionalsOnly || targetProp.flags & 16777216 /* Optional */)) {
|
|
62862
62900
|
const sourceProp = getPropertyOfType(source2, name);
|
|
62863
62901
|
if (sourceProp && sourceProp !== targetProp) {
|
|
62864
62902
|
const related = propertyRelatedTo(source2, target2, sourceProp, targetProp, getNonMissingTypeOfSymbol, reportErrors2, intersectionState, relation === comparableRelation);
|
|
@@ -62894,7 +62932,7 @@ ${lanes.join("\n")}
|
|
|
62894
62932
|
}
|
|
62895
62933
|
return result2;
|
|
62896
62934
|
}
|
|
62897
|
-
function signaturesRelatedTo(source2, target2, kind, reportErrors2) {
|
|
62935
|
+
function signaturesRelatedTo(source2, target2, kind, reportErrors2, intersectionState) {
|
|
62898
62936
|
var _a3, _b;
|
|
62899
62937
|
if (relation === identityRelation) {
|
|
62900
62938
|
return signaturesIdenticalTo(source2, target2, kind);
|
|
@@ -62931,6 +62969,7 @@ ${lanes.join("\n")}
|
|
|
62931
62969
|
/*erase*/
|
|
62932
62970
|
true,
|
|
62933
62971
|
reportErrors2,
|
|
62972
|
+
intersectionState,
|
|
62934
62973
|
incompatibleReporter(sourceSignatures[i], targetSignatures[i])
|
|
62935
62974
|
);
|
|
62936
62975
|
if (!related) {
|
|
@@ -62942,7 +62981,7 @@ ${lanes.join("\n")}
|
|
|
62942
62981
|
const eraseGenerics = relation === comparableRelation || !!compilerOptions.noStrictGenericChecks;
|
|
62943
62982
|
const sourceSignature = first(sourceSignatures);
|
|
62944
62983
|
const targetSignature = first(targetSignatures);
|
|
62945
|
-
result2 = signatureRelatedTo(sourceSignature, targetSignature, eraseGenerics, reportErrors2, incompatibleReporter(sourceSignature, targetSignature));
|
|
62984
|
+
result2 = signatureRelatedTo(sourceSignature, targetSignature, eraseGenerics, reportErrors2, intersectionState, incompatibleReporter(sourceSignature, targetSignature));
|
|
62946
62985
|
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 */)) {
|
|
62947
62986
|
const constructSignatureToString = (signature) => signatureToString(
|
|
62948
62987
|
signature,
|
|
@@ -62967,6 +63006,7 @@ ${lanes.join("\n")}
|
|
|
62967
63006
|
/*erase*/
|
|
62968
63007
|
true,
|
|
62969
63008
|
shouldElaborateErrors,
|
|
63009
|
+
intersectionState,
|
|
62970
63010
|
incompatibleReporter(s, t)
|
|
62971
63011
|
);
|
|
62972
63012
|
if (related) {
|
|
@@ -63019,7 +63059,7 @@ ${lanes.join("\n")}
|
|
|
63019
63059
|
}
|
|
63020
63060
|
return (source2, target2) => reportIncompatibleError(Diagnostics.Construct_signature_return_types_0_and_1_are_incompatible, typeToString(source2), typeToString(target2));
|
|
63021
63061
|
}
|
|
63022
|
-
function signatureRelatedTo(source2, target2, erase, reportErrors2, incompatibleReporter) {
|
|
63062
|
+
function signatureRelatedTo(source2, target2, erase, reportErrors2, intersectionState, incompatibleReporter) {
|
|
63023
63063
|
return compareSignaturesRelated(
|
|
63024
63064
|
erase ? getErasedSignature(source2) : source2,
|
|
63025
63065
|
erase ? getErasedSignature(target2) : target2,
|
|
@@ -63027,9 +63067,20 @@ ${lanes.join("\n")}
|
|
|
63027
63067
|
reportErrors2,
|
|
63028
63068
|
reportError,
|
|
63029
63069
|
incompatibleReporter,
|
|
63030
|
-
|
|
63070
|
+
isRelatedToWorker2,
|
|
63031
63071
|
reportUnreliableMapper
|
|
63032
63072
|
);
|
|
63073
|
+
function isRelatedToWorker2(source3, target3, reportErrors3) {
|
|
63074
|
+
return isRelatedTo(
|
|
63075
|
+
source3,
|
|
63076
|
+
target3,
|
|
63077
|
+
3 /* Both */,
|
|
63078
|
+
reportErrors3,
|
|
63079
|
+
/*headMessage*/
|
|
63080
|
+
void 0,
|
|
63081
|
+
intersectionState
|
|
63082
|
+
);
|
|
63083
|
+
}
|
|
63033
63084
|
}
|
|
63034
63085
|
function signaturesIdenticalTo(source2, target2, kind) {
|
|
63035
63086
|
const sourceSignatures = getSignaturesOfType(source2, kind);
|
|
@@ -63088,7 +63139,7 @@ ${lanes.join("\n")}
|
|
|
63088
63139
|
}
|
|
63089
63140
|
for (const info of getIndexInfosOfType(source2)) {
|
|
63090
63141
|
if (isApplicableIndexType(info.keyType, keyType)) {
|
|
63091
|
-
const related = indexInfoRelatedTo(info, targetInfo, reportErrors2);
|
|
63142
|
+
const related = indexInfoRelatedTo(info, targetInfo, reportErrors2, intersectionState);
|
|
63092
63143
|
if (!related) {
|
|
63093
63144
|
return 0 /* False */;
|
|
63094
63145
|
}
|
|
@@ -63097,8 +63148,16 @@ ${lanes.join("\n")}
|
|
|
63097
63148
|
}
|
|
63098
63149
|
return result2;
|
|
63099
63150
|
}
|
|
63100
|
-
function indexInfoRelatedTo(sourceInfo, targetInfo, reportErrors2) {
|
|
63101
|
-
const related = isRelatedTo(
|
|
63151
|
+
function indexInfoRelatedTo(sourceInfo, targetInfo, reportErrors2, intersectionState) {
|
|
63152
|
+
const related = isRelatedTo(
|
|
63153
|
+
sourceInfo.type,
|
|
63154
|
+
targetInfo.type,
|
|
63155
|
+
3 /* Both */,
|
|
63156
|
+
reportErrors2,
|
|
63157
|
+
/*headMessage*/
|
|
63158
|
+
void 0,
|
|
63159
|
+
intersectionState
|
|
63160
|
+
);
|
|
63102
63161
|
if (!related && reportErrors2) {
|
|
63103
63162
|
if (sourceInfo.keyType === targetInfo.keyType) {
|
|
63104
63163
|
reportError(Diagnostics._0_index_signatures_are_incompatible, typeToString(sourceInfo.keyType));
|
|
@@ -63127,7 +63186,7 @@ ${lanes.join("\n")}
|
|
|
63127
63186
|
function typeRelatedToIndexInfo(source2, targetInfo, reportErrors2, intersectionState) {
|
|
63128
63187
|
const sourceInfo = getApplicableIndexInfo(source2, targetInfo.keyType);
|
|
63129
63188
|
if (sourceInfo) {
|
|
63130
|
-
return indexInfoRelatedTo(sourceInfo, targetInfo, reportErrors2);
|
|
63189
|
+
return indexInfoRelatedTo(sourceInfo, targetInfo, reportErrors2, intersectionState);
|
|
63131
63190
|
}
|
|
63132
63191
|
if (!(intersectionState & 1 /* Source */) && isObjectTypeWithInferableIndex(source2)) {
|
|
63133
63192
|
return membersRelatedToIndexInfo(source2, targetInfo, reportErrors2, intersectionState);
|
|
@@ -63418,12 +63477,15 @@ ${lanes.join("\n")}
|
|
|
63418
63477
|
}
|
|
63419
63478
|
function isDeeplyNestedType(type, stack, depth, maxDepth = 3) {
|
|
63420
63479
|
if (depth >= maxDepth) {
|
|
63480
|
+
if (type.flags & 2097152 /* Intersection */) {
|
|
63481
|
+
return some(type.types, (t) => isDeeplyNestedType(t, stack, depth, maxDepth));
|
|
63482
|
+
}
|
|
63421
63483
|
const identity2 = getRecursionIdentity(type);
|
|
63422
63484
|
let count = 0;
|
|
63423
63485
|
let lastTypeId = 0;
|
|
63424
63486
|
for (let i = 0; i < depth; i++) {
|
|
63425
63487
|
const t = stack[i];
|
|
63426
|
-
if (getRecursionIdentity(t) === identity2) {
|
|
63488
|
+
if (t.flags & 2097152 /* Intersection */ ? some(t.types, (u) => getRecursionIdentity(u) === identity2) : getRecursionIdentity(t) === identity2) {
|
|
63427
63489
|
if (t.id >= lastTypeId) {
|
|
63428
63490
|
count++;
|
|
63429
63491
|
if (count >= maxDepth) {
|
|
@@ -72442,7 +72504,7 @@ ${lanes.join("\n")}
|
|
|
72442
72504
|
}
|
|
72443
72505
|
}
|
|
72444
72506
|
function checkCallExpression(node, checkMode) {
|
|
72445
|
-
var _a2;
|
|
72507
|
+
var _a2, _b, _c;
|
|
72446
72508
|
checkGrammarTypeArguments(node, node.typeArguments);
|
|
72447
72509
|
const signature = getResolvedSignature(
|
|
72448
72510
|
node,
|
|
@@ -72459,7 +72521,7 @@ ${lanes.join("\n")}
|
|
|
72459
72521
|
}
|
|
72460
72522
|
if (node.kind === 211 /* NewExpression */) {
|
|
72461
72523
|
const declaration = signature.declaration;
|
|
72462
|
-
if (declaration && declaration.kind !== 173 /* Constructor */ && declaration.kind !== 177 /* ConstructSignature */ && declaration.kind !== 182 /* ConstructorType */ && !isJSDocConstructSignature(declaration) && !isJSConstructor(declaration)) {
|
|
72524
|
+
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)) {
|
|
72463
72525
|
if (noImplicitAny) {
|
|
72464
72526
|
error(node, Diagnostics.new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type);
|
|
72465
72527
|
}
|
|
@@ -72487,7 +72549,7 @@ ${lanes.join("\n")}
|
|
|
72487
72549
|
/*allowDeclaration*/
|
|
72488
72550
|
false
|
|
72489
72551
|
);
|
|
72490
|
-
if ((
|
|
72552
|
+
if ((_c = jsSymbol == null ? void 0 : jsSymbol.exports) == null ? void 0 : _c.size) {
|
|
72491
72553
|
const jsAssignmentType = createAnonymousType(jsSymbol, jsSymbol.exports, emptyArray, emptyArray, emptyArray);
|
|
72492
72554
|
jsAssignmentType.objectFlags |= 4096 /* JSLiteral */;
|
|
72493
72555
|
return getIntersectionType([returnType, jsAssignmentType]);
|
|
@@ -80197,7 +80259,7 @@ ${lanes.join("\n")}
|
|
|
80197
80259
|
getNodeLinks(node).flags |= 2048 /* LexicalModuleMergesWithClass */;
|
|
80198
80260
|
}
|
|
80199
80261
|
}
|
|
80200
|
-
if (compilerOptions.verbatimModuleSyntax && node.parent.kind === 308 /* SourceFile */) {
|
|
80262
|
+
if (compilerOptions.verbatimModuleSyntax && node.parent.kind === 308 /* SourceFile */ && (moduleKind === 1 /* CommonJS */ || node.parent.impliedNodeFormat === 1 /* CommonJS */)) {
|
|
80201
80263
|
const exportModifier = (_b = node.modifiers) == null ? void 0 : _b.find((m) => m.kind === 93 /* ExportKeyword */);
|
|
80202
80264
|
if (exportModifier) {
|
|
80203
80265
|
error(exportModifier, Diagnostics.A_top_level_export_modifier_cannot_be_used_on_value_declarations_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled);
|
|
@@ -84390,8 +84452,8 @@ ${lanes.join("\n")}
|
|
|
84390
84452
|
"use strict";
|
|
84391
84453
|
init_ts2();
|
|
84392
84454
|
init_ts2();
|
|
84393
|
-
init_ts_performance();
|
|
84394
84455
|
init_ts_moduleSpecifiers();
|
|
84456
|
+
init_ts_performance();
|
|
84395
84457
|
ambientModuleSymbolRegex = /^".+"$/;
|
|
84396
84458
|
anon = "(anonymous)";
|
|
84397
84459
|
nextSymbolId = 1;
|
|
@@ -126369,6 +126431,13 @@ ${lanes.join("\n")}
|
|
|
126369
126431
|
}
|
|
126370
126432
|
return false;
|
|
126371
126433
|
}
|
|
126434
|
+
function isStringAndEmptyAnonymousObjectIntersection(type) {
|
|
126435
|
+
if (!type.isIntersection()) {
|
|
126436
|
+
return false;
|
|
126437
|
+
}
|
|
126438
|
+
const { types, checker } = type;
|
|
126439
|
+
return types.length === 2 && types[0].flags & 4 /* String */ && checker.isEmptyAnonymousObjectType(types[1]);
|
|
126440
|
+
}
|
|
126372
126441
|
function isPunctuation(kind) {
|
|
126373
126442
|
return 18 /* FirstPunctuation */ <= kind && kind <= 78 /* LastPunctuation */;
|
|
126374
126443
|
}
|
|
@@ -133413,9 +133482,9 @@ ${lanes.join("\n")}
|
|
|
133413
133482
|
"src/services/services.ts"() {
|
|
133414
133483
|
"use strict";
|
|
133415
133484
|
init_ts4();
|
|
133485
|
+
init_ts4();
|
|
133416
133486
|
init_ts_NavigateTo();
|
|
133417
133487
|
init_ts_NavigationBar();
|
|
133418
|
-
init_ts4();
|
|
133419
133488
|
servicesVersion = "0.8";
|
|
133420
133489
|
NodeObject = class {
|
|
133421
133490
|
constructor(kind, pos, end) {
|
|
@@ -136421,8 +136490,8 @@ ${lanes.join("\n")}
|
|
|
136421
136490
|
var init_addEmptyExportDeclaration = __esm({
|
|
136422
136491
|
"src/services/codefixes/addEmptyExportDeclaration.ts"() {
|
|
136423
136492
|
"use strict";
|
|
136424
|
-
init_ts_codefix();
|
|
136425
136493
|
init_ts4();
|
|
136494
|
+
init_ts_codefix();
|
|
136426
136495
|
registerCodeFix({
|
|
136427
136496
|
errorCodes: [
|
|
136428
136497
|
Diagnostics.await_expressions_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module.code,
|
|
@@ -138786,8 +138855,8 @@ ${lanes.join("\n")}
|
|
|
138786
138855
|
var init_convertToEsModule = __esm({
|
|
138787
138856
|
"src/services/codefixes/convertToEsModule.ts"() {
|
|
138788
138857
|
"use strict";
|
|
138789
|
-
init_ts_codefix();
|
|
138790
138858
|
init_ts4();
|
|
138859
|
+
init_ts_codefix();
|
|
138791
138860
|
registerCodeFix({
|
|
138792
138861
|
errorCodes: [Diagnostics.File_is_a_CommonJS_module_it_may_be_converted_to_an_ES_module.code],
|
|
138793
138862
|
getCodeActions(context) {
|
|
@@ -142386,8 +142455,8 @@ ${lanes.join("\n")}
|
|
|
142386
142455
|
var init_fixModuleAndTargetOptions = __esm({
|
|
142387
142456
|
"src/services/codefixes/fixModuleAndTargetOptions.ts"() {
|
|
142388
142457
|
"use strict";
|
|
142389
|
-
init_ts_codefix();
|
|
142390
142458
|
init_ts4();
|
|
142459
|
+
init_ts_codefix();
|
|
142391
142460
|
registerCodeFix({
|
|
142392
142461
|
errorCodes: [
|
|
142393
142462
|
Diagnostics.Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher.code,
|
|
@@ -147265,7 +147334,7 @@ ${lanes.join("\n")}
|
|
|
147265
147334
|
let useBraces2 = preferences.jsxAttributeCompletionStyle === "braces";
|
|
147266
147335
|
const type = typeChecker.getTypeOfSymbolAtLocation(symbol, location);
|
|
147267
147336
|
if (preferences.jsxAttributeCompletionStyle === "auto" && !(type.flags & 528 /* BooleanLike */) && !(type.flags & 1048576 /* Union */ && find(type.types, (type2) => !!(type2.flags & 528 /* BooleanLike */)))) {
|
|
147268
|
-
if (type.flags & 402653316 /* StringLike */ || type.flags & 1048576 /* Union */ && every(type.types, (type2) => !!(type2.flags & (402653316 /* StringLike */ | 32768 /* Undefined */)))) {
|
|
147337
|
+
if (type.flags & 402653316 /* StringLike */ || type.flags & 1048576 /* Union */ && every(type.types, (type2) => !!(type2.flags & (402653316 /* StringLike */ | 32768 /* Undefined */) || isStringAndEmptyAnonymousObjectIntersection(type2)))) {
|
|
147269
147338
|
insertText = `${escapeSnippetText(name)}=${quote(sourceFile, preferences, "$1")}`;
|
|
147270
147339
|
isSnippet = true;
|
|
147271
147340
|
} else {
|
|
@@ -147719,7 +147788,7 @@ ${lanes.join("\n")}
|
|
|
147719
147788
|
}
|
|
147720
147789
|
function getInsertTextAndReplacementSpanForImportCompletion(name, importStatementCompletion, origin, useSemicolons, sourceFile, options, preferences) {
|
|
147721
147790
|
const replacementSpan = importStatementCompletion.replacementSpan;
|
|
147722
|
-
const quotedModuleSpecifier = quote(sourceFile, preferences, origin.moduleSpecifier);
|
|
147791
|
+
const quotedModuleSpecifier = quote(sourceFile, preferences, escapeSnippetText(origin.moduleSpecifier));
|
|
147723
147792
|
const exportKind = origin.isDefaultExport ? 1 /* Default */ : origin.exportName === "export=" /* ExportEquals */ ? 2 /* ExportEquals */ : 0 /* Named */;
|
|
147724
147793
|
const tabStop = preferences.includeCompletionsWithSnippetText ? "$1" : "";
|
|
147725
147794
|
const importKind = ts_codefix_exports.getImportKind(
|
|
@@ -148301,7 +148370,7 @@ ${lanes.join("\n")}
|
|
|
148301
148370
|
break;
|
|
148302
148371
|
case 291 /* JsxExpression */:
|
|
148303
148372
|
case 290 /* JsxSpreadAttribute */:
|
|
148304
|
-
if (previousToken.kind === 19 /* CloseBraceToken */ ||
|
|
148373
|
+
if (previousToken.kind === 19 /* CloseBraceToken */ || previousToken.kind === 79 /* Identifier */ && previousToken.parent.kind === 288 /* JsxAttribute */) {
|
|
148305
148374
|
isJsxIdentifierExpected = true;
|
|
148306
148375
|
}
|
|
148307
148376
|
break;
|
|
@@ -157719,6 +157788,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
157719
157788
|
if (isExpression(body)) {
|
|
157720
157789
|
const returnStatement = factory.createReturnStatement(body);
|
|
157721
157790
|
const file = body.getSourceFile();
|
|
157791
|
+
setTextRange(returnStatement, body);
|
|
157722
157792
|
suppressLeadingAndTrailingTrivia(returnStatement);
|
|
157723
157793
|
copyTrailingAsLeadingComments(
|
|
157724
157794
|
body,
|
|
@@ -164697,8 +164767,8 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
164697
164767
|
var init_rules = __esm({
|
|
164698
164768
|
"src/services/formatting/rules.ts"() {
|
|
164699
164769
|
"use strict";
|
|
164700
|
-
init_ts_formatting();
|
|
164701
164770
|
init_ts4();
|
|
164771
|
+
init_ts_formatting();
|
|
164702
164772
|
}
|
|
164703
164773
|
});
|
|
164704
164774
|
|
|
@@ -168282,6 +168352,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
168282
168352
|
isString: () => isString,
|
|
168283
168353
|
isStringAKeyword: () => isStringAKeyword,
|
|
168284
168354
|
isStringANonContextualKeyword: () => isStringANonContextualKeyword,
|
|
168355
|
+
isStringAndEmptyAnonymousObjectIntersection: () => isStringAndEmptyAnonymousObjectIntersection,
|
|
168285
168356
|
isStringDoubleQuoted: () => isStringDoubleQuoted,
|
|
168286
168357
|
isStringLiteral: () => isStringLiteral,
|
|
168287
168358
|
isStringLiteralLike: () => isStringLiteralLike,
|