typescript 4.8.2 → 4.8.3
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 +111 -84
- package/lib/tsserver.js +120 -94
- package/lib/tsserverlibrary.d.ts +0 -1
- package/lib/tsserverlibrary.js +119 -93
- package/lib/typescript.js +112 -86
- package/lib/typescriptServices.js +112 -86
- package/lib/typingsInstaller.js +112 -86
- package/package.json +1 -1
package/lib/typescript.js
CHANGED
|
@@ -294,7 +294,7 @@ var ts;
|
|
|
294
294
|
// The following is baselined as a literal template type without intervention
|
|
295
295
|
/** The version of the TypeScript compiler release */
|
|
296
296
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
297
|
-
ts.version = "4.8.
|
|
297
|
+
ts.version = "4.8.3";
|
|
298
298
|
/* @internal */
|
|
299
299
|
var Comparison;
|
|
300
300
|
(function (Comparison) {
|
|
@@ -9060,7 +9060,7 @@ var ts;
|
|
|
9060
9060
|
Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_save_dev_types_Slashnode_and_then_add_node_to_the_types_field_in_your_tsconfig: diag(2591, ts.DiagnosticCategory.Error, "Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_save_dev_types_Slashno_2591", "Cannot find name '{0}'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node` and then add 'node' to the types field in your tsconfig."),
|
|
9061
9061
|
Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_jQuery_Try_npm_i_save_dev_types_Slashjquery_and_then_add_jquery_to_the_types_field_in_your_tsconfig: diag(2592, ts.DiagnosticCategory.Error, "Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_jQuery_Try_npm_i_save_dev_types_Slash_2592", "Cannot find name '{0}'. Do you need to install type definitions for jQuery? Try `npm i --save-dev @types/jquery` and then add 'jquery' to the types field in your tsconfig."),
|
|
9062
9062
|
Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_a_test_runner_Try_npm_i_save_dev_types_Slashjest_or_npm_i_save_dev_types_Slashmocha_and_then_add_jest_or_mocha_to_the_types_field_in_your_tsconfig: diag(2593, ts.DiagnosticCategory.Error, "Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_a_test_runner_Try_npm_i_save_dev_type_2593", "Cannot find name '{0}'. Do you need to install type definitions for a test runner? Try `npm i --save-dev @types/jest` or `npm i --save-dev @types/mocha` and then add 'jest' or 'mocha' to the types field in your tsconfig."),
|
|
9063
|
-
|
|
9063
|
+
This_module_is_declared_with_export_and_can_only_be_used_with_a_default_import_when_using_the_0_flag: diag(2594, ts.DiagnosticCategory.Error, "This_module_is_declared_with_export_and_can_only_be_used_with_a_default_import_when_using_the_0_flag_2594", "This module is declared with 'export =', and can only be used with a default import when using the '{0}' flag."),
|
|
9064
9064
|
_0_can_only_be_imported_by_using_a_default_import: diag(2595, ts.DiagnosticCategory.Error, "_0_can_only_be_imported_by_using_a_default_import_2595", "'{0}' can only be imported by using a default import."),
|
|
9065
9065
|
_0_can_only_be_imported_by_turning_on_the_esModuleInterop_flag_and_using_a_default_import: diag(2596, ts.DiagnosticCategory.Error, "_0_can_only_be_imported_by_turning_on_the_esModuleInterop_flag_and_using_a_default_import_2596", "'{0}' can only be imported by turning on the 'esModuleInterop' flag and using a default import."),
|
|
9066
9066
|
_0_can_only_be_imported_by_using_a_require_call_or_by_using_a_default_import: diag(2597, ts.DiagnosticCategory.Error, "_0_can_only_be_imported_by_using_a_require_call_or_by_using_a_default_import_2597", "'{0}' can only be imported by using a 'require' call or by using a default import."),
|
|
@@ -44821,7 +44821,7 @@ var ts;
|
|
|
44821
44821
|
var _a, _b;
|
|
44822
44822
|
if (path === undefined)
|
|
44823
44823
|
return path;
|
|
44824
|
-
return ts.
|
|
44824
|
+
return ts.getNormalizedAbsolutePath(path, (_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a));
|
|
44825
44825
|
}
|
|
44826
44826
|
function combineDirectoryPath(root, dir) {
|
|
44827
44827
|
return ts.ensureTrailingDirectorySeparator(ts.combinePaths(root, dir));
|
|
@@ -44841,7 +44841,7 @@ var ts;
|
|
|
44841
44841
|
if ((extensions === Extensions.TypeScript || extensions === Extensions.JavaScript || extensions === Extensions.Json)
|
|
44842
44842
|
&& (state.compilerOptions.declarationDir || state.compilerOptions.outDir)
|
|
44843
44843
|
&& finalPath.indexOf("/node_modules/") === -1
|
|
44844
|
-
&& (state.compilerOptions.configFile ? ts.
|
|
44844
|
+
&& (state.compilerOptions.configFile ? ts.containsPath(scope.packageDirectory, toAbsolutePath(state.compilerOptions.configFile.fileName), !useCaseSensitiveFileNames()) : true)) {
|
|
44845
44845
|
// So that all means we'll only try these guesses for files outside `node_modules` in a directory where the `package.json` and `tsconfig.json` are siblings.
|
|
44846
44846
|
// Even with all that, we still don't know if the root of the output file structure will be (relative to the package file)
|
|
44847
44847
|
// `.`, `./src` or any other deeper directory structure. (If project references are used, it's definitely `.` by fiat, so that should be pretty common.)
|
|
@@ -44897,7 +44897,7 @@ var ts;
|
|
|
44897
44897
|
var candidateDirectories = getOutputDirectoriesForBaseDirectory(commonSourceDirGuess);
|
|
44898
44898
|
for (var _e = 0, candidateDirectories_1 = candidateDirectories; _e < candidateDirectories_1.length; _e++) {
|
|
44899
44899
|
var candidateDir = candidateDirectories_1[_e];
|
|
44900
|
-
if (ts.
|
|
44900
|
+
if (ts.containsPath(candidateDir, finalPath, !useCaseSensitiveFileNames())) {
|
|
44901
44901
|
// The matched export is looking up something in either the out declaration or js dir, now map the written path back into the source dir and source extension
|
|
44902
44902
|
var pathFragment = finalPath.slice(candidateDir.length + 1); // +1 to also remove directory seperator
|
|
44903
44903
|
var possibleInputBase = ts.combinePaths(commonSourceDirGuess, pathFragment);
|
|
@@ -51179,41 +51179,61 @@ var ts;
|
|
|
51179
51179
|
return typeof file.externalModuleIndicator !== "object" && !resolveExportByName(moduleSymbol, ts.escapeLeadingUnderscores("__esModule"), /*sourceNode*/ undefined, dontResolveAlias);
|
|
51180
51180
|
}
|
|
51181
51181
|
function getTargetOfImportClause(node, dontResolveAlias) {
|
|
51182
|
-
var _a;
|
|
51183
51182
|
var moduleSymbol = resolveExternalModuleName(node, node.parent.moduleSpecifier);
|
|
51184
51183
|
if (moduleSymbol) {
|
|
51185
|
-
|
|
51186
|
-
|
|
51187
|
-
|
|
51188
|
-
|
|
51189
|
-
|
|
51190
|
-
|
|
51191
|
-
|
|
51192
|
-
|
|
51193
|
-
|
|
51194
|
-
|
|
51195
|
-
|
|
51196
|
-
|
|
51197
|
-
|
|
51198
|
-
|
|
51199
|
-
|
|
51200
|
-
|
|
51201
|
-
|
|
51202
|
-
|
|
51203
|
-
|
|
51204
|
-
|
|
51205
|
-
|
|
51206
|
-
|
|
51184
|
+
return getTargetofModuleDefault(moduleSymbol, node, dontResolveAlias);
|
|
51185
|
+
}
|
|
51186
|
+
}
|
|
51187
|
+
function getTargetofModuleDefault(moduleSymbol, node, dontResolveAlias) {
|
|
51188
|
+
var _a;
|
|
51189
|
+
var exportDefaultSymbol;
|
|
51190
|
+
if (ts.isShorthandAmbientModuleSymbol(moduleSymbol)) {
|
|
51191
|
+
exportDefaultSymbol = moduleSymbol;
|
|
51192
|
+
}
|
|
51193
|
+
else {
|
|
51194
|
+
exportDefaultSymbol = resolveExportByName(moduleSymbol, "default" /* InternalSymbolName.Default */, node, dontResolveAlias);
|
|
51195
|
+
}
|
|
51196
|
+
var file = (_a = moduleSymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(ts.isSourceFile);
|
|
51197
|
+
var specifier = getModuleSpecifierForImportOrExport(node);
|
|
51198
|
+
if (!specifier) {
|
|
51199
|
+
return exportDefaultSymbol;
|
|
51200
|
+
}
|
|
51201
|
+
var hasDefaultOnly = isOnlyImportedAsDefault(specifier);
|
|
51202
|
+
var hasSyntheticDefault = canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, specifier);
|
|
51203
|
+
if (!exportDefaultSymbol && !hasSyntheticDefault && !hasDefaultOnly) {
|
|
51204
|
+
if (hasExportAssignmentSymbol(moduleSymbol)) {
|
|
51205
|
+
var compilerOptionName = moduleKind >= ts.ModuleKind.ES2015 ? "allowSyntheticDefaultImports" : "esModuleInterop";
|
|
51206
|
+
var exportEqualsSymbol = moduleSymbol.exports.get("export=" /* InternalSymbolName.ExportEquals */);
|
|
51207
|
+
var exportAssignment = exportEqualsSymbol.valueDeclaration;
|
|
51208
|
+
var err = error(node.name, ts.Diagnostics.Module_0_can_only_be_default_imported_using_the_1_flag, symbolToString(moduleSymbol), compilerOptionName);
|
|
51209
|
+
if (exportAssignment) {
|
|
51210
|
+
ts.addRelatedInfo(err, ts.createDiagnosticForNode(exportAssignment, ts.Diagnostics.This_module_is_declared_with_export_and_can_only_be_used_with_a_default_import_when_using_the_0_flag, compilerOptionName));
|
|
51207
51211
|
}
|
|
51208
51212
|
}
|
|
51209
|
-
else if (
|
|
51210
|
-
|
|
51211
|
-
var resolved = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias) || resolveSymbol(moduleSymbol, dontResolveAlias);
|
|
51212
|
-
markSymbolOfAliasDeclarationIfTypeOnly(node, moduleSymbol, resolved, /*overwriteTypeOnly*/ false);
|
|
51213
|
-
return resolved;
|
|
51213
|
+
else if (ts.isImportClause(node)) {
|
|
51214
|
+
reportNonDefaultExport(moduleSymbol, node);
|
|
51214
51215
|
}
|
|
51215
|
-
|
|
51216
|
-
|
|
51216
|
+
else {
|
|
51217
|
+
errorNoModuleMemberSymbol(moduleSymbol, moduleSymbol, node, ts.isImportOrExportSpecifier(node) && node.propertyName || node.name);
|
|
51218
|
+
}
|
|
51219
|
+
}
|
|
51220
|
+
else if (hasSyntheticDefault || hasDefaultOnly) {
|
|
51221
|
+
// per emit behavior, a synthetic default overrides a "real" .default member if `__esModule` is not present
|
|
51222
|
+
var resolved = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias) || resolveSymbol(moduleSymbol, dontResolveAlias);
|
|
51223
|
+
markSymbolOfAliasDeclarationIfTypeOnly(node, moduleSymbol, resolved, /*overwriteTypeOnly*/ false);
|
|
51224
|
+
return resolved;
|
|
51225
|
+
}
|
|
51226
|
+
markSymbolOfAliasDeclarationIfTypeOnly(node, exportDefaultSymbol, /*finalTarget*/ undefined, /*overwriteTypeOnly*/ false);
|
|
51227
|
+
return exportDefaultSymbol;
|
|
51228
|
+
}
|
|
51229
|
+
function getModuleSpecifierForImportOrExport(node) {
|
|
51230
|
+
switch (node.kind) {
|
|
51231
|
+
case 267 /* SyntaxKind.ImportClause */: return node.parent.moduleSpecifier;
|
|
51232
|
+
case 265 /* SyntaxKind.ImportEqualsDeclaration */: return ts.isExternalModuleReference(node.moduleReference) ? node.moduleReference.expression : undefined;
|
|
51233
|
+
case 268 /* SyntaxKind.NamespaceImport */: return node.parent.parent.moduleSpecifier;
|
|
51234
|
+
case 270 /* SyntaxKind.ImportSpecifier */: return node.parent.parent.parent.moduleSpecifier;
|
|
51235
|
+
case 275 /* SyntaxKind.ExportSpecifier */: return node.parent.parent.moduleSpecifier;
|
|
51236
|
+
default: return ts.Debug.assertNever(node);
|
|
51217
51237
|
}
|
|
51218
51238
|
}
|
|
51219
51239
|
function reportNonDefaultExport(moduleSymbol, node) {
|
|
@@ -51303,7 +51323,7 @@ var ts;
|
|
|
51303
51323
|
}
|
|
51304
51324
|
}
|
|
51305
51325
|
function getExternalModuleMember(node, specifier, dontResolveAlias) {
|
|
51306
|
-
var _a
|
|
51326
|
+
var _a;
|
|
51307
51327
|
if (dontResolveAlias === void 0) { dontResolveAlias = false; }
|
|
51308
51328
|
var moduleSpecifier = ts.getExternalModuleRequireArgument(node) || node.moduleSpecifier;
|
|
51309
51329
|
var moduleSymbol = resolveExternalModuleName(node, moduleSpecifier); // TODO: GH#18217
|
|
@@ -51339,29 +51359,33 @@ var ts;
|
|
|
51339
51359
|
combineValueAndTypeSymbols(symbolFromVariable, symbolFromModule) :
|
|
51340
51360
|
symbolFromModule || symbolFromVariable;
|
|
51341
51361
|
if (!symbol) {
|
|
51342
|
-
|
|
51343
|
-
var declarationName = ts.declarationNameToString(name);
|
|
51344
|
-
var suggestion = getSuggestedSymbolForNonexistentModule(name, targetSymbol);
|
|
51345
|
-
if (suggestion !== undefined) {
|
|
51346
|
-
var suggestionName = symbolToString(suggestion);
|
|
51347
|
-
var diagnostic = error(name, ts.Diagnostics._0_has_no_exported_member_named_1_Did_you_mean_2, moduleName, declarationName, suggestionName);
|
|
51348
|
-
if (suggestion.valueDeclaration) {
|
|
51349
|
-
ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(suggestion.valueDeclaration, ts.Diagnostics._0_is_declared_here, suggestionName));
|
|
51350
|
-
}
|
|
51351
|
-
}
|
|
51352
|
-
else {
|
|
51353
|
-
if ((_b = moduleSymbol.exports) === null || _b === void 0 ? void 0 : _b.has("default" /* InternalSymbolName.Default */)) {
|
|
51354
|
-
error(name, ts.Diagnostics.Module_0_has_no_exported_member_1_Did_you_mean_to_use_import_1_from_0_instead, moduleName, declarationName);
|
|
51355
|
-
}
|
|
51356
|
-
else {
|
|
51357
|
-
reportNonExportedMember(node, name, declarationName, moduleSymbol, moduleName);
|
|
51358
|
-
}
|
|
51359
|
-
}
|
|
51362
|
+
errorNoModuleMemberSymbol(moduleSymbol, targetSymbol, node, name);
|
|
51360
51363
|
}
|
|
51361
51364
|
return symbol;
|
|
51362
51365
|
}
|
|
51363
51366
|
}
|
|
51364
51367
|
}
|
|
51368
|
+
function errorNoModuleMemberSymbol(moduleSymbol, targetSymbol, node, name) {
|
|
51369
|
+
var _a;
|
|
51370
|
+
var moduleName = getFullyQualifiedName(moduleSymbol, node);
|
|
51371
|
+
var declarationName = ts.declarationNameToString(name);
|
|
51372
|
+
var suggestion = getSuggestedSymbolForNonexistentModule(name, targetSymbol);
|
|
51373
|
+
if (suggestion !== undefined) {
|
|
51374
|
+
var suggestionName = symbolToString(suggestion);
|
|
51375
|
+
var diagnostic = error(name, ts.Diagnostics._0_has_no_exported_member_named_1_Did_you_mean_2, moduleName, declarationName, suggestionName);
|
|
51376
|
+
if (suggestion.valueDeclaration) {
|
|
51377
|
+
ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(suggestion.valueDeclaration, ts.Diagnostics._0_is_declared_here, suggestionName));
|
|
51378
|
+
}
|
|
51379
|
+
}
|
|
51380
|
+
else {
|
|
51381
|
+
if ((_a = moduleSymbol.exports) === null || _a === void 0 ? void 0 : _a.has("default" /* InternalSymbolName.Default */)) {
|
|
51382
|
+
error(name, ts.Diagnostics.Module_0_has_no_exported_member_1_Did_you_mean_to_use_import_1_from_0_instead, moduleName, declarationName);
|
|
51383
|
+
}
|
|
51384
|
+
else {
|
|
51385
|
+
reportNonExportedMember(node, name, declarationName, moduleSymbol, moduleName);
|
|
51386
|
+
}
|
|
51387
|
+
}
|
|
51388
|
+
}
|
|
51365
51389
|
function reportNonExportedMember(node, name, declarationName, moduleSymbol, moduleName) {
|
|
51366
51390
|
var _a, _b;
|
|
51367
51391
|
var localSymbol = (_b = (_a = moduleSymbol.valueDeclaration) === null || _a === void 0 ? void 0 : _a.locals) === null || _b === void 0 ? void 0 : _b.get(name.escapedText);
|
|
@@ -51407,6 +51431,13 @@ var ts;
|
|
|
51407
51431
|
}
|
|
51408
51432
|
}
|
|
51409
51433
|
function getTargetOfImportSpecifier(node, dontResolveAlias) {
|
|
51434
|
+
if (ts.isImportSpecifier(node) && ts.idText(node.propertyName || node.name) === "default" /* InternalSymbolName.Default */) {
|
|
51435
|
+
var specifier = getModuleSpecifierForImportOrExport(node);
|
|
51436
|
+
var moduleSymbol = specifier && resolveExternalModuleName(node, specifier);
|
|
51437
|
+
if (moduleSymbol) {
|
|
51438
|
+
return getTargetofModuleDefault(moduleSymbol, node, dontResolveAlias);
|
|
51439
|
+
}
|
|
51440
|
+
}
|
|
51410
51441
|
var root = ts.isBindingElement(node) ? ts.getRootDeclaration(node) : node.parent.parent.parent;
|
|
51411
51442
|
var commonJSPropertyAccess = getCommonJSPropertyAccess(root);
|
|
51412
51443
|
var resolved = getExternalModuleMember(root, commonJSPropertyAccess || node, dontResolveAlias);
|
|
@@ -51428,6 +51459,13 @@ var ts;
|
|
|
51428
51459
|
return resolved;
|
|
51429
51460
|
}
|
|
51430
51461
|
function getTargetOfExportSpecifier(node, meaning, dontResolveAlias) {
|
|
51462
|
+
if (ts.idText(node.propertyName || node.name) === "default" /* InternalSymbolName.Default */) {
|
|
51463
|
+
var specifier = getModuleSpecifierForImportOrExport(node);
|
|
51464
|
+
var moduleSymbol = specifier && resolveExternalModuleName(node, specifier);
|
|
51465
|
+
if (moduleSymbol) {
|
|
51466
|
+
return getTargetofModuleDefault(moduleSymbol, node, !!dontResolveAlias);
|
|
51467
|
+
}
|
|
51468
|
+
}
|
|
51431
51469
|
var resolved = node.parent.parent.moduleSpecifier ?
|
|
51432
51470
|
getExternalModuleMember(node.parent.parent, node, dontResolveAlias) :
|
|
51433
51471
|
resolveEntityName(node.propertyName || node.name, meaning, /*ignoreErrors*/ false, dontResolveAlias);
|
|
@@ -62378,7 +62416,7 @@ var ts;
|
|
|
62378
62416
|
return includes & 8388608 /* TypeFlags.IncludesWildcard */ ? wildcardType : anyType;
|
|
62379
62417
|
}
|
|
62380
62418
|
if (!strictNullChecks && includes & 98304 /* TypeFlags.Nullable */) {
|
|
62381
|
-
return includes & 32768 /* TypeFlags.Undefined */ ? undefinedType : nullType;
|
|
62419
|
+
return includes & 16777216 /* TypeFlags.IncludesEmptyObject */ ? neverType : includes & 32768 /* TypeFlags.Undefined */ ? undefinedType : nullType;
|
|
62382
62420
|
}
|
|
62383
62421
|
if (includes & 4 /* TypeFlags.String */ && includes & (128 /* TypeFlags.StringLiteral */ | 134217728 /* TypeFlags.TemplateLiteral */ | 268435456 /* TypeFlags.StringMapping */) ||
|
|
62384
62422
|
includes & 8 /* TypeFlags.Number */ && includes & 256 /* TypeFlags.NumberLiteral */ ||
|
|
@@ -63068,7 +63106,7 @@ var ts;
|
|
|
63068
63106
|
// (T | U)[K] -> T[K] | U[K] (reading)
|
|
63069
63107
|
// (T | U)[K] -> T[K] & U[K] (writing)
|
|
63070
63108
|
// (T & U)[K] -> T[K] & U[K]
|
|
63071
|
-
if (objectType.flags &
|
|
63109
|
+
if (objectType.flags & 1048576 /* TypeFlags.Union */ || objectType.flags & 2097152 /* TypeFlags.Intersection */ && !shouldDeferIndexType(objectType)) {
|
|
63072
63110
|
var types = ts.map(objectType.types, function (t) { return getSimplifiedType(getIndexedAccessType(t, indexType), writing); });
|
|
63073
63111
|
return objectType.flags & 2097152 /* TypeFlags.Intersection */ || writing ? getIntersectionType(types) : getUnionType(types);
|
|
63074
63112
|
}
|
|
@@ -65476,7 +65514,7 @@ var ts;
|
|
|
65476
65514
|
if (reduced !== type) {
|
|
65477
65515
|
return reduced;
|
|
65478
65516
|
}
|
|
65479
|
-
if (type.flags & 2097152 /* TypeFlags.Intersection */) {
|
|
65517
|
+
if (type.flags & 2097152 /* TypeFlags.Intersection */ && ts.some(type.types, isEmptyAnonymousObjectType)) {
|
|
65480
65518
|
var normalizedTypes = ts.sameMap(type.types, function (t) { return getNormalizedType(t, writing); });
|
|
65481
65519
|
if (normalizedTypes !== type.types) {
|
|
65482
65520
|
return getIntersectionType(normalizedTypes);
|
|
@@ -66647,7 +66685,7 @@ var ts;
|
|
|
66647
66685
|
// create a new chain for the constraint error
|
|
66648
66686
|
resetErrorInfo(saveErrorInfo);
|
|
66649
66687
|
}
|
|
66650
|
-
if (result = isRelatedTo(source, constraint, 2 /* RecursionFlags.Target */, reportErrors)) {
|
|
66688
|
+
if (result = isRelatedTo(source, constraint, 2 /* RecursionFlags.Target */, reportErrors, /* headMessage */ undefined, intersectionState)) {
|
|
66651
66689
|
return result;
|
|
66652
66690
|
}
|
|
66653
66691
|
// prefer the shorter chain of the constraint comparison chain, and the direct comparison chain
|
|
@@ -66739,8 +66777,8 @@ var ts;
|
|
|
66739
66777
|
var skipTrue = !isTypeAssignableTo(getPermissiveInstantiation(c.checkType), getPermissiveInstantiation(c.extendsType));
|
|
66740
66778
|
var skipFalse = !skipTrue && isTypeAssignableTo(getRestrictiveInstantiation(c.checkType), getRestrictiveInstantiation(c.extendsType));
|
|
66741
66779
|
// TODO: Find a nice way to include potential conditional type breakdowns in error output, if they seem good (they usually don't)
|
|
66742
|
-
if (result = skipTrue ? -1 /* Ternary.True */ : isRelatedTo(source, getTrueTypeFromConditionalType(c), 2 /* RecursionFlags.Target */, /*reportErrors*/ false)) {
|
|
66743
|
-
result &= skipFalse ? -1 /* Ternary.True */ : isRelatedTo(source, getFalseTypeFromConditionalType(c), 2 /* RecursionFlags.Target */, /*reportErrors*/ false);
|
|
66780
|
+
if (result = skipTrue ? -1 /* Ternary.True */ : isRelatedTo(source, getTrueTypeFromConditionalType(c), 2 /* RecursionFlags.Target */, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState)) {
|
|
66781
|
+
result &= skipFalse ? -1 /* Ternary.True */ : isRelatedTo(source, getFalseTypeFromConditionalType(c), 2 /* RecursionFlags.Target */, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState);
|
|
66744
66782
|
if (result) {
|
|
66745
66783
|
return result;
|
|
66746
66784
|
}
|
|
@@ -71769,7 +71807,7 @@ var ts;
|
|
|
71769
71807
|
var narrowedPropType = narrowType(propType);
|
|
71770
71808
|
return filterType(type, function (t) {
|
|
71771
71809
|
var discriminantType = getTypeOfPropertyOrIndexSignature(t, propName);
|
|
71772
|
-
return !(narrowedPropType.flags & 131072 /* TypeFlags.Never */) &&
|
|
71810
|
+
return !(narrowedPropType.flags & 131072 /* TypeFlags.Never */) && areTypesComparable(narrowedPropType, discriminantType);
|
|
71773
71811
|
});
|
|
71774
71812
|
}
|
|
71775
71813
|
function narrowTypeByDiscriminantProperty(type, access, operator, value, assumeTrue) {
|
|
@@ -71818,7 +71856,7 @@ var ts;
|
|
|
71818
71856
|
}
|
|
71819
71857
|
function narrowByInKeyword(type, name, assumeTrue) {
|
|
71820
71858
|
if (type.flags & 1048576 /* TypeFlags.Union */
|
|
71821
|
-
|| type.flags & 524288 /* TypeFlags.Object */ && declaredType !== type
|
|
71859
|
+
|| type.flags & 524288 /* TypeFlags.Object */ && declaredType !== type && !(declaredType === unknownType && isEmptyAnonymousObjectType(type))
|
|
71822
71860
|
|| ts.isThisTypeParameter(type)
|
|
71823
71861
|
|| type.flags & 2097152 /* TypeFlags.Intersection */ && ts.every(type.types, function (t) { return t.symbol !== globalThisSymbol; })) {
|
|
71824
71862
|
return filterType(type, function (t) { return isTypePresencePossible(t, name, assumeTrue); });
|
|
@@ -71951,14 +71989,18 @@ var ts;
|
|
|
71951
71989
|
assumeTrue = !assumeTrue;
|
|
71952
71990
|
}
|
|
71953
71991
|
var valueType = getTypeOfExpression(value);
|
|
71954
|
-
if ((type.flags & 2 /* TypeFlags.Unknown */)
|
|
71992
|
+
if (((type.flags & 2 /* TypeFlags.Unknown */) || isEmptyAnonymousObjectType(type) && !(valueType.flags & 98304 /* TypeFlags.Nullable */)) &&
|
|
71993
|
+
assumeTrue &&
|
|
71994
|
+
(operator === 36 /* SyntaxKind.EqualsEqualsEqualsToken */ || operator === 37 /* SyntaxKind.ExclamationEqualsEqualsToken */)) {
|
|
71955
71995
|
if (valueType.flags & (131068 /* TypeFlags.Primitive */ | 67108864 /* TypeFlags.NonPrimitive */)) {
|
|
71956
71996
|
return valueType;
|
|
71957
71997
|
}
|
|
71958
71998
|
if (valueType.flags & 524288 /* TypeFlags.Object */) {
|
|
71959
71999
|
return nonPrimitiveType;
|
|
71960
72000
|
}
|
|
71961
|
-
|
|
72001
|
+
if (type.flags & 2 /* TypeFlags.Unknown */) {
|
|
72002
|
+
return type;
|
|
72003
|
+
}
|
|
71962
72004
|
}
|
|
71963
72005
|
if (valueType.flags & 98304 /* TypeFlags.Nullable */) {
|
|
71964
72006
|
if (!strictNullChecks) {
|
|
@@ -72417,7 +72459,9 @@ var ts;
|
|
|
72417
72459
|
!!(type.flags & 465829888 /* TypeFlags.Instantiable */ && getBaseConstraintOrType(type).flags & (98304 /* TypeFlags.Nullable */ | 1048576 /* TypeFlags.Union */));
|
|
72418
72460
|
}
|
|
72419
72461
|
function isGenericTypeWithoutNullableConstraint(type) {
|
|
72420
|
-
return
|
|
72462
|
+
return type.flags & 2097152 /* TypeFlags.Intersection */ ?
|
|
72463
|
+
ts.some(type.types, isGenericTypeWithoutNullableConstraint) :
|
|
72464
|
+
!!(type.flags & 465829888 /* TypeFlags.Instantiable */ && !maybeTypeOfKind(getBaseConstraintOrType(type), 98304 /* TypeFlags.Nullable */));
|
|
72421
72465
|
}
|
|
72422
72466
|
function hasContextualTypeWithNoGenericTypes(node, checkMode) {
|
|
72423
72467
|
// Computing the contextual type for a child of a JSX element involves resolving the type of the
|
|
@@ -127114,9 +127158,7 @@ var ts;
|
|
|
127114
127158
|
}
|
|
127115
127159
|
}
|
|
127116
127160
|
}
|
|
127117
|
-
var seenRefs = buildInfoPath ? new ts.Set() : undefined;
|
|
127118
127161
|
var buildInfoCacheEntry = state.buildInfoCache.get(resolvedPath);
|
|
127119
|
-
seenRefs === null || seenRefs === void 0 ? void 0 : seenRefs.add(resolvedPath);
|
|
127120
127162
|
/** Inputs are up-to-date, just need either timestamp update or bundle prepend manipulation to make it look up-to-date */
|
|
127121
127163
|
var pseudoUpToDate = false;
|
|
127122
127164
|
var usesPrepend = false;
|
|
@@ -127131,7 +127173,7 @@ var ts;
|
|
|
127131
127173
|
continue;
|
|
127132
127174
|
}
|
|
127133
127175
|
// Check if tsbuildinfo path is shared, then we need to rebuild
|
|
127134
|
-
if (buildInfoCacheEntry && hasSameBuildInfo(state, buildInfoCacheEntry,
|
|
127176
|
+
if (buildInfoCacheEntry && hasSameBuildInfo(state, buildInfoCacheEntry, resolvedRefPath)) {
|
|
127135
127177
|
return {
|
|
127136
127178
|
type: ts.UpToDateStatusType.OutOfDateWithUpstream,
|
|
127137
127179
|
outOfDateOutputFileName: buildInfoPath,
|
|
@@ -127189,25 +127231,9 @@ var ts;
|
|
|
127189
127231
|
oldestOutputFileName: oldestOutputFileName
|
|
127190
127232
|
};
|
|
127191
127233
|
}
|
|
127192
|
-
function hasSameBuildInfo(state, buildInfoCacheEntry,
|
|
127193
|
-
if (seenRefs.has(resolvedRefPath))
|
|
127194
|
-
return false;
|
|
127195
|
-
seenRefs.add(resolvedRefPath);
|
|
127234
|
+
function hasSameBuildInfo(state, buildInfoCacheEntry, resolvedRefPath) {
|
|
127196
127235
|
var refBuildInfo = state.buildInfoCache.get(resolvedRefPath);
|
|
127197
|
-
|
|
127198
|
-
return true;
|
|
127199
|
-
if (resolvedConfig.projectReferences) {
|
|
127200
|
-
// Check references
|
|
127201
|
-
for (var _i = 0, _a = resolvedConfig.projectReferences; _i < _a.length; _i++) {
|
|
127202
|
-
var ref = _a[_i];
|
|
127203
|
-
var resolvedRef = ts.resolveProjectReferencePath(ref);
|
|
127204
|
-
var resolvedRefPath_1 = toResolvedConfigFilePath(state, resolvedRef);
|
|
127205
|
-
var resolvedConfig_1 = parseConfigFile(state, resolvedRef, resolvedRefPath_1);
|
|
127206
|
-
if (hasSameBuildInfo(state, buildInfoCacheEntry, seenRefs, resolvedConfig_1, resolvedRefPath_1))
|
|
127207
|
-
return true;
|
|
127208
|
-
}
|
|
127209
|
-
}
|
|
127210
|
-
return false;
|
|
127236
|
+
return refBuildInfo.path === buildInfoCacheEntry.path;
|
|
127211
127237
|
}
|
|
127212
127238
|
function getUpToDateStatus(state, project, resolvedPath) {
|
|
127213
127239
|
if (project === undefined) {
|