typescript 5.3.0-dev.20230824 → 5.3.0-dev.20230826
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/cancellationToken.js +1 -1
- package/lib/tsc.js +93 -83
- package/lib/tsserver.js +114 -107
- package/lib/typescript.js +114 -106
- package/lib/typingsInstaller.js +22 -23
- package/package.json +2 -2
package/lib/tsc.js
CHANGED
|
@@ -18,7 +18,7 @@ and limitations under the License.
|
|
|
18
18
|
|
|
19
19
|
// src/compiler/corePublic.ts
|
|
20
20
|
var versionMajorMinor = "5.3";
|
|
21
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
21
|
+
var version = `${versionMajorMinor}.0-dev.20230826`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -1111,9 +1111,6 @@ function endsWith(str, suffix) {
|
|
|
1111
1111
|
function removeSuffix(str, suffix) {
|
|
1112
1112
|
return endsWith(str, suffix) ? str.slice(0, str.length - suffix.length) : str;
|
|
1113
1113
|
}
|
|
1114
|
-
function stringContains(str, substring) {
|
|
1115
|
-
return str.indexOf(substring) !== -1;
|
|
1116
|
-
}
|
|
1117
1114
|
function orderedRemoveItem(array, item) {
|
|
1118
1115
|
for (let i = 0; i < array.length; i++) {
|
|
1119
1116
|
if (array[i] === item) {
|
|
@@ -4517,11 +4514,11 @@ function createDirectoryWatcherSupportingRecursive({
|
|
|
4517
4514
|
return some(ignoredPaths, (searchPath) => isInPath(path, searchPath)) || isIgnoredByWatchOptions(path, options, useCaseSensitiveFileNames2, getCurrentDirectory);
|
|
4518
4515
|
}
|
|
4519
4516
|
function isInPath(path, searchPath) {
|
|
4520
|
-
if (
|
|
4517
|
+
if (path.includes(searchPath))
|
|
4521
4518
|
return true;
|
|
4522
4519
|
if (useCaseSensitiveFileNames2)
|
|
4523
4520
|
return false;
|
|
4524
|
-
return
|
|
4521
|
+
return toCanonicalFilePath(path).includes(searchPath);
|
|
4525
4522
|
}
|
|
4526
4523
|
}
|
|
4527
4524
|
function createFileWatcherCallback(callback) {
|
|
@@ -5358,7 +5355,7 @@ function pathIsBareSpecifier(path) {
|
|
|
5358
5355
|
return !pathIsAbsolute(path) && !pathIsRelative(path);
|
|
5359
5356
|
}
|
|
5360
5357
|
function hasExtension(fileName) {
|
|
5361
|
-
return
|
|
5358
|
+
return getBaseFileName(fileName).includes(".");
|
|
5362
5359
|
}
|
|
5363
5360
|
function fileExtensionIs(path, extension) {
|
|
5364
5361
|
return path.length > extension.length && endsWith(path, extension);
|
|
@@ -5503,7 +5500,7 @@ function getPathFromPathComponents(pathComponents2, length2) {
|
|
|
5503
5500
|
return root + pathComponents2.slice(1, length2).join(directorySeparator);
|
|
5504
5501
|
}
|
|
5505
5502
|
function normalizeSlashes(path) {
|
|
5506
|
-
return path.
|
|
5503
|
+
return path.includes("\\") ? path.replace(backslashRegExp, directorySeparator) : path;
|
|
5507
5504
|
}
|
|
5508
5505
|
function reducePathComponents(components) {
|
|
5509
5506
|
if (!some(components))
|
|
@@ -11523,7 +11520,7 @@ function createModuleNotFoundChain(sourceFile, host, moduleReference, mode, pack
|
|
|
11523
11520
|
void 0,
|
|
11524
11521
|
Diagnostics.There_are_types_at_0_but_this_result_could_not_be_resolved_when_respecting_package_json_exports_The_1_library_may_need_to_update_its_package_json_or_typings,
|
|
11525
11522
|
node10Result,
|
|
11526
|
-
node10Result.
|
|
11523
|
+
node10Result.includes(nodeModulesPathPart + "@types/") ? `@types/${mangleScopedPackageName(packageName)}` : packageName
|
|
11527
11524
|
) : host.typesPackageExists(packageName) ? chainDiagnosticMessages(
|
|
11528
11525
|
/*details*/
|
|
11529
11526
|
void 0,
|
|
@@ -14780,7 +14777,7 @@ function isQuoteOrBacktick(charCode) {
|
|
|
14780
14777
|
}
|
|
14781
14778
|
function isIntrinsicJsxName(name) {
|
|
14782
14779
|
const ch = name.charCodeAt(0);
|
|
14783
|
-
return ch >= 97 /* a */ && ch <= 122 /* z */ ||
|
|
14780
|
+
return ch >= 97 /* a */ && ch <= 122 /* z */ || name.includes("-");
|
|
14784
14781
|
}
|
|
14785
14782
|
var indentStrings = ["", " "];
|
|
14786
14783
|
function getIndentString(level) {
|
|
@@ -14794,7 +14791,7 @@ function getIndentSize() {
|
|
|
14794
14791
|
return indentStrings[1].length;
|
|
14795
14792
|
}
|
|
14796
14793
|
function isNightly() {
|
|
14797
|
-
return
|
|
14794
|
+
return version.includes("-dev") || version.includes("-insiders");
|
|
14798
14795
|
}
|
|
14799
14796
|
function createTextWriter(newLine) {
|
|
14800
14797
|
var output;
|
|
@@ -14984,7 +14981,7 @@ function getExternalModuleNameFromDeclaration(host, resolver, declaration) {
|
|
|
14984
14981
|
return void 0;
|
|
14985
14982
|
}
|
|
14986
14983
|
const specifier = getExternalModuleName(declaration);
|
|
14987
|
-
if (specifier && isStringLiteralLike(specifier) && !pathIsRelative(specifier.text) && getCanonicalAbsolutePath(host, file.path).
|
|
14984
|
+
if (specifier && isStringLiteralLike(specifier) && !pathIsRelative(specifier.text) && !getCanonicalAbsolutePath(host, file.path).includes(getCanonicalAbsolutePath(host, ensureTrailingDirectorySeparator(host.getCommonSourceDirectory())))) {
|
|
14988
14985
|
return void 0;
|
|
14989
14986
|
}
|
|
14990
14987
|
return getResolvedExternalModuleName(host, file);
|
|
@@ -16792,7 +16789,7 @@ function getSupportedExtensions(options, extraFileExtensions) {
|
|
|
16792
16789
|
const flatBuiltins = flatten(builtins);
|
|
16793
16790
|
const extensions = [
|
|
16794
16791
|
...builtins,
|
|
16795
|
-
...mapDefined(extraFileExtensions, (x) => x.scriptKind === 7 /* Deferred */ || needJsExtensions && isJSLike(x.scriptKind) && flatBuiltins.
|
|
16792
|
+
...mapDefined(extraFileExtensions, (x) => x.scriptKind === 7 /* Deferred */ || needJsExtensions && isJSLike(x.scriptKind) && !flatBuiltins.includes(x.extension) ? [x.extension] : void 0)
|
|
16796
16793
|
];
|
|
16797
16794
|
return extensions;
|
|
16798
16795
|
}
|
|
@@ -17234,7 +17231,7 @@ function expressionResultIsUnused(node) {
|
|
|
17234
17231
|
}
|
|
17235
17232
|
}
|
|
17236
17233
|
function containsIgnoredPath(path) {
|
|
17237
|
-
return some(ignoredPaths, (p) =>
|
|
17234
|
+
return some(ignoredPaths, (p) => path.includes(p));
|
|
17238
17235
|
}
|
|
17239
17236
|
function getContainingNodeArray(node) {
|
|
17240
17237
|
if (!node.parent)
|
|
@@ -29967,7 +29964,9 @@ var Parser;
|
|
|
29967
29964
|
let dotDotDotToken;
|
|
29968
29965
|
let expression;
|
|
29969
29966
|
if (token() !== 20 /* CloseBraceToken */) {
|
|
29970
|
-
|
|
29967
|
+
if (!inExpressionContext) {
|
|
29968
|
+
dotDotDotToken = parseOptionalToken(26 /* DotDotDotToken */);
|
|
29969
|
+
}
|
|
29971
29970
|
expression = parseExpression();
|
|
29972
29971
|
}
|
|
29973
29972
|
if (inExpressionContext) {
|
|
@@ -33481,7 +33480,7 @@ var IncrementalParser;
|
|
|
33481
33480
|
})(InvalidPosition || (InvalidPosition = {}));
|
|
33482
33481
|
})(IncrementalParser || (IncrementalParser = {}));
|
|
33483
33482
|
function isDeclarationFileName(fileName) {
|
|
33484
|
-
return fileExtensionIsOneOf(fileName, supportedDeclarationExtensions) || fileExtensionIs(fileName, ".ts" /* Ts */) &&
|
|
33483
|
+
return fileExtensionIsOneOf(fileName, supportedDeclarationExtensions) || fileExtensionIs(fileName, ".ts" /* Ts */) && getBaseFileName(fileName).includes(".d.");
|
|
33485
33484
|
}
|
|
33486
33485
|
function parseResolutionMode(mode, pos, end, reportDiagnostic) {
|
|
33487
33486
|
if (!mode) {
|
|
@@ -35196,7 +35195,7 @@ function parseListTypeOption(opt, value = "", errors) {
|
|
|
35196
35195
|
if (startsWith(value, "-")) {
|
|
35197
35196
|
return void 0;
|
|
35198
35197
|
}
|
|
35199
|
-
if (opt.type === "listOrElement" && !
|
|
35198
|
+
if (opt.type === "listOrElement" && !value.includes(",")) {
|
|
35200
35199
|
return validateJsonOptionValue(opt, value, errors);
|
|
35201
35200
|
}
|
|
35202
35201
|
if (value === "") {
|
|
@@ -36220,7 +36219,7 @@ function parseConfig(json, sourceFile, host, basePath, configFileName, resolutio
|
|
|
36220
36219
|
var _a;
|
|
36221
36220
|
basePath = normalizeSlashes(basePath);
|
|
36222
36221
|
const resolvedPath = getNormalizedAbsolutePath(configFileName || "", basePath);
|
|
36223
|
-
if (resolutionStack.
|
|
36222
|
+
if (resolutionStack.includes(resolvedPath)) {
|
|
36224
36223
|
errors.push(createCompilerDiagnostic(Diagnostics.Circularity_detected_while_resolving_configuration_Colon_0, [...resolutionStack, resolvedPath].join(" -> ")));
|
|
36225
36224
|
return { raw: json || convertToObject(sourceFile, errors) };
|
|
36226
36225
|
}
|
|
@@ -37954,7 +37953,7 @@ function nodeModuleNameResolverWorker(features, moduleName, containingDirectory,
|
|
|
37954
37953
|
result = tryResolve(extensions, state);
|
|
37955
37954
|
}
|
|
37956
37955
|
let legacyResult;
|
|
37957
|
-
if (((_a = result == null ? void 0 : result.value) == null ? void 0 : _a.isExternalLibraryImport) && !isConfigLookup && extensions & (1 /* TypeScript */ | 4 /* Declaration */) && features & 8 /* Exports */ && !isExternalModuleNameRelative(moduleName) && !extensionIsOk(1 /* TypeScript */ | 4 /* Declaration */, result.value.resolved.extension) && conditions.
|
|
37956
|
+
if (((_a = result == null ? void 0 : result.value) == null ? void 0 : _a.isExternalLibraryImport) && !isConfigLookup && extensions & (1 /* TypeScript */ | 4 /* Declaration */) && features & 8 /* Exports */ && !isExternalModuleNameRelative(moduleName) && !extensionIsOk(1 /* TypeScript */ | 4 /* Declaration */, result.value.resolved.extension) && conditions.includes("import")) {
|
|
37958
37957
|
traceIfEnabled(state, Diagnostics.Resolution_of_non_relative_name_failed_trying_with_modern_Node_resolution_features_disabled_to_see_if_npm_library_needs_configuration_update);
|
|
37959
37958
|
const diagnosticState = {
|
|
37960
37959
|
...state,
|
|
@@ -37998,7 +37997,7 @@ function nodeModuleNameResolverWorker(features, moduleName, containingDirectory,
|
|
|
37998
37997
|
resolved2 = loadModuleFromSelfNameReference(extensions2, moduleName, containingDirectory, state2, cache, redirectedReference);
|
|
37999
37998
|
}
|
|
38000
37999
|
if (!resolved2) {
|
|
38001
|
-
if (moduleName.
|
|
38000
|
+
if (moduleName.includes(":")) {
|
|
38002
38001
|
if (traceEnabled) {
|
|
38003
38002
|
trace(host, Diagnostics.Skipping_module_0_that_looks_like_an_absolute_URI_target_file_types_Colon_1, moduleName, formatExtensions(extensions2));
|
|
38004
38003
|
}
|
|
@@ -38088,7 +38087,7 @@ function nodeLoadModuleByRelativeName(extensions, candidate, onlyRecordFailures,
|
|
|
38088
38087
|
}
|
|
38089
38088
|
var nodeModulesPathPart = "/node_modules/";
|
|
38090
38089
|
function pathContainsNodeModules(path) {
|
|
38091
|
-
return
|
|
38090
|
+
return path.includes(nodeModulesPathPart);
|
|
38092
38091
|
}
|
|
38093
38092
|
function parseNodeModuleFromPath(resolved, isFolder) {
|
|
38094
38093
|
const path = normalizePath(resolved);
|
|
@@ -38124,7 +38123,7 @@ function loadModuleFromFile(extensions, candidate, onlyRecordFailures, state) {
|
|
|
38124
38123
|
}
|
|
38125
38124
|
function loadModuleFromFileNoImplicitExtensions(extensions, candidate, onlyRecordFailures, state) {
|
|
38126
38125
|
const filename = getBaseFileName(candidate);
|
|
38127
|
-
if (filename.
|
|
38126
|
+
if (!filename.includes(".")) {
|
|
38128
38127
|
return void 0;
|
|
38129
38128
|
}
|
|
38130
38129
|
let extensionless = removeFileExtension(candidate);
|
|
@@ -38548,7 +38547,7 @@ function comparePatternKeys(a, b) {
|
|
|
38548
38547
|
}
|
|
38549
38548
|
function loadModuleFromImportsOrExports(extensions, state, cache, redirectedReference, moduleName, lookupTable, scope, isImports) {
|
|
38550
38549
|
const loadModuleFromTargetImportOrExport = getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirectedReference, moduleName, scope, isImports);
|
|
38551
|
-
if (!endsWith(moduleName, directorySeparator) && moduleName.
|
|
38550
|
+
if (!endsWith(moduleName, directorySeparator) && !moduleName.includes("*") && hasProperty(lookupTable, moduleName)) {
|
|
38552
38551
|
const target = lookupTable[moduleName];
|
|
38553
38552
|
return loadModuleFromTargetImportOrExport(
|
|
38554
38553
|
target,
|
|
@@ -38559,7 +38558,7 @@ function loadModuleFromImportsOrExports(extensions, state, cache, redirectedRefe
|
|
|
38559
38558
|
moduleName
|
|
38560
38559
|
);
|
|
38561
38560
|
}
|
|
38562
|
-
const expandingKeys = sort(filter(getOwnKeys(lookupTable), (k) => k.
|
|
38561
|
+
const expandingKeys = sort(filter(getOwnKeys(lookupTable), (k) => k.includes("*") || endsWith(k, "/")), comparePatternKeys);
|
|
38563
38562
|
for (const potentialTarget of expandingKeys) {
|
|
38564
38563
|
if (state.features & 16 /* ExportsPatternTrailers */ && matchesPatternWithTrailer(potentialTarget, moduleName)) {
|
|
38565
38564
|
const target = lookupTable[potentialTarget];
|
|
@@ -38653,7 +38652,7 @@ function getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirec
|
|
|
38653
38652
|
}
|
|
38654
38653
|
const parts = pathIsRelative(target) ? getPathComponents(target).slice(1) : getPathComponents(target);
|
|
38655
38654
|
const partsAfterFirst = parts.slice(1);
|
|
38656
|
-
if (partsAfterFirst.
|
|
38655
|
+
if (partsAfterFirst.includes("..") || partsAfterFirst.includes(".") || partsAfterFirst.includes("node_modules")) {
|
|
38657
38656
|
if (state.traceEnabled) {
|
|
38658
38657
|
trace(state.host, Diagnostics.package_json_scope_0_has_invalid_type_for_target_of_specifier_1, scope.packageDirectory, moduleName);
|
|
38659
38658
|
}
|
|
@@ -38664,7 +38663,7 @@ function getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirec
|
|
|
38664
38663
|
}
|
|
38665
38664
|
const resolvedTarget = combinePaths(scope.packageDirectory, target);
|
|
38666
38665
|
const subpathParts = getPathComponents(subpath);
|
|
38667
|
-
if (subpathParts.
|
|
38666
|
+
if (subpathParts.includes("..") || subpathParts.includes(".") || subpathParts.includes("node_modules")) {
|
|
38668
38667
|
if (state.traceEnabled) {
|
|
38669
38668
|
trace(state.host, Diagnostics.package_json_scope_0_has_invalid_type_for_target_of_specifier_1, scope.packageDirectory, moduleName);
|
|
38670
38669
|
}
|
|
@@ -38691,7 +38690,7 @@ function getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirec
|
|
|
38691
38690
|
if (!Array.isArray(target)) {
|
|
38692
38691
|
traceIfEnabled(state, Diagnostics.Entering_conditional_exports);
|
|
38693
38692
|
for (const condition of getOwnKeys(target)) {
|
|
38694
|
-
if (condition === "default" || state.conditions.
|
|
38693
|
+
if (condition === "default" || state.conditions.includes(condition) || isApplicableVersionedTypesKey(state.conditions, condition)) {
|
|
38695
38694
|
traceIfEnabled(state, Diagnostics.Matched_0_condition_1, isImports ? "imports" : "exports", condition);
|
|
38696
38695
|
const subTarget = target[condition];
|
|
38697
38696
|
const result = loadModuleFromTargetImportOrExport(subTarget, subpath, pattern, key);
|
|
@@ -38752,7 +38751,7 @@ function getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirec
|
|
|
38752
38751
|
}
|
|
38753
38752
|
function tryLoadInputFileForPath(finalPath, entry, packagePath, isImports2) {
|
|
38754
38753
|
var _a, _b, _c, _d;
|
|
38755
|
-
if (!state.isConfigLookup && (state.compilerOptions.declarationDir || state.compilerOptions.outDir) && finalPath.
|
|
38754
|
+
if (!state.isConfigLookup && (state.compilerOptions.declarationDir || state.compilerOptions.outDir) && !finalPath.includes("/node_modules/") && (state.compilerOptions.configFile ? containsPath(scope.packageDirectory, toAbsolutePath(state.compilerOptions.configFile.fileName), !useCaseSensitiveFileNames(state)) : true)) {
|
|
38756
38755
|
const getCanonicalFileName = hostGetCanonicalFileName({ useCaseSensitiveFileNames: () => useCaseSensitiveFileNames(state) });
|
|
38757
38756
|
const commonSourceDirGuesses = [];
|
|
38758
38757
|
if (state.compilerOptions.rootDir || state.compilerOptions.composite && state.compilerOptions.configFilePath) {
|
|
@@ -38826,7 +38825,7 @@ function getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirec
|
|
|
38826
38825
|
}
|
|
38827
38826
|
}
|
|
38828
38827
|
function isApplicableVersionedTypesKey(conditions, key) {
|
|
38829
|
-
if (conditions.
|
|
38828
|
+
if (!conditions.includes("types"))
|
|
38830
38829
|
return false;
|
|
38831
38830
|
if (!startsWith(key, "types@"))
|
|
38832
38831
|
return false;
|
|
@@ -39031,7 +39030,7 @@ function getPackageNameFromTypesPackageName(mangledName) {
|
|
|
39031
39030
|
return mangledName;
|
|
39032
39031
|
}
|
|
39033
39032
|
function unmangleScopedPackageName(typesPackageName) {
|
|
39034
|
-
return
|
|
39033
|
+
return typesPackageName.includes(mangledScopedPackageSeparator) ? "@" + typesPackageName.replace(mangledScopedPackageSeparator, directorySeparator) : typesPackageName;
|
|
39035
39034
|
}
|
|
39036
39035
|
function tryFindNonRelativeModuleNameInCache(cache, moduleName, mode, containingDirectory, redirectedReference, state) {
|
|
39037
39036
|
const result = cache && cache.getFromNonRelativeNameCache(moduleName, mode, containingDirectory, redirectedReference);
|
|
@@ -42661,12 +42660,12 @@ function tryGetModuleNameFromExports(options, targetFilePath, packageDirectory,
|
|
|
42661
42660
|
/*currentDirectory*/
|
|
42662
42661
|
void 0
|
|
42663
42662
|
);
|
|
42664
|
-
const mode2 = endsWith(k, "/") ? 1 /* Directory */ :
|
|
42663
|
+
const mode2 = endsWith(k, "/") ? 1 /* Directory */ : k.includes("*") ? 2 /* Pattern */ : 0 /* Exact */;
|
|
42665
42664
|
return tryGetModuleNameFromExports(options, targetFilePath, packageDirectory, subPackageName, exports[k], conditions, mode2);
|
|
42666
42665
|
});
|
|
42667
42666
|
} else {
|
|
42668
42667
|
for (const key of getOwnKeys(exports)) {
|
|
42669
|
-
if (key === "default" || conditions.
|
|
42668
|
+
if (key === "default" || conditions.includes(key) || isApplicableVersionedTypesKey(conditions, key)) {
|
|
42670
42669
|
const subTarget = exports[key];
|
|
42671
42670
|
const result = tryGetModuleNameFromExports(options, targetFilePath, packageDirectory, packageName, subTarget, conditions, mode);
|
|
42672
42671
|
if (result) {
|
|
@@ -42832,7 +42831,7 @@ function processEnding(fileName, allowedEndings, options, host) {
|
|
|
42832
42831
|
return fileName;
|
|
42833
42832
|
} else if (fileExtensionIsOneOf(fileName, [".d.mts" /* Dmts */, ".mts" /* Mts */, ".d.cts" /* Dcts */, ".cts" /* Cts */])) {
|
|
42834
42833
|
return noExtension + getJSExtensionForFile(fileName, options);
|
|
42835
|
-
} else if (!fileExtensionIsOneOf(fileName, [".d.ts" /* Dts */]) && fileExtensionIsOneOf(fileName, [".ts" /* Ts */]) &&
|
|
42834
|
+
} else if (!fileExtensionIsOneOf(fileName, [".d.ts" /* Dts */]) && fileExtensionIsOneOf(fileName, [".ts" /* Ts */]) && fileName.includes(".d.")) {
|
|
42836
42835
|
return tryGetRealFileNameForNonJsDeclarationFileName(fileName);
|
|
42837
42836
|
}
|
|
42838
42837
|
switch (allowedEndings[0]) {
|
|
@@ -42858,7 +42857,7 @@ function processEnding(fileName, allowedEndings, options, host) {
|
|
|
42858
42857
|
}
|
|
42859
42858
|
function tryGetRealFileNameForNonJsDeclarationFileName(fileName) {
|
|
42860
42859
|
const baseName = getBaseFileName(fileName);
|
|
42861
|
-
if (!endsWith(fileName, ".ts" /* Ts */) || !
|
|
42860
|
+
if (!endsWith(fileName, ".ts" /* Ts */) || !baseName.includes(".d.") || fileExtensionIsOneOf(baseName, [".d.ts" /* Dts */]))
|
|
42862
42861
|
return void 0;
|
|
42863
42862
|
const noExtension = removeExtension(fileName, ".ts" /* Ts */);
|
|
42864
42863
|
const ext = noExtension.substring(noExtension.lastIndexOf("."));
|
|
@@ -44418,6 +44417,9 @@ function createTypeChecker(host) {
|
|
|
44418
44417
|
const sourceFiles = host.getSourceFiles();
|
|
44419
44418
|
return sourceFiles.indexOf(declarationFile) <= sourceFiles.indexOf(useFile);
|
|
44420
44419
|
}
|
|
44420
|
+
if (!!(usage.flags & 16777216 /* JSDoc */) || isInTypeQuery(usage) || isInAmbientOrTypeNode(usage)) {
|
|
44421
|
+
return true;
|
|
44422
|
+
}
|
|
44421
44423
|
if (declaration.pos <= usage.pos && !(isPropertyDeclaration(declaration) && isThisProperty(usage.parent) && !declaration.initializer && !declaration.exclamationToken)) {
|
|
44422
44424
|
if (declaration.kind === 208 /* BindingElement */) {
|
|
44423
44425
|
const errorBindingElement = getAncestor(usage, 208 /* BindingElement */);
|
|
@@ -44447,9 +44449,6 @@ function createTypeChecker(host) {
|
|
|
44447
44449
|
if (usage.kind === 277 /* ExportAssignment */ && usage.isExportEquals) {
|
|
44448
44450
|
return true;
|
|
44449
44451
|
}
|
|
44450
|
-
if (!!(usage.flags & 16777216 /* JSDoc */) || isInTypeQuery(usage) || isInAmbientOrTypeNode(usage)) {
|
|
44451
|
-
return true;
|
|
44452
|
-
}
|
|
44453
44452
|
if (isUsedInFunctionOrInstanceProperty(usage, declaration)) {
|
|
44454
44453
|
if (emitStandardClassFields && getContainingClass(declaration) && (isPropertyDeclaration(declaration) || isParameterPropertyDeclaration(declaration, declaration.parent))) {
|
|
44455
44454
|
return !isPropertyImmediatelyReferencedWithinDeclaration(
|
|
@@ -48919,12 +48918,12 @@ function createTypeChecker(host) {
|
|
|
48919
48918
|
if (!specifier) {
|
|
48920
48919
|
specifier = getSpecifierForModuleSymbol(chain[0], context);
|
|
48921
48920
|
}
|
|
48922
|
-
if (!(context.flags & 67108864 /* AllowNodeModulesRelativePaths */) && getEmitModuleResolutionKind(compilerOptions) !== 1 /* Classic */ && specifier.
|
|
48921
|
+
if (!(context.flags & 67108864 /* AllowNodeModulesRelativePaths */) && getEmitModuleResolutionKind(compilerOptions) !== 1 /* Classic */ && specifier.includes("/node_modules/")) {
|
|
48923
48922
|
const oldSpecifier = specifier;
|
|
48924
48923
|
if (getEmitModuleResolutionKind(compilerOptions) === 3 /* Node16 */ || getEmitModuleResolutionKind(compilerOptions) === 99 /* NodeNext */) {
|
|
48925
48924
|
const swappedMode = (contextFile == null ? void 0 : contextFile.impliedNodeFormat) === 99 /* ESNext */ ? 1 /* CommonJS */ : 99 /* ESNext */;
|
|
48926
48925
|
specifier = getSpecifierForModuleSymbol(chain[0], context, swappedMode);
|
|
48927
|
-
if (specifier.
|
|
48926
|
+
if (specifier.includes("/node_modules/")) {
|
|
48928
48927
|
specifier = oldSpecifier;
|
|
48929
48928
|
} else {
|
|
48930
48929
|
assertion = factory.createImportTypeAssertionContainer(factory.createAssertClause(factory.createNodeArray([
|
|
@@ -49630,7 +49629,7 @@ function createTypeChecker(host) {
|
|
|
49630
49629
|
for (const group2 of groups) {
|
|
49631
49630
|
if (group2.length > 1) {
|
|
49632
49631
|
statements = [
|
|
49633
|
-
...filter(statements, (s) => group2.
|
|
49632
|
+
...filter(statements, (s) => !group2.includes(s)),
|
|
49634
49633
|
factory.createExportDeclaration(
|
|
49635
49634
|
/*modifiers*/
|
|
49636
49635
|
void 0,
|
|
@@ -50659,8 +50658,8 @@ function createTypeChecker(host) {
|
|
|
50659
50658
|
});
|
|
50660
50659
|
}
|
|
50661
50660
|
});
|
|
50662
|
-
Debug.assert(setter
|
|
50663
|
-
const paramSymbol = getSignatureFromDeclaration(setter).parameters[0];
|
|
50661
|
+
Debug.assert(!!setter);
|
|
50662
|
+
const paramSymbol = isFunctionLikeDeclaration(setter) ? getSignatureFromDeclaration(setter).parameters[0] : void 0;
|
|
50664
50663
|
result.push(setTextRange(
|
|
50665
50664
|
factory.createSetAccessorDeclaration(
|
|
50666
50665
|
factory.createModifiersFromModifierFlags(flag),
|
|
@@ -51436,7 +51435,7 @@ function createTypeChecker(host) {
|
|
|
51436
51435
|
const pattern = declaration.parent;
|
|
51437
51436
|
if (strictNullChecks && declaration.flags & 33554432 /* Ambient */ && isParameterDeclaration(declaration)) {
|
|
51438
51437
|
parentType = getNonNullableType(parentType);
|
|
51439
|
-
} else if (strictNullChecks && pattern.parent.initializer && !(
|
|
51438
|
+
} else if (strictNullChecks && pattern.parent.initializer && !hasTypeFacts(getTypeOfInitializer(pattern.parent.initializer), 65536 /* EQUndefined */)) {
|
|
51440
51439
|
parentType = getTypeWithFacts(parentType, 524288 /* NEUndefined */);
|
|
51441
51440
|
}
|
|
51442
51441
|
let type;
|
|
@@ -51479,7 +51478,7 @@ function createTypeChecker(host) {
|
|
|
51479
51478
|
return type;
|
|
51480
51479
|
}
|
|
51481
51480
|
if (getEffectiveTypeAnnotationNode(walkUpBindingElementsAndPatterns(declaration))) {
|
|
51482
|
-
return strictNullChecks && !(
|
|
51481
|
+
return strictNullChecks && !hasTypeFacts(checkDeclarationInitializer(declaration, 0 /* Normal */), 16777216 /* IsUndefined */) ? getNonUndefinedType(type) : type;
|
|
51483
51482
|
}
|
|
51484
51483
|
return widenTypeInferredFromInitializer(declaration, getUnionType([getNonUndefinedType(type), checkDeclarationInitializer(declaration, 0 /* Normal */)], 2 /* Subtype */));
|
|
51485
51484
|
}
|
|
@@ -59587,7 +59586,7 @@ function createTypeChecker(host) {
|
|
|
59587
59586
|
if (sourceType && targetType) {
|
|
59588
59587
|
const sourceSig = checkMode & 3 /* Callback */ ? void 0 : getSingleCallSignature(getNonNullableType(sourceType));
|
|
59589
59588
|
const targetSig = checkMode & 3 /* Callback */ ? void 0 : getSingleCallSignature(getNonNullableType(targetType));
|
|
59590
|
-
const callbacks = sourceSig && targetSig && !getTypePredicateOfSignature(sourceSig) && !getTypePredicateOfSignature(targetSig) &&
|
|
59589
|
+
const callbacks = sourceSig && targetSig && !getTypePredicateOfSignature(sourceSig) && !getTypePredicateOfSignature(targetSig) && getTypeFacts(sourceType, 50331648 /* IsUndefinedOrNull */) === getTypeFacts(targetType, 50331648 /* IsUndefinedOrNull */);
|
|
59591
59590
|
let related = callbacks ? compareSignaturesRelated(targetSig, sourceSig, checkMode & 8 /* StrictArity */ | (strictVariance ? 2 /* StrictCallback */ : 1 /* BivariantCallback */), reportErrors2, errorReporter, incompatibleErrorReporter, compareTypes, reportUnreliableMarkers) : !(checkMode & 3 /* Callback */) && !strictVariance && compareTypes(
|
|
59592
59591
|
sourceType,
|
|
59593
59592
|
targetType,
|
|
@@ -62744,7 +62743,7 @@ function createTypeChecker(host) {
|
|
|
62744
62743
|
return value.base10Value === "0";
|
|
62745
62744
|
}
|
|
62746
62745
|
function removeDefinitelyFalsyTypes(type) {
|
|
62747
|
-
return filterType(type, (t) =>
|
|
62746
|
+
return filterType(type, (t) => hasTypeFacts(t, 4194304 /* Truthy */));
|
|
62748
62747
|
}
|
|
62749
62748
|
function extractDefinitelyFalsyTypes(type) {
|
|
62750
62749
|
return mapType(type, getDefinitelyFalsyPartOfType);
|
|
@@ -63007,7 +63006,7 @@ function createTypeChecker(host) {
|
|
|
63007
63006
|
const param = declaration;
|
|
63008
63007
|
if (isIdentifier(param.name)) {
|
|
63009
63008
|
const originalKeywordKind = identifierToKeywordKind(param.name);
|
|
63010
|
-
if ((isCallSignatureDeclaration(param.parent) || isMethodSignature(param.parent) || isFunctionTypeNode(param.parent)) && param.parent.parameters.
|
|
63009
|
+
if ((isCallSignatureDeclaration(param.parent) || isMethodSignature(param.parent) || isFunctionTypeNode(param.parent)) && param.parent.parameters.includes(param) && (resolveName(
|
|
63011
63010
|
param,
|
|
63012
63011
|
param.name.escapedText,
|
|
63013
63012
|
788968 /* Type */,
|
|
@@ -64489,7 +64488,13 @@ function createTypeChecker(host) {
|
|
|
64489
64488
|
const resolved = resolveStructuredTypeMembers(type);
|
|
64490
64489
|
return !!(resolved.callSignatures.length || resolved.constructSignatures.length || resolved.members.get("bind") && isTypeSubtypeOf(type, globalFunctionType));
|
|
64491
64490
|
}
|
|
64492
|
-
function getTypeFacts(type) {
|
|
64491
|
+
function getTypeFacts(type, mask) {
|
|
64492
|
+
return getTypeFactsWorker(type, mask) & mask;
|
|
64493
|
+
}
|
|
64494
|
+
function hasTypeFacts(type, mask) {
|
|
64495
|
+
return getTypeFacts(type, mask) !== 0;
|
|
64496
|
+
}
|
|
64497
|
+
function getTypeFactsWorker(type, callerOnlyNeeds) {
|
|
64493
64498
|
if (type.flags & (2097152 /* Intersection */ | 465829888 /* Instantiable */)) {
|
|
64494
64499
|
type = getBaseConstraintOfType(type) || unknownType;
|
|
64495
64500
|
}
|
|
@@ -64522,6 +64527,10 @@ function createTypeChecker(host) {
|
|
|
64522
64527
|
return strictNullChecks ? type === falseType || type === regularFalseType ? 12121864 /* FalseStrictFacts */ : 7927560 /* TrueStrictFacts */ : type === falseType || type === regularFalseType ? 12580616 /* FalseFacts */ : 16774920 /* TrueFacts */;
|
|
64523
64528
|
}
|
|
64524
64529
|
if (flags & 524288 /* Object */) {
|
|
64530
|
+
const possibleFacts = strictNullChecks ? 83427327 /* EmptyObjectStrictFacts */ | 7880640 /* FunctionStrictFacts */ | 7888800 /* ObjectStrictFacts */ : 83886079 /* EmptyObjectFacts */ | 16728e3 /* FunctionFacts */ | 16736160 /* ObjectFacts */;
|
|
64531
|
+
if ((callerOnlyNeeds & possibleFacts) === 0) {
|
|
64532
|
+
return 0;
|
|
64533
|
+
}
|
|
64525
64534
|
return getObjectFlags(type) & 16 /* Anonymous */ && isEmptyObjectType(type) ? strictNullChecks ? 83427327 /* EmptyObjectStrictFacts */ : 83886079 /* EmptyObjectFacts */ : isFunctionObjectType(type) ? strictNullChecks ? 7880640 /* FunctionStrictFacts */ : 16728e3 /* FunctionFacts */ : strictNullChecks ? 7888800 /* ObjectStrictFacts */ : 16736160 /* ObjectFacts */;
|
|
64526
64535
|
}
|
|
64527
64536
|
if (flags & 16384 /* Void */) {
|
|
@@ -64543,20 +64552,20 @@ function createTypeChecker(host) {
|
|
|
64543
64552
|
return 0 /* None */;
|
|
64544
64553
|
}
|
|
64545
64554
|
if (flags & 1048576 /* Union */) {
|
|
64546
|
-
return reduceLeft(type.types, (facts, t) => facts |
|
|
64555
|
+
return reduceLeft(type.types, (facts, t) => facts | getTypeFactsWorker(t, callerOnlyNeeds), 0 /* None */);
|
|
64547
64556
|
}
|
|
64548
64557
|
if (flags & 2097152 /* Intersection */) {
|
|
64549
|
-
return getIntersectionTypeFacts(type);
|
|
64558
|
+
return getIntersectionTypeFacts(type, callerOnlyNeeds);
|
|
64550
64559
|
}
|
|
64551
64560
|
return 83886079 /* UnknownFacts */;
|
|
64552
64561
|
}
|
|
64553
|
-
function getIntersectionTypeFacts(type) {
|
|
64562
|
+
function getIntersectionTypeFacts(type, callerOnlyNeeds) {
|
|
64554
64563
|
const ignoreObjects = maybeTypeOfKind(type, 402784252 /* Primitive */);
|
|
64555
64564
|
let oredFacts = 0 /* None */;
|
|
64556
64565
|
let andedFacts = 134217727 /* All */;
|
|
64557
64566
|
for (const t of type.types) {
|
|
64558
64567
|
if (!(ignoreObjects && t.flags & 524288 /* Object */)) {
|
|
64559
|
-
const f =
|
|
64568
|
+
const f = getTypeFactsWorker(t, callerOnlyNeeds);
|
|
64560
64569
|
oredFacts |= f;
|
|
64561
64570
|
andedFacts &= f;
|
|
64562
64571
|
}
|
|
@@ -64564,19 +64573,19 @@ function createTypeChecker(host) {
|
|
|
64564
64573
|
return oredFacts & 8256 /* OrFactsMask */ | andedFacts & 134209471 /* AndFactsMask */;
|
|
64565
64574
|
}
|
|
64566
64575
|
function getTypeWithFacts(type, include) {
|
|
64567
|
-
return filterType(type, (t) => (
|
|
64576
|
+
return filterType(type, (t) => hasTypeFacts(t, include));
|
|
64568
64577
|
}
|
|
64569
64578
|
function getAdjustedTypeWithFacts(type, facts) {
|
|
64570
64579
|
const reduced = recombineUnknownType(getTypeWithFacts(strictNullChecks && type.flags & 2 /* Unknown */ ? unknownUnionType : type, facts));
|
|
64571
64580
|
if (strictNullChecks) {
|
|
64572
64581
|
switch (facts) {
|
|
64573
64582
|
case 524288 /* NEUndefined */:
|
|
64574
|
-
return mapType(reduced, (t) =>
|
|
64583
|
+
return mapType(reduced, (t) => hasTypeFacts(t, 65536 /* EQUndefined */) ? getIntersectionType([t, hasTypeFacts(t, 131072 /* EQNull */) && !maybeTypeOfKind(reduced, 65536 /* Null */) ? getUnionType([emptyObjectType, nullType]) : emptyObjectType]) : t);
|
|
64575
64584
|
case 1048576 /* NENull */:
|
|
64576
|
-
return mapType(reduced, (t) =>
|
|
64585
|
+
return mapType(reduced, (t) => hasTypeFacts(t, 131072 /* EQNull */) ? getIntersectionType([t, hasTypeFacts(t, 65536 /* EQUndefined */) && !maybeTypeOfKind(reduced, 32768 /* Undefined */) ? getUnionType([emptyObjectType, undefinedType]) : emptyObjectType]) : t);
|
|
64577
64586
|
case 2097152 /* NEUndefinedOrNull */:
|
|
64578
64587
|
case 4194304 /* Truthy */:
|
|
64579
|
-
return mapType(reduced, (t) =>
|
|
64588
|
+
return mapType(reduced, (t) => hasTypeFacts(t, 262144 /* EQUndefinedOrNull */) ? getGlobalNonNullableTypeInstantiation(t) : t);
|
|
64580
64589
|
}
|
|
64581
64590
|
}
|
|
64582
64591
|
return reduced;
|
|
@@ -65913,14 +65922,14 @@ function createTypeChecker(host) {
|
|
|
65913
65922
|
// the constituent based on its type facts. We use the strict subtype relation because it treats `object`
|
|
65914
65923
|
// as a subtype of `{}`, and we need the type facts check because function types are subtypes of `object`,
|
|
65915
65924
|
// but are classified as "function" according to `typeof`.
|
|
65916
|
-
isTypeRelatedTo(t, impliedType, strictSubtypeRelation) ?
|
|
65925
|
+
isTypeRelatedTo(t, impliedType, strictSubtypeRelation) ? hasTypeFacts(t, facts) ? t : neverType : (
|
|
65917
65926
|
// We next check if the consituent is a supertype of the implied type. If so, we substitute the implied
|
|
65918
65927
|
// type. This handles top types like `unknown` and `{}`, and supertypes like `{ toString(): string }`.
|
|
65919
65928
|
isTypeSubtypeOf(impliedType, t) ? impliedType : (
|
|
65920
65929
|
// Neither the constituent nor the implied type is a subtype of the other, however their domains may still
|
|
65921
65930
|
// overlap. For example, an unconstrained type parameter and type `string`. If the type facts indicate
|
|
65922
65931
|
// possible overlap, we form an intersection. Otherwise, we eliminate the constituent.
|
|
65923
|
-
|
|
65932
|
+
hasTypeFacts(t, facts) ? getIntersectionType([t, impliedType]) : neverType
|
|
65924
65933
|
)
|
|
65925
65934
|
)
|
|
65926
65935
|
));
|
|
@@ -65934,7 +65943,7 @@ function createTypeChecker(host) {
|
|
|
65934
65943
|
const hasDefaultClause = clauseStart === clauseEnd || defaultIndex >= clauseStart && defaultIndex < clauseEnd;
|
|
65935
65944
|
if (hasDefaultClause) {
|
|
65936
65945
|
const notEqualFacts = getNotEqualFactsFromTypeofSwitch(clauseStart, clauseEnd, witnesses);
|
|
65937
|
-
return filterType(type, (t) =>
|
|
65946
|
+
return filterType(type, (t) => getTypeFacts(t, notEqualFacts) === notEqualFacts);
|
|
65938
65947
|
}
|
|
65939
65948
|
const clauseWitnesses = witnesses.slice(clauseStart, clauseEnd);
|
|
65940
65949
|
return getUnionType(map(clauseWitnesses, (text) => text ? narrowTypeByTypeName(type, text) : neverType));
|
|
@@ -66072,7 +66081,7 @@ function createTypeChecker(host) {
|
|
|
66072
66081
|
false
|
|
66073
66082
|
);
|
|
66074
66083
|
}
|
|
66075
|
-
if (strictNullChecks && assumeTrue && optionalChainContainsReference(predicateArgument, reference) && !(
|
|
66084
|
+
if (strictNullChecks && assumeTrue && optionalChainContainsReference(predicateArgument, reference) && !hasTypeFacts(predicate.type, 65536 /* EQUndefined */)) {
|
|
66076
66085
|
type = getAdjustedTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
|
|
66077
66086
|
}
|
|
66078
66087
|
const access = getDiscriminantPropertyAccess(predicateArgument, type);
|
|
@@ -66206,7 +66215,7 @@ function createTypeChecker(host) {
|
|
|
66206
66215
|
reportCircularityError(declaration.symbol);
|
|
66207
66216
|
return true;
|
|
66208
66217
|
}
|
|
66209
|
-
const containsUndefined = !!(
|
|
66218
|
+
const containsUndefined = !!hasTypeFacts(checkDeclarationInitializer(declaration, 0 /* Normal */), 16777216 /* IsUndefined */);
|
|
66210
66219
|
if (!popTypeResolution()) {
|
|
66211
66220
|
reportCircularityError(declaration.symbol);
|
|
66212
66221
|
return true;
|
|
@@ -66216,7 +66225,7 @@ function createTypeChecker(host) {
|
|
|
66216
66225
|
return links.parameterInitializerContainsUndefined;
|
|
66217
66226
|
}
|
|
66218
66227
|
function removeOptionalityFromDeclaredType(declaredType, declaration) {
|
|
66219
|
-
const removeUndefined = strictNullChecks && declaration.kind === 169 /* Parameter */ && declaration.initializer &&
|
|
66228
|
+
const removeUndefined = strictNullChecks && declaration.kind === 169 /* Parameter */ && declaration.initializer && hasTypeFacts(declaredType, 16777216 /* IsUndefined */) && !parameterInitializerContainsUndefined(declaration);
|
|
66220
66229
|
return removeUndefined ? getTypeWithFacts(declaredType, 524288 /* NEUndefined */) : declaredType;
|
|
66221
66230
|
}
|
|
66222
66231
|
function isConstraintPosition(type, node) {
|
|
@@ -68385,7 +68394,7 @@ function createTypeChecker(host) {
|
|
|
68385
68394
|
return getJsxElementTypeAt(node) || anyType;
|
|
68386
68395
|
}
|
|
68387
68396
|
function isHyphenatedJsxName(name) {
|
|
68388
|
-
return
|
|
68397
|
+
return name.includes("-");
|
|
68389
68398
|
}
|
|
68390
68399
|
function isJsxIntrinsicTagName(tagName) {
|
|
68391
68400
|
return isIdentifier(tagName) && isIntrinsicJsxName(tagName.escapedText) || isJsxNamespacedName(tagName);
|
|
@@ -69046,7 +69055,7 @@ function createTypeChecker(host) {
|
|
|
69046
69055
|
return checkNonNullType(checkExpression(node), node);
|
|
69047
69056
|
}
|
|
69048
69057
|
function isNullableType(type) {
|
|
69049
|
-
return
|
|
69058
|
+
return hasTypeFacts(type, 50331648 /* IsUndefinedOrNull */);
|
|
69050
69059
|
}
|
|
69051
69060
|
function getNonNullableTypeIfNeeded(type) {
|
|
69052
69061
|
return isNullableType(type) ? getNonNullableType(type) : type;
|
|
@@ -69092,7 +69101,7 @@ function createTypeChecker(host) {
|
|
|
69092
69101
|
error(node, Diagnostics.Object_is_of_type_unknown);
|
|
69093
69102
|
return errorType;
|
|
69094
69103
|
}
|
|
69095
|
-
const facts = getTypeFacts(type);
|
|
69104
|
+
const facts = getTypeFacts(type, 50331648 /* IsUndefinedOrNull */);
|
|
69096
69105
|
if (facts & 50331648 /* IsUndefinedOrNull */) {
|
|
69097
69106
|
reportError(node, facts);
|
|
69098
69107
|
const t = getNonNullableType(type);
|
|
@@ -72872,7 +72881,7 @@ function createTypeChecker(host) {
|
|
|
72872
72881
|
if (operandConstraint.flags & 3 /* AnyOrUnknown */) {
|
|
72873
72882
|
return (556800 /* AllTypeofNE */ & notEqualFacts) === 556800 /* AllTypeofNE */;
|
|
72874
72883
|
}
|
|
72875
|
-
return !someType(operandConstraint, (t) =>
|
|
72884
|
+
return !someType(operandConstraint, (t) => getTypeFacts(t, notEqualFacts) === notEqualFacts);
|
|
72876
72885
|
}
|
|
72877
72886
|
const type = checkExpressionCached(node.expression);
|
|
72878
72887
|
if (!isLiteralType(type)) {
|
|
@@ -73190,14 +73199,15 @@ function createTypeChecker(host) {
|
|
|
73190
73199
|
if (symbol) {
|
|
73191
73200
|
if (isReadonlySymbol(symbol)) {
|
|
73192
73201
|
error(expr, Diagnostics.The_operand_of_a_delete_operator_cannot_be_a_read_only_property);
|
|
73202
|
+
} else {
|
|
73203
|
+
checkDeleteExpressionMustBeOptional(expr, symbol);
|
|
73193
73204
|
}
|
|
73194
|
-
checkDeleteExpressionMustBeOptional(expr, symbol);
|
|
73195
73205
|
}
|
|
73196
73206
|
return booleanType;
|
|
73197
73207
|
}
|
|
73198
73208
|
function checkDeleteExpressionMustBeOptional(expr, symbol) {
|
|
73199
73209
|
const type = getTypeOfSymbol(symbol);
|
|
73200
|
-
if (strictNullChecks && !(type.flags & (3 /* AnyOrUnknown */ | 131072 /* Never */)) && !(exactOptionalPropertyTypes ? symbol.flags & 16777216 /* Optional */ :
|
|
73210
|
+
if (strictNullChecks && !(type.flags & (3 /* AnyOrUnknown */ | 131072 /* Never */)) && !(exactOptionalPropertyTypes ? symbol.flags & 16777216 /* Optional */ : hasTypeFacts(type, 16777216 /* IsUndefined */))) {
|
|
73201
73211
|
error(expr, Diagnostics.The_operand_of_a_delete_operator_must_be_optional);
|
|
73202
73212
|
}
|
|
73203
73213
|
}
|
|
@@ -73332,7 +73342,7 @@ function createTypeChecker(host) {
|
|
|
73332
73342
|
return getUnaryResultType(operandType);
|
|
73333
73343
|
case 54 /* ExclamationToken */:
|
|
73334
73344
|
checkTruthinessOfType(operandType, node.operand);
|
|
73335
|
-
const facts = getTypeFacts(operandType
|
|
73345
|
+
const facts = getTypeFacts(operandType, 4194304 /* Truthy */ | 8388608 /* Falsy */);
|
|
73336
73346
|
return facts === 4194304 /* Truthy */ ? falseType : facts === 8388608 /* Falsy */ ? trueType : booleanType;
|
|
73337
73347
|
case 46 /* PlusPlusToken */:
|
|
73338
73348
|
case 47 /* MinusMinusToken */:
|
|
@@ -73563,7 +73573,7 @@ function createTypeChecker(host) {
|
|
|
73563
73573
|
if (exprOrAssignment.kind === 304 /* ShorthandPropertyAssignment */) {
|
|
73564
73574
|
const prop = exprOrAssignment;
|
|
73565
73575
|
if (prop.objectAssignmentInitializer) {
|
|
73566
|
-
if (strictNullChecks && !(
|
|
73576
|
+
if (strictNullChecks && !hasTypeFacts(checkExpression(prop.objectAssignmentInitializer), 16777216 /* IsUndefined */)) {
|
|
73567
73577
|
sourceType = getTypeWithFacts(sourceType, 524288 /* NEUndefined */);
|
|
73568
73578
|
}
|
|
73569
73579
|
checkBinaryLikeExpression(prop.name, prop.equalsToken, prop.objectAssignmentInitializer, checkMode);
|
|
@@ -73975,7 +73985,7 @@ function createTypeChecker(host) {
|
|
|
73975
73985
|
return checkInExpression(left, right, leftType, rightType);
|
|
73976
73986
|
case 56 /* AmpersandAmpersandToken */:
|
|
73977
73987
|
case 77 /* AmpersandAmpersandEqualsToken */: {
|
|
73978
|
-
const resultType2 =
|
|
73988
|
+
const resultType2 = hasTypeFacts(leftType, 4194304 /* Truthy */) ? getUnionType([extractDefinitelyFalsyTypes(strictNullChecks ? leftType : getBaseTypeOfLiteralType(rightType)), rightType]) : leftType;
|
|
73979
73989
|
if (operator === 77 /* AmpersandAmpersandEqualsToken */) {
|
|
73980
73990
|
checkAssignmentOperator(rightType);
|
|
73981
73991
|
}
|
|
@@ -73983,7 +73993,7 @@ function createTypeChecker(host) {
|
|
|
73983
73993
|
}
|
|
73984
73994
|
case 57 /* BarBarToken */:
|
|
73985
73995
|
case 76 /* BarBarEqualsToken */: {
|
|
73986
|
-
const resultType2 =
|
|
73996
|
+
const resultType2 = hasTypeFacts(leftType, 8388608 /* Falsy */) ? getUnionType([getNonNullableType(removeDefinitelyFalsyTypes(leftType)), rightType], 2 /* Subtype */) : leftType;
|
|
73987
73997
|
if (operator === 76 /* BarBarEqualsToken */) {
|
|
73988
73998
|
checkAssignmentOperator(rightType);
|
|
73989
73999
|
}
|
|
@@ -73991,7 +74001,7 @@ function createTypeChecker(host) {
|
|
|
73991
74001
|
}
|
|
73992
74002
|
case 61 /* QuestionQuestionToken */:
|
|
73993
74003
|
case 78 /* QuestionQuestionEqualsToken */: {
|
|
73994
|
-
const resultType2 =
|
|
74004
|
+
const resultType2 = hasTypeFacts(leftType, 262144 /* EQUndefinedOrNull */) ? getUnionType([getNonNullableType(leftType), rightType], 2 /* Subtype */) : leftType;
|
|
73995
74005
|
if (operator === 78 /* QuestionQuestionEqualsToken */) {
|
|
73996
74006
|
checkAssignmentOperator(rightType);
|
|
73997
74007
|
}
|
|
@@ -77308,7 +77318,7 @@ function createTypeChecker(host) {
|
|
|
77308
77318
|
}
|
|
77309
77319
|
const type = location === condExpr2 ? condType : checkTruthinessExpression(location);
|
|
77310
77320
|
const isPropertyExpressionCast = isPropertyAccessExpression(location) && isTypeAssertion(location.expression);
|
|
77311
|
-
if (!(
|
|
77321
|
+
if (!hasTypeFacts(type, 4194304 /* Truthy */) || isPropertyExpressionCast)
|
|
77312
77322
|
return;
|
|
77313
77323
|
const callSignatures = getSignaturesOfType(type, 0 /* Call */);
|
|
77314
77324
|
const isPromise = !!getAwaitedTypeOfPromise(type);
|
|
@@ -83547,7 +83557,7 @@ function createTypeChecker(host) {
|
|
|
83547
83557
|
return false;
|
|
83548
83558
|
}
|
|
83549
83559
|
function checkGrammarNumericLiteral(node) {
|
|
83550
|
-
const isFractional = getTextOfNode(node).
|
|
83560
|
+
const isFractional = getTextOfNode(node).includes(".");
|
|
83551
83561
|
const isScientific = node.numericLiteralFlags & 16 /* Scientific */;
|
|
83552
83562
|
if (isFractional || isScientific) {
|
|
83553
83563
|
return;
|
|
@@ -106522,7 +106532,7 @@ function getDeclarationDiagnostics(host, resolver, file) {
|
|
|
106522
106532
|
}
|
|
106523
106533
|
function hasInternalAnnotation(range, currentSourceFile) {
|
|
106524
106534
|
const comment = currentSourceFile.text.substring(range.pos, range.end);
|
|
106525
|
-
return
|
|
106535
|
+
return comment.includes("@internal");
|
|
106526
106536
|
}
|
|
106527
106537
|
function isInternalDeclaration(node, currentSourceFile) {
|
|
106528
106538
|
const parseTreeNode = getParseTreeNode(node);
|
|
@@ -111001,7 +111011,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
111001
111011
|
/*jsxAttributeEscape*/
|
|
111002
111012
|
false
|
|
111003
111013
|
);
|
|
111004
|
-
return !(expression.numericLiteralFlags & 448 /* WithSpecifier */) && !
|
|
111014
|
+
return !(expression.numericLiteralFlags & 448 /* WithSpecifier */) && !text.includes(tokenToString(25 /* DotToken */)) && !text.includes(String.fromCharCode(69 /* E */)) && !text.includes(String.fromCharCode(101 /* e */));
|
|
111005
111015
|
} else if (isAccessExpression(expression)) {
|
|
111006
111016
|
const constantValue = getConstantValue(expression);
|
|
111007
111017
|
return typeof constantValue === "number" && isFinite(constantValue) && constantValue >= 0 && Math.floor(constantValue) === constantValue;
|
|
@@ -115834,7 +115844,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
115834
115844
|
const resultFromDts = getRedirectReferenceForResolutionFromSourceOfProject(file.path);
|
|
115835
115845
|
if (resultFromDts)
|
|
115836
115846
|
return resultFromDts;
|
|
115837
|
-
if (!host.realpath || !options.preserveSymlinks || !
|
|
115847
|
+
if (!host.realpath || !options.preserveSymlinks || !file.originalFileName.includes(nodeModulesPathPart))
|
|
115838
115848
|
return void 0;
|
|
115839
115849
|
const realDeclarationPath = toPath3(host.realpath(file.originalFileName));
|
|
115840
115850
|
return realDeclarationPath === file.path ? void 0 : getRedirectReferenceForResolutionFromSourceOfProject(realDeclarationPath);
|
|
@@ -117092,7 +117102,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
117092
117102
|
const path = toPath3(fileName);
|
|
117093
117103
|
if (useSourceOfProjectReferenceRedirect) {
|
|
117094
117104
|
let source = getSourceOfProjectReferenceRedirect(path);
|
|
117095
|
-
if (!source && host.realpath && options.preserveSymlinks && isDeclarationFileName(fileName) &&
|
|
117105
|
+
if (!source && host.realpath && options.preserveSymlinks && isDeclarationFileName(fileName) && fileName.includes(nodeModulesPathPart)) {
|
|
117096
117106
|
const realPath2 = toPath3(host.realpath(fileName));
|
|
117097
117107
|
if (realPath2 !== path)
|
|
117098
117108
|
source = getSourceOfProjectReferenceRedirect(realPath2);
|
|
@@ -118452,7 +118462,7 @@ function updateHostForUseSourceOfProjectReferenceRedirect(host) {
|
|
|
118452
118462
|
var _a;
|
|
118453
118463
|
if (!host.getResolvedProjectReferences() || containsIgnoredPath(directory))
|
|
118454
118464
|
return;
|
|
118455
|
-
if (!originalRealpath || !
|
|
118465
|
+
if (!originalRealpath || !directory.includes(nodeModulesPathPart))
|
|
118456
118466
|
return;
|
|
118457
118467
|
const symlinkCache = host.getSymlinkCache();
|
|
118458
118468
|
const directoryPath = ensureTrailingDirectorySeparator(host.toPath(directory));
|
|
@@ -118480,7 +118490,7 @@ function updateHostForUseSourceOfProjectReferenceRedirect(host) {
|
|
|
118480
118490
|
if (!symlinkedDirectories)
|
|
118481
118491
|
return false;
|
|
118482
118492
|
const fileOrDirectoryPath = host.toPath(fileOrDirectory);
|
|
118483
|
-
if (!
|
|
118493
|
+
if (!fileOrDirectoryPath.includes(nodeModulesPathPart))
|
|
118484
118494
|
return false;
|
|
118485
118495
|
if (isFile && ((_a = symlinkCache.getSymlinkedFiles()) == null ? void 0 : _a.has(fileOrDirectoryPath)))
|
|
118486
118496
|
return true;
|
|
@@ -120338,7 +120348,7 @@ function removeIgnoredPath(path) {
|
|
|
120338
120348
|
if (endsWith(path, "/node_modules/.staging")) {
|
|
120339
120349
|
return removeSuffix(path, "/.staging");
|
|
120340
120350
|
}
|
|
120341
|
-
return some(ignoredPaths, (searchPath) =>
|
|
120351
|
+
return some(ignoredPaths, (searchPath) => path.includes(searchPath)) ? void 0 : path;
|
|
120342
120352
|
}
|
|
120343
120353
|
function perceivedOsRootLengthForWatching(pathComponents2, length2) {
|
|
120344
120354
|
if (length2 <= 1)
|
|
@@ -124754,7 +124764,7 @@ function createColors(sys2) {
|
|
|
124754
124764
|
function bold(str) {
|
|
124755
124765
|
return `\x1B[1m${str}\x1B[22m`;
|
|
124756
124766
|
}
|
|
124757
|
-
const isWindows = sys2.getEnvironmentVariable("OS") &&
|
|
124767
|
+
const isWindows = sys2.getEnvironmentVariable("OS") && sys2.getEnvironmentVariable("OS").toLowerCase().includes("windows");
|
|
124758
124768
|
const isWindowsTerminal = sys2.getEnvironmentVariable("WT_SESSION");
|
|
124759
124769
|
const isVSCode = sys2.getEnvironmentVariable("TERM_PROGRAM") && sys2.getEnvironmentVariable("TERM_PROGRAM") === "vscode";
|
|
124760
124770
|
function blue(str) {
|