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/tsserverlibrary.js
CHANGED
|
@@ -303,7 +303,7 @@ var ts;
|
|
|
303
303
|
// The following is baselined as a literal template type without intervention
|
|
304
304
|
/** The version of the TypeScript compiler release */
|
|
305
305
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
306
|
-
ts.version = "4.8.
|
|
306
|
+
ts.version = "4.8.3";
|
|
307
307
|
/* @internal */
|
|
308
308
|
var Comparison;
|
|
309
309
|
(function (Comparison) {
|
|
@@ -9069,7 +9069,7 @@ var ts;
|
|
|
9069
9069
|
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."),
|
|
9070
9070
|
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."),
|
|
9071
9071
|
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."),
|
|
9072
|
-
|
|
9072
|
+
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."),
|
|
9073
9073
|
_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."),
|
|
9074
9074
|
_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."),
|
|
9075
9075
|
_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."),
|
|
@@ -44830,7 +44830,7 @@ var ts;
|
|
|
44830
44830
|
var _a, _b;
|
|
44831
44831
|
if (path === undefined)
|
|
44832
44832
|
return path;
|
|
44833
|
-
return ts.
|
|
44833
|
+
return ts.getNormalizedAbsolutePath(path, (_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a));
|
|
44834
44834
|
}
|
|
44835
44835
|
function combineDirectoryPath(root, dir) {
|
|
44836
44836
|
return ts.ensureTrailingDirectorySeparator(ts.combinePaths(root, dir));
|
|
@@ -44850,7 +44850,7 @@ var ts;
|
|
|
44850
44850
|
if ((extensions === Extensions.TypeScript || extensions === Extensions.JavaScript || extensions === Extensions.Json)
|
|
44851
44851
|
&& (state.compilerOptions.declarationDir || state.compilerOptions.outDir)
|
|
44852
44852
|
&& finalPath.indexOf("/node_modules/") === -1
|
|
44853
|
-
&& (state.compilerOptions.configFile ? ts.
|
|
44853
|
+
&& (state.compilerOptions.configFile ? ts.containsPath(scope.packageDirectory, toAbsolutePath(state.compilerOptions.configFile.fileName), !useCaseSensitiveFileNames()) : true)) {
|
|
44854
44854
|
// 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.
|
|
44855
44855
|
// Even with all that, we still don't know if the root of the output file structure will be (relative to the package file)
|
|
44856
44856
|
// `.`, `./src` or any other deeper directory structure. (If project references are used, it's definitely `.` by fiat, so that should be pretty common.)
|
|
@@ -44906,7 +44906,7 @@ var ts;
|
|
|
44906
44906
|
var candidateDirectories = getOutputDirectoriesForBaseDirectory(commonSourceDirGuess);
|
|
44907
44907
|
for (var _e = 0, candidateDirectories_1 = candidateDirectories; _e < candidateDirectories_1.length; _e++) {
|
|
44908
44908
|
var candidateDir = candidateDirectories_1[_e];
|
|
44909
|
-
if (ts.
|
|
44909
|
+
if (ts.containsPath(candidateDir, finalPath, !useCaseSensitiveFileNames())) {
|
|
44910
44910
|
// 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
|
|
44911
44911
|
var pathFragment = finalPath.slice(candidateDir.length + 1); // +1 to also remove directory seperator
|
|
44912
44912
|
var possibleInputBase = ts.combinePaths(commonSourceDirGuess, pathFragment);
|
|
@@ -51188,41 +51188,61 @@ var ts;
|
|
|
51188
51188
|
return typeof file.externalModuleIndicator !== "object" && !resolveExportByName(moduleSymbol, ts.escapeLeadingUnderscores("__esModule"), /*sourceNode*/ undefined, dontResolveAlias);
|
|
51189
51189
|
}
|
|
51190
51190
|
function getTargetOfImportClause(node, dontResolveAlias) {
|
|
51191
|
-
var _a;
|
|
51192
51191
|
var moduleSymbol = resolveExternalModuleName(node, node.parent.moduleSpecifier);
|
|
51193
51192
|
if (moduleSymbol) {
|
|
51194
|
-
|
|
51195
|
-
|
|
51196
|
-
|
|
51197
|
-
|
|
51198
|
-
|
|
51199
|
-
|
|
51200
|
-
|
|
51201
|
-
|
|
51202
|
-
|
|
51203
|
-
|
|
51204
|
-
|
|
51205
|
-
|
|
51206
|
-
|
|
51207
|
-
|
|
51208
|
-
|
|
51209
|
-
|
|
51210
|
-
|
|
51211
|
-
|
|
51212
|
-
|
|
51213
|
-
|
|
51214
|
-
|
|
51215
|
-
|
|
51193
|
+
return getTargetofModuleDefault(moduleSymbol, node, dontResolveAlias);
|
|
51194
|
+
}
|
|
51195
|
+
}
|
|
51196
|
+
function getTargetofModuleDefault(moduleSymbol, node, dontResolveAlias) {
|
|
51197
|
+
var _a;
|
|
51198
|
+
var exportDefaultSymbol;
|
|
51199
|
+
if (ts.isShorthandAmbientModuleSymbol(moduleSymbol)) {
|
|
51200
|
+
exportDefaultSymbol = moduleSymbol;
|
|
51201
|
+
}
|
|
51202
|
+
else {
|
|
51203
|
+
exportDefaultSymbol = resolveExportByName(moduleSymbol, "default" /* InternalSymbolName.Default */, node, dontResolveAlias);
|
|
51204
|
+
}
|
|
51205
|
+
var file = (_a = moduleSymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(ts.isSourceFile);
|
|
51206
|
+
var specifier = getModuleSpecifierForImportOrExport(node);
|
|
51207
|
+
if (!specifier) {
|
|
51208
|
+
return exportDefaultSymbol;
|
|
51209
|
+
}
|
|
51210
|
+
var hasDefaultOnly = isOnlyImportedAsDefault(specifier);
|
|
51211
|
+
var hasSyntheticDefault = canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, specifier);
|
|
51212
|
+
if (!exportDefaultSymbol && !hasSyntheticDefault && !hasDefaultOnly) {
|
|
51213
|
+
if (hasExportAssignmentSymbol(moduleSymbol)) {
|
|
51214
|
+
var compilerOptionName = moduleKind >= ts.ModuleKind.ES2015 ? "allowSyntheticDefaultImports" : "esModuleInterop";
|
|
51215
|
+
var exportEqualsSymbol = moduleSymbol.exports.get("export=" /* InternalSymbolName.ExportEquals */);
|
|
51216
|
+
var exportAssignment = exportEqualsSymbol.valueDeclaration;
|
|
51217
|
+
var err = error(node.name, ts.Diagnostics.Module_0_can_only_be_default_imported_using_the_1_flag, symbolToString(moduleSymbol), compilerOptionName);
|
|
51218
|
+
if (exportAssignment) {
|
|
51219
|
+
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));
|
|
51216
51220
|
}
|
|
51217
51221
|
}
|
|
51218
|
-
else if (
|
|
51219
|
-
|
|
51220
|
-
var resolved = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias) || resolveSymbol(moduleSymbol, dontResolveAlias);
|
|
51221
|
-
markSymbolOfAliasDeclarationIfTypeOnly(node, moduleSymbol, resolved, /*overwriteTypeOnly*/ false);
|
|
51222
|
-
return resolved;
|
|
51222
|
+
else if (ts.isImportClause(node)) {
|
|
51223
|
+
reportNonDefaultExport(moduleSymbol, node);
|
|
51223
51224
|
}
|
|
51224
|
-
|
|
51225
|
-
|
|
51225
|
+
else {
|
|
51226
|
+
errorNoModuleMemberSymbol(moduleSymbol, moduleSymbol, node, ts.isImportOrExportSpecifier(node) && node.propertyName || node.name);
|
|
51227
|
+
}
|
|
51228
|
+
}
|
|
51229
|
+
else if (hasSyntheticDefault || hasDefaultOnly) {
|
|
51230
|
+
// per emit behavior, a synthetic default overrides a "real" .default member if `__esModule` is not present
|
|
51231
|
+
var resolved = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias) || resolveSymbol(moduleSymbol, dontResolveAlias);
|
|
51232
|
+
markSymbolOfAliasDeclarationIfTypeOnly(node, moduleSymbol, resolved, /*overwriteTypeOnly*/ false);
|
|
51233
|
+
return resolved;
|
|
51234
|
+
}
|
|
51235
|
+
markSymbolOfAliasDeclarationIfTypeOnly(node, exportDefaultSymbol, /*finalTarget*/ undefined, /*overwriteTypeOnly*/ false);
|
|
51236
|
+
return exportDefaultSymbol;
|
|
51237
|
+
}
|
|
51238
|
+
function getModuleSpecifierForImportOrExport(node) {
|
|
51239
|
+
switch (node.kind) {
|
|
51240
|
+
case 267 /* SyntaxKind.ImportClause */: return node.parent.moduleSpecifier;
|
|
51241
|
+
case 265 /* SyntaxKind.ImportEqualsDeclaration */: return ts.isExternalModuleReference(node.moduleReference) ? node.moduleReference.expression : undefined;
|
|
51242
|
+
case 268 /* SyntaxKind.NamespaceImport */: return node.parent.parent.moduleSpecifier;
|
|
51243
|
+
case 270 /* SyntaxKind.ImportSpecifier */: return node.parent.parent.parent.moduleSpecifier;
|
|
51244
|
+
case 275 /* SyntaxKind.ExportSpecifier */: return node.parent.parent.moduleSpecifier;
|
|
51245
|
+
default: return ts.Debug.assertNever(node);
|
|
51226
51246
|
}
|
|
51227
51247
|
}
|
|
51228
51248
|
function reportNonDefaultExport(moduleSymbol, node) {
|
|
@@ -51312,7 +51332,7 @@ var ts;
|
|
|
51312
51332
|
}
|
|
51313
51333
|
}
|
|
51314
51334
|
function getExternalModuleMember(node, specifier, dontResolveAlias) {
|
|
51315
|
-
var _a
|
|
51335
|
+
var _a;
|
|
51316
51336
|
if (dontResolveAlias === void 0) { dontResolveAlias = false; }
|
|
51317
51337
|
var moduleSpecifier = ts.getExternalModuleRequireArgument(node) || node.moduleSpecifier;
|
|
51318
51338
|
var moduleSymbol = resolveExternalModuleName(node, moduleSpecifier); // TODO: GH#18217
|
|
@@ -51348,29 +51368,33 @@ var ts;
|
|
|
51348
51368
|
combineValueAndTypeSymbols(symbolFromVariable, symbolFromModule) :
|
|
51349
51369
|
symbolFromModule || symbolFromVariable;
|
|
51350
51370
|
if (!symbol) {
|
|
51351
|
-
|
|
51352
|
-
var declarationName = ts.declarationNameToString(name);
|
|
51353
|
-
var suggestion = getSuggestedSymbolForNonexistentModule(name, targetSymbol);
|
|
51354
|
-
if (suggestion !== undefined) {
|
|
51355
|
-
var suggestionName = symbolToString(suggestion);
|
|
51356
|
-
var diagnostic = error(name, ts.Diagnostics._0_has_no_exported_member_named_1_Did_you_mean_2, moduleName, declarationName, suggestionName);
|
|
51357
|
-
if (suggestion.valueDeclaration) {
|
|
51358
|
-
ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(suggestion.valueDeclaration, ts.Diagnostics._0_is_declared_here, suggestionName));
|
|
51359
|
-
}
|
|
51360
|
-
}
|
|
51361
|
-
else {
|
|
51362
|
-
if ((_b = moduleSymbol.exports) === null || _b === void 0 ? void 0 : _b.has("default" /* InternalSymbolName.Default */)) {
|
|
51363
|
-
error(name, ts.Diagnostics.Module_0_has_no_exported_member_1_Did_you_mean_to_use_import_1_from_0_instead, moduleName, declarationName);
|
|
51364
|
-
}
|
|
51365
|
-
else {
|
|
51366
|
-
reportNonExportedMember(node, name, declarationName, moduleSymbol, moduleName);
|
|
51367
|
-
}
|
|
51368
|
-
}
|
|
51371
|
+
errorNoModuleMemberSymbol(moduleSymbol, targetSymbol, node, name);
|
|
51369
51372
|
}
|
|
51370
51373
|
return symbol;
|
|
51371
51374
|
}
|
|
51372
51375
|
}
|
|
51373
51376
|
}
|
|
51377
|
+
function errorNoModuleMemberSymbol(moduleSymbol, targetSymbol, node, name) {
|
|
51378
|
+
var _a;
|
|
51379
|
+
var moduleName = getFullyQualifiedName(moduleSymbol, node);
|
|
51380
|
+
var declarationName = ts.declarationNameToString(name);
|
|
51381
|
+
var suggestion = getSuggestedSymbolForNonexistentModule(name, targetSymbol);
|
|
51382
|
+
if (suggestion !== undefined) {
|
|
51383
|
+
var suggestionName = symbolToString(suggestion);
|
|
51384
|
+
var diagnostic = error(name, ts.Diagnostics._0_has_no_exported_member_named_1_Did_you_mean_2, moduleName, declarationName, suggestionName);
|
|
51385
|
+
if (suggestion.valueDeclaration) {
|
|
51386
|
+
ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(suggestion.valueDeclaration, ts.Diagnostics._0_is_declared_here, suggestionName));
|
|
51387
|
+
}
|
|
51388
|
+
}
|
|
51389
|
+
else {
|
|
51390
|
+
if ((_a = moduleSymbol.exports) === null || _a === void 0 ? void 0 : _a.has("default" /* InternalSymbolName.Default */)) {
|
|
51391
|
+
error(name, ts.Diagnostics.Module_0_has_no_exported_member_1_Did_you_mean_to_use_import_1_from_0_instead, moduleName, declarationName);
|
|
51392
|
+
}
|
|
51393
|
+
else {
|
|
51394
|
+
reportNonExportedMember(node, name, declarationName, moduleSymbol, moduleName);
|
|
51395
|
+
}
|
|
51396
|
+
}
|
|
51397
|
+
}
|
|
51374
51398
|
function reportNonExportedMember(node, name, declarationName, moduleSymbol, moduleName) {
|
|
51375
51399
|
var _a, _b;
|
|
51376
51400
|
var localSymbol = (_b = (_a = moduleSymbol.valueDeclaration) === null || _a === void 0 ? void 0 : _a.locals) === null || _b === void 0 ? void 0 : _b.get(name.escapedText);
|
|
@@ -51416,6 +51440,13 @@ var ts;
|
|
|
51416
51440
|
}
|
|
51417
51441
|
}
|
|
51418
51442
|
function getTargetOfImportSpecifier(node, dontResolveAlias) {
|
|
51443
|
+
if (ts.isImportSpecifier(node) && ts.idText(node.propertyName || node.name) === "default" /* InternalSymbolName.Default */) {
|
|
51444
|
+
var specifier = getModuleSpecifierForImportOrExport(node);
|
|
51445
|
+
var moduleSymbol = specifier && resolveExternalModuleName(node, specifier);
|
|
51446
|
+
if (moduleSymbol) {
|
|
51447
|
+
return getTargetofModuleDefault(moduleSymbol, node, dontResolveAlias);
|
|
51448
|
+
}
|
|
51449
|
+
}
|
|
51419
51450
|
var root = ts.isBindingElement(node) ? ts.getRootDeclaration(node) : node.parent.parent.parent;
|
|
51420
51451
|
var commonJSPropertyAccess = getCommonJSPropertyAccess(root);
|
|
51421
51452
|
var resolved = getExternalModuleMember(root, commonJSPropertyAccess || node, dontResolveAlias);
|
|
@@ -51437,6 +51468,13 @@ var ts;
|
|
|
51437
51468
|
return resolved;
|
|
51438
51469
|
}
|
|
51439
51470
|
function getTargetOfExportSpecifier(node, meaning, dontResolveAlias) {
|
|
51471
|
+
if (ts.idText(node.propertyName || node.name) === "default" /* InternalSymbolName.Default */) {
|
|
51472
|
+
var specifier = getModuleSpecifierForImportOrExport(node);
|
|
51473
|
+
var moduleSymbol = specifier && resolveExternalModuleName(node, specifier);
|
|
51474
|
+
if (moduleSymbol) {
|
|
51475
|
+
return getTargetofModuleDefault(moduleSymbol, node, !!dontResolveAlias);
|
|
51476
|
+
}
|
|
51477
|
+
}
|
|
51440
51478
|
var resolved = node.parent.parent.moduleSpecifier ?
|
|
51441
51479
|
getExternalModuleMember(node.parent.parent, node, dontResolveAlias) :
|
|
51442
51480
|
resolveEntityName(node.propertyName || node.name, meaning, /*ignoreErrors*/ false, dontResolveAlias);
|
|
@@ -62387,7 +62425,7 @@ var ts;
|
|
|
62387
62425
|
return includes & 8388608 /* TypeFlags.IncludesWildcard */ ? wildcardType : anyType;
|
|
62388
62426
|
}
|
|
62389
62427
|
if (!strictNullChecks && includes & 98304 /* TypeFlags.Nullable */) {
|
|
62390
|
-
return includes & 32768 /* TypeFlags.Undefined */ ? undefinedType : nullType;
|
|
62428
|
+
return includes & 16777216 /* TypeFlags.IncludesEmptyObject */ ? neverType : includes & 32768 /* TypeFlags.Undefined */ ? undefinedType : nullType;
|
|
62391
62429
|
}
|
|
62392
62430
|
if (includes & 4 /* TypeFlags.String */ && includes & (128 /* TypeFlags.StringLiteral */ | 134217728 /* TypeFlags.TemplateLiteral */ | 268435456 /* TypeFlags.StringMapping */) ||
|
|
62393
62431
|
includes & 8 /* TypeFlags.Number */ && includes & 256 /* TypeFlags.NumberLiteral */ ||
|
|
@@ -63077,7 +63115,7 @@ var ts;
|
|
|
63077
63115
|
// (T | U)[K] -> T[K] | U[K] (reading)
|
|
63078
63116
|
// (T | U)[K] -> T[K] & U[K] (writing)
|
|
63079
63117
|
// (T & U)[K] -> T[K] & U[K]
|
|
63080
|
-
if (objectType.flags &
|
|
63118
|
+
if (objectType.flags & 1048576 /* TypeFlags.Union */ || objectType.flags & 2097152 /* TypeFlags.Intersection */ && !shouldDeferIndexType(objectType)) {
|
|
63081
63119
|
var types = ts.map(objectType.types, function (t) { return getSimplifiedType(getIndexedAccessType(t, indexType), writing); });
|
|
63082
63120
|
return objectType.flags & 2097152 /* TypeFlags.Intersection */ || writing ? getIntersectionType(types) : getUnionType(types);
|
|
63083
63121
|
}
|
|
@@ -65485,7 +65523,7 @@ var ts;
|
|
|
65485
65523
|
if (reduced !== type) {
|
|
65486
65524
|
return reduced;
|
|
65487
65525
|
}
|
|
65488
|
-
if (type.flags & 2097152 /* TypeFlags.Intersection */) {
|
|
65526
|
+
if (type.flags & 2097152 /* TypeFlags.Intersection */ && ts.some(type.types, isEmptyAnonymousObjectType)) {
|
|
65489
65527
|
var normalizedTypes = ts.sameMap(type.types, function (t) { return getNormalizedType(t, writing); });
|
|
65490
65528
|
if (normalizedTypes !== type.types) {
|
|
65491
65529
|
return getIntersectionType(normalizedTypes);
|
|
@@ -66656,7 +66694,7 @@ var ts;
|
|
|
66656
66694
|
// create a new chain for the constraint error
|
|
66657
66695
|
resetErrorInfo(saveErrorInfo);
|
|
66658
66696
|
}
|
|
66659
|
-
if (result = isRelatedTo(source, constraint, 2 /* RecursionFlags.Target */, reportErrors)) {
|
|
66697
|
+
if (result = isRelatedTo(source, constraint, 2 /* RecursionFlags.Target */, reportErrors, /* headMessage */ undefined, intersectionState)) {
|
|
66660
66698
|
return result;
|
|
66661
66699
|
}
|
|
66662
66700
|
// prefer the shorter chain of the constraint comparison chain, and the direct comparison chain
|
|
@@ -66748,8 +66786,8 @@ var ts;
|
|
|
66748
66786
|
var skipTrue = !isTypeAssignableTo(getPermissiveInstantiation(c.checkType), getPermissiveInstantiation(c.extendsType));
|
|
66749
66787
|
var skipFalse = !skipTrue && isTypeAssignableTo(getRestrictiveInstantiation(c.checkType), getRestrictiveInstantiation(c.extendsType));
|
|
66750
66788
|
// TODO: Find a nice way to include potential conditional type breakdowns in error output, if they seem good (they usually don't)
|
|
66751
|
-
if (result = skipTrue ? -1 /* Ternary.True */ : isRelatedTo(source, getTrueTypeFromConditionalType(c), 2 /* RecursionFlags.Target */, /*reportErrors*/ false)) {
|
|
66752
|
-
result &= skipFalse ? -1 /* Ternary.True */ : isRelatedTo(source, getFalseTypeFromConditionalType(c), 2 /* RecursionFlags.Target */, /*reportErrors*/ false);
|
|
66789
|
+
if (result = skipTrue ? -1 /* Ternary.True */ : isRelatedTo(source, getTrueTypeFromConditionalType(c), 2 /* RecursionFlags.Target */, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState)) {
|
|
66790
|
+
result &= skipFalse ? -1 /* Ternary.True */ : isRelatedTo(source, getFalseTypeFromConditionalType(c), 2 /* RecursionFlags.Target */, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState);
|
|
66753
66791
|
if (result) {
|
|
66754
66792
|
return result;
|
|
66755
66793
|
}
|
|
@@ -71778,7 +71816,7 @@ var ts;
|
|
|
71778
71816
|
var narrowedPropType = narrowType(propType);
|
|
71779
71817
|
return filterType(type, function (t) {
|
|
71780
71818
|
var discriminantType = getTypeOfPropertyOrIndexSignature(t, propName);
|
|
71781
|
-
return !(narrowedPropType.flags & 131072 /* TypeFlags.Never */) &&
|
|
71819
|
+
return !(narrowedPropType.flags & 131072 /* TypeFlags.Never */) && areTypesComparable(narrowedPropType, discriminantType);
|
|
71782
71820
|
});
|
|
71783
71821
|
}
|
|
71784
71822
|
function narrowTypeByDiscriminantProperty(type, access, operator, value, assumeTrue) {
|
|
@@ -71827,7 +71865,7 @@ var ts;
|
|
|
71827
71865
|
}
|
|
71828
71866
|
function narrowByInKeyword(type, name, assumeTrue) {
|
|
71829
71867
|
if (type.flags & 1048576 /* TypeFlags.Union */
|
|
71830
|
-
|| type.flags & 524288 /* TypeFlags.Object */ && declaredType !== type
|
|
71868
|
+
|| type.flags & 524288 /* TypeFlags.Object */ && declaredType !== type && !(declaredType === unknownType && isEmptyAnonymousObjectType(type))
|
|
71831
71869
|
|| ts.isThisTypeParameter(type)
|
|
71832
71870
|
|| type.flags & 2097152 /* TypeFlags.Intersection */ && ts.every(type.types, function (t) { return t.symbol !== globalThisSymbol; })) {
|
|
71833
71871
|
return filterType(type, function (t) { return isTypePresencePossible(t, name, assumeTrue); });
|
|
@@ -71960,14 +71998,18 @@ var ts;
|
|
|
71960
71998
|
assumeTrue = !assumeTrue;
|
|
71961
71999
|
}
|
|
71962
72000
|
var valueType = getTypeOfExpression(value);
|
|
71963
|
-
if ((type.flags & 2 /* TypeFlags.Unknown */)
|
|
72001
|
+
if (((type.flags & 2 /* TypeFlags.Unknown */) || isEmptyAnonymousObjectType(type) && !(valueType.flags & 98304 /* TypeFlags.Nullable */)) &&
|
|
72002
|
+
assumeTrue &&
|
|
72003
|
+
(operator === 36 /* SyntaxKind.EqualsEqualsEqualsToken */ || operator === 37 /* SyntaxKind.ExclamationEqualsEqualsToken */)) {
|
|
71964
72004
|
if (valueType.flags & (131068 /* TypeFlags.Primitive */ | 67108864 /* TypeFlags.NonPrimitive */)) {
|
|
71965
72005
|
return valueType;
|
|
71966
72006
|
}
|
|
71967
72007
|
if (valueType.flags & 524288 /* TypeFlags.Object */) {
|
|
71968
72008
|
return nonPrimitiveType;
|
|
71969
72009
|
}
|
|
71970
|
-
|
|
72010
|
+
if (type.flags & 2 /* TypeFlags.Unknown */) {
|
|
72011
|
+
return type;
|
|
72012
|
+
}
|
|
71971
72013
|
}
|
|
71972
72014
|
if (valueType.flags & 98304 /* TypeFlags.Nullable */) {
|
|
71973
72015
|
if (!strictNullChecks) {
|
|
@@ -72426,7 +72468,9 @@ var ts;
|
|
|
72426
72468
|
!!(type.flags & 465829888 /* TypeFlags.Instantiable */ && getBaseConstraintOrType(type).flags & (98304 /* TypeFlags.Nullable */ | 1048576 /* TypeFlags.Union */));
|
|
72427
72469
|
}
|
|
72428
72470
|
function isGenericTypeWithoutNullableConstraint(type) {
|
|
72429
|
-
return
|
|
72471
|
+
return type.flags & 2097152 /* TypeFlags.Intersection */ ?
|
|
72472
|
+
ts.some(type.types, isGenericTypeWithoutNullableConstraint) :
|
|
72473
|
+
!!(type.flags & 465829888 /* TypeFlags.Instantiable */ && !maybeTypeOfKind(getBaseConstraintOrType(type), 98304 /* TypeFlags.Nullable */));
|
|
72430
72474
|
}
|
|
72431
72475
|
function hasContextualTypeWithNoGenericTypes(node, checkMode) {
|
|
72432
72476
|
// Computing the contextual type for a child of a JSX element involves resolving the type of the
|
|
@@ -127123,9 +127167,7 @@ var ts;
|
|
|
127123
127167
|
}
|
|
127124
127168
|
}
|
|
127125
127169
|
}
|
|
127126
|
-
var seenRefs = buildInfoPath ? new ts.Set() : undefined;
|
|
127127
127170
|
var buildInfoCacheEntry = state.buildInfoCache.get(resolvedPath);
|
|
127128
|
-
seenRefs === null || seenRefs === void 0 ? void 0 : seenRefs.add(resolvedPath);
|
|
127129
127171
|
/** Inputs are up-to-date, just need either timestamp update or bundle prepend manipulation to make it look up-to-date */
|
|
127130
127172
|
var pseudoUpToDate = false;
|
|
127131
127173
|
var usesPrepend = false;
|
|
@@ -127140,7 +127182,7 @@ var ts;
|
|
|
127140
127182
|
continue;
|
|
127141
127183
|
}
|
|
127142
127184
|
// Check if tsbuildinfo path is shared, then we need to rebuild
|
|
127143
|
-
if (buildInfoCacheEntry && hasSameBuildInfo(state, buildInfoCacheEntry,
|
|
127185
|
+
if (buildInfoCacheEntry && hasSameBuildInfo(state, buildInfoCacheEntry, resolvedRefPath)) {
|
|
127144
127186
|
return {
|
|
127145
127187
|
type: ts.UpToDateStatusType.OutOfDateWithUpstream,
|
|
127146
127188
|
outOfDateOutputFileName: buildInfoPath,
|
|
@@ -127198,25 +127240,9 @@ var ts;
|
|
|
127198
127240
|
oldestOutputFileName: oldestOutputFileName
|
|
127199
127241
|
};
|
|
127200
127242
|
}
|
|
127201
|
-
function hasSameBuildInfo(state, buildInfoCacheEntry,
|
|
127202
|
-
if (seenRefs.has(resolvedRefPath))
|
|
127203
|
-
return false;
|
|
127204
|
-
seenRefs.add(resolvedRefPath);
|
|
127243
|
+
function hasSameBuildInfo(state, buildInfoCacheEntry, resolvedRefPath) {
|
|
127205
127244
|
var refBuildInfo = state.buildInfoCache.get(resolvedRefPath);
|
|
127206
|
-
|
|
127207
|
-
return true;
|
|
127208
|
-
if (resolvedConfig.projectReferences) {
|
|
127209
|
-
// Check references
|
|
127210
|
-
for (var _i = 0, _a = resolvedConfig.projectReferences; _i < _a.length; _i++) {
|
|
127211
|
-
var ref = _a[_i];
|
|
127212
|
-
var resolvedRef = ts.resolveProjectReferencePath(ref);
|
|
127213
|
-
var resolvedRefPath_1 = toResolvedConfigFilePath(state, resolvedRef);
|
|
127214
|
-
var resolvedConfig_1 = parseConfigFile(state, resolvedRef, resolvedRefPath_1);
|
|
127215
|
-
if (hasSameBuildInfo(state, buildInfoCacheEntry, seenRefs, resolvedConfig_1, resolvedRefPath_1))
|
|
127216
|
-
return true;
|
|
127217
|
-
}
|
|
127218
|
-
}
|
|
127219
|
-
return false;
|
|
127245
|
+
return refBuildInfo.path === buildInfoCacheEntry.path;
|
|
127220
127246
|
}
|
|
127221
127247
|
function getUpToDateStatus(state, project, resolvedPath) {
|
|
127222
127248
|
if (project === undefined) {
|
|
@@ -171808,13 +171834,13 @@ var ts;
|
|
|
171808
171834
|
return __generator(this, function (_a) {
|
|
171809
171835
|
switch (_a.label) {
|
|
171810
171836
|
case 0:
|
|
171811
|
-
ts.Debug.assertIsDefined(host.
|
|
171837
|
+
ts.Debug.assertIsDefined(host.importPlugin);
|
|
171812
171838
|
resolvedPath = ts.combinePaths(initialDir, "node_modules");
|
|
171813
171839
|
log("Dynamically importing ".concat(moduleName, " from ").concat(initialDir, " (resolved to ").concat(resolvedPath, ")"));
|
|
171814
171840
|
_a.label = 1;
|
|
171815
171841
|
case 1:
|
|
171816
171842
|
_a.trys.push([1, 3, , 4]);
|
|
171817
|
-
return [4 /*yield*/, host.
|
|
171843
|
+
return [4 /*yield*/, host.importPlugin(resolvedPath, moduleName)];
|
|
171818
171844
|
case 2:
|
|
171819
171845
|
result = _a.sent();
|
|
171820
171846
|
return [3 /*break*/, 4];
|
|
@@ -172893,7 +172919,7 @@ var ts;
|
|
|
172893
172919
|
};
|
|
172894
172920
|
Project.prototype.enableGlobalPlugins = function (options, pluginConfigOverrides) {
|
|
172895
172921
|
var host = this.projectService.host;
|
|
172896
|
-
if (!host.require && !host.
|
|
172922
|
+
if (!host.require && !host.importPlugin) {
|
|
172897
172923
|
this.projectService.logger.info("Plugins were requested but not running in environment that supports 'require'. Nothing will be loaded");
|
|
172898
172924
|
return;
|
|
172899
172925
|
}
|
|
@@ -172950,7 +172976,7 @@ var ts;
|
|
|
172950
172976
|
return __generator(this, function (_a) {
|
|
172951
172977
|
switch (_a.label) {
|
|
172952
172978
|
case 0:
|
|
172953
|
-
ts.Debug.assertIsDefined(this.projectService.host.
|
|
172979
|
+
ts.Debug.assertIsDefined(this.projectService.host.importPlugin);
|
|
172954
172980
|
log = function (message) { return _this.projectService.logger.info(message); };
|
|
172955
172981
|
logError = function (message) {
|
|
172956
172982
|
(errorLogs !== null && errorLogs !== void 0 ? errorLogs : (errorLogs = [])).push(message);
|
|
@@ -173651,7 +173677,7 @@ var ts;
|
|
|
173651
173677
|
/*@internal*/
|
|
173652
173678
|
ConfiguredProject.prototype.enablePluginsWithOptions = function (options, pluginConfigOverrides) {
|
|
173653
173679
|
var host = this.projectService.host;
|
|
173654
|
-
if (!host.require && !host.
|
|
173680
|
+
if (!host.require && !host.importPlugin) {
|
|
173655
173681
|
this.projectService.logger.info("Plugins were requested but not running in environment that supports 'require'. Nothing will be loaded");
|
|
173656
173682
|
return;
|
|
173657
173683
|
}
|
|
@@ -177095,7 +177121,7 @@ var ts;
|
|
|
177095
177121
|
/*@internal*/
|
|
177096
177122
|
ProjectService.prototype.requestEnablePlugin = function (project, pluginConfigEntry, searchPaths, pluginConfigOverrides) {
|
|
177097
177123
|
var _a;
|
|
177098
|
-
if (!this.host.
|
|
177124
|
+
if (!this.host.importPlugin && !this.host.require) {
|
|
177099
177125
|
this.logger.info("Plugins were requested but not running in environment that supports 'require'. Nothing will be loaded");
|
|
177100
177126
|
return;
|
|
177101
177127
|
}
|
|
@@ -177105,7 +177131,7 @@ var ts;
|
|
|
177105
177131
|
return;
|
|
177106
177132
|
}
|
|
177107
177133
|
// If the host supports dynamic import, begin enabling the plugin asynchronously.
|
|
177108
|
-
if (this.host.
|
|
177134
|
+
if (this.host.importPlugin) {
|
|
177109
177135
|
var importPromise = project.beginEnablePluginAsync(pluginConfigEntry, searchPaths, pluginConfigOverrides);
|
|
177110
177136
|
(_a = this.pendingPluginEnablements) !== null && _a !== void 0 ? _a : (this.pendingPluginEnablements = new ts.Map());
|
|
177111
177137
|
var promises = this.pendingPluginEnablements.get(project);
|