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/tsserver.js CHANGED
@@ -109,7 +109,7 @@ var ts;
109
109
  // The following is baselined as a literal template type without intervention
110
110
  /** The version of the TypeScript compiler release */
111
111
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
112
- ts.version = "4.8.2";
112
+ ts.version = "4.8.3";
113
113
  /* @internal */
114
114
  var Comparison;
115
115
  (function (Comparison) {
@@ -8875,7 +8875,7 @@ var ts;
8875
8875
  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."),
8876
8876
  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."),
8877
8877
  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."),
8878
- This_module_is_declared_with_using_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_using_export_and_can_only_be_used_with_a_default_import_when_using_the__2594", "This module is declared with using 'export =', and can only be used with a default import when using the '{0}' flag."),
8878
+ 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."),
8879
8879
  _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."),
8880
8880
  _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."),
8881
8881
  _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."),
@@ -44636,7 +44636,7 @@ var ts;
44636
44636
  var _a, _b;
44637
44637
  if (path === undefined)
44638
44638
  return path;
44639
- return ts.hostGetCanonicalFileName({ useCaseSensitiveFileNames: useCaseSensitiveFileNames })(ts.getNormalizedAbsolutePath(path, (_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a)));
44639
+ return ts.getNormalizedAbsolutePath(path, (_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a));
44640
44640
  }
44641
44641
  function combineDirectoryPath(root, dir) {
44642
44642
  return ts.ensureTrailingDirectorySeparator(ts.combinePaths(root, dir));
@@ -44656,7 +44656,7 @@ var ts;
44656
44656
  if ((extensions === Extensions.TypeScript || extensions === Extensions.JavaScript || extensions === Extensions.Json)
44657
44657
  && (state.compilerOptions.declarationDir || state.compilerOptions.outDir)
44658
44658
  && finalPath.indexOf("/node_modules/") === -1
44659
- && (state.compilerOptions.configFile ? ts.startsWith(toAbsolutePath(state.compilerOptions.configFile.fileName), scope.packageDirectory) : true)) {
44659
+ && (state.compilerOptions.configFile ? ts.containsPath(scope.packageDirectory, toAbsolutePath(state.compilerOptions.configFile.fileName), !useCaseSensitiveFileNames()) : true)) {
44660
44660
  // 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.
44661
44661
  // Even with all that, we still don't know if the root of the output file structure will be (relative to the package file)
44662
44662
  // `.`, `./src` or any other deeper directory structure. (If project references are used, it's definitely `.` by fiat, so that should be pretty common.)
@@ -44712,7 +44712,7 @@ var ts;
44712
44712
  var candidateDirectories = getOutputDirectoriesForBaseDirectory(commonSourceDirGuess);
44713
44713
  for (var _e = 0, candidateDirectories_1 = candidateDirectories; _e < candidateDirectories_1.length; _e++) {
44714
44714
  var candidateDir = candidateDirectories_1[_e];
44715
- if (ts.startsWith(finalPath, candidateDir)) {
44715
+ if (ts.containsPath(candidateDir, finalPath, !useCaseSensitiveFileNames())) {
44716
44716
  // 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
44717
44717
  var pathFragment = finalPath.slice(candidateDir.length + 1); // +1 to also remove directory seperator
44718
44718
  var possibleInputBase = ts.combinePaths(commonSourceDirGuess, pathFragment);
@@ -50994,41 +50994,61 @@ var ts;
50994
50994
  return typeof file.externalModuleIndicator !== "object" && !resolveExportByName(moduleSymbol, ts.escapeLeadingUnderscores("__esModule"), /*sourceNode*/ undefined, dontResolveAlias);
50995
50995
  }
50996
50996
  function getTargetOfImportClause(node, dontResolveAlias) {
50997
- var _a;
50998
50997
  var moduleSymbol = resolveExternalModuleName(node, node.parent.moduleSpecifier);
50999
50998
  if (moduleSymbol) {
51000
- var exportDefaultSymbol = void 0;
51001
- if (ts.isShorthandAmbientModuleSymbol(moduleSymbol)) {
51002
- exportDefaultSymbol = moduleSymbol;
51003
- }
51004
- else {
51005
- exportDefaultSymbol = resolveExportByName(moduleSymbol, "default" /* InternalSymbolName.Default */, node, dontResolveAlias);
51006
- }
51007
- var file = (_a = moduleSymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(ts.isSourceFile);
51008
- var hasDefaultOnly = isOnlyImportedAsDefault(node.parent.moduleSpecifier);
51009
- var hasSyntheticDefault = canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, node.parent.moduleSpecifier);
51010
- if (!exportDefaultSymbol && !hasSyntheticDefault && !hasDefaultOnly) {
51011
- if (hasExportAssignmentSymbol(moduleSymbol)) {
51012
- var compilerOptionName = moduleKind >= ts.ModuleKind.ES2015 ? "allowSyntheticDefaultImports" : "esModuleInterop";
51013
- var exportEqualsSymbol = moduleSymbol.exports.get("export=" /* InternalSymbolName.ExportEquals */);
51014
- var exportAssignment = exportEqualsSymbol.valueDeclaration;
51015
- var err = error(node.name, ts.Diagnostics.Module_0_can_only_be_default_imported_using_the_1_flag, symbolToString(moduleSymbol), compilerOptionName);
51016
- if (exportAssignment) {
51017
- ts.addRelatedInfo(err, ts.createDiagnosticForNode(exportAssignment, ts.Diagnostics.This_module_is_declared_with_using_export_and_can_only_be_used_with_a_default_import_when_using_the_0_flag, compilerOptionName));
51018
- }
51019
- }
51020
- else {
51021
- reportNonDefaultExport(moduleSymbol, node);
50999
+ return getTargetofModuleDefault(moduleSymbol, node, dontResolveAlias);
51000
+ }
51001
+ }
51002
+ function getTargetofModuleDefault(moduleSymbol, node, dontResolveAlias) {
51003
+ var _a;
51004
+ var exportDefaultSymbol;
51005
+ if (ts.isShorthandAmbientModuleSymbol(moduleSymbol)) {
51006
+ exportDefaultSymbol = moduleSymbol;
51007
+ }
51008
+ else {
51009
+ exportDefaultSymbol = resolveExportByName(moduleSymbol, "default" /* InternalSymbolName.Default */, node, dontResolveAlias);
51010
+ }
51011
+ var file = (_a = moduleSymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(ts.isSourceFile);
51012
+ var specifier = getModuleSpecifierForImportOrExport(node);
51013
+ if (!specifier) {
51014
+ return exportDefaultSymbol;
51015
+ }
51016
+ var hasDefaultOnly = isOnlyImportedAsDefault(specifier);
51017
+ var hasSyntheticDefault = canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, specifier);
51018
+ if (!exportDefaultSymbol && !hasSyntheticDefault && !hasDefaultOnly) {
51019
+ if (hasExportAssignmentSymbol(moduleSymbol)) {
51020
+ var compilerOptionName = moduleKind >= ts.ModuleKind.ES2015 ? "allowSyntheticDefaultImports" : "esModuleInterop";
51021
+ var exportEqualsSymbol = moduleSymbol.exports.get("export=" /* InternalSymbolName.ExportEquals */);
51022
+ var exportAssignment = exportEqualsSymbol.valueDeclaration;
51023
+ var err = error(node.name, ts.Diagnostics.Module_0_can_only_be_default_imported_using_the_1_flag, symbolToString(moduleSymbol), compilerOptionName);
51024
+ if (exportAssignment) {
51025
+ 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));
51022
51026
  }
51023
51027
  }
51024
- else if (hasSyntheticDefault || hasDefaultOnly) {
51025
- // per emit behavior, a synthetic default overrides a "real" .default member if `__esModule` is not present
51026
- var resolved = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias) || resolveSymbol(moduleSymbol, dontResolveAlias);
51027
- markSymbolOfAliasDeclarationIfTypeOnly(node, moduleSymbol, resolved, /*overwriteTypeOnly*/ false);
51028
- return resolved;
51028
+ else if (ts.isImportClause(node)) {
51029
+ reportNonDefaultExport(moduleSymbol, node);
51029
51030
  }
51030
- markSymbolOfAliasDeclarationIfTypeOnly(node, exportDefaultSymbol, /*finalTarget*/ undefined, /*overwriteTypeOnly*/ false);
51031
- return exportDefaultSymbol;
51031
+ else {
51032
+ errorNoModuleMemberSymbol(moduleSymbol, moduleSymbol, node, ts.isImportOrExportSpecifier(node) && node.propertyName || node.name);
51033
+ }
51034
+ }
51035
+ else if (hasSyntheticDefault || hasDefaultOnly) {
51036
+ // per emit behavior, a synthetic default overrides a "real" .default member if `__esModule` is not present
51037
+ var resolved = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias) || resolveSymbol(moduleSymbol, dontResolveAlias);
51038
+ markSymbolOfAliasDeclarationIfTypeOnly(node, moduleSymbol, resolved, /*overwriteTypeOnly*/ false);
51039
+ return resolved;
51040
+ }
51041
+ markSymbolOfAliasDeclarationIfTypeOnly(node, exportDefaultSymbol, /*finalTarget*/ undefined, /*overwriteTypeOnly*/ false);
51042
+ return exportDefaultSymbol;
51043
+ }
51044
+ function getModuleSpecifierForImportOrExport(node) {
51045
+ switch (node.kind) {
51046
+ case 267 /* SyntaxKind.ImportClause */: return node.parent.moduleSpecifier;
51047
+ case 265 /* SyntaxKind.ImportEqualsDeclaration */: return ts.isExternalModuleReference(node.moduleReference) ? node.moduleReference.expression : undefined;
51048
+ case 268 /* SyntaxKind.NamespaceImport */: return node.parent.parent.moduleSpecifier;
51049
+ case 270 /* SyntaxKind.ImportSpecifier */: return node.parent.parent.parent.moduleSpecifier;
51050
+ case 275 /* SyntaxKind.ExportSpecifier */: return node.parent.parent.moduleSpecifier;
51051
+ default: return ts.Debug.assertNever(node);
51032
51052
  }
51033
51053
  }
51034
51054
  function reportNonDefaultExport(moduleSymbol, node) {
@@ -51118,7 +51138,7 @@ var ts;
51118
51138
  }
51119
51139
  }
51120
51140
  function getExternalModuleMember(node, specifier, dontResolveAlias) {
51121
- var _a, _b;
51141
+ var _a;
51122
51142
  if (dontResolveAlias === void 0) { dontResolveAlias = false; }
51123
51143
  var moduleSpecifier = ts.getExternalModuleRequireArgument(node) || node.moduleSpecifier;
51124
51144
  var moduleSymbol = resolveExternalModuleName(node, moduleSpecifier); // TODO: GH#18217
@@ -51154,29 +51174,33 @@ var ts;
51154
51174
  combineValueAndTypeSymbols(symbolFromVariable, symbolFromModule) :
51155
51175
  symbolFromModule || symbolFromVariable;
51156
51176
  if (!symbol) {
51157
- var moduleName = getFullyQualifiedName(moduleSymbol, node);
51158
- var declarationName = ts.declarationNameToString(name);
51159
- var suggestion = getSuggestedSymbolForNonexistentModule(name, targetSymbol);
51160
- if (suggestion !== undefined) {
51161
- var suggestionName = symbolToString(suggestion);
51162
- var diagnostic = error(name, ts.Diagnostics._0_has_no_exported_member_named_1_Did_you_mean_2, moduleName, declarationName, suggestionName);
51163
- if (suggestion.valueDeclaration) {
51164
- ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(suggestion.valueDeclaration, ts.Diagnostics._0_is_declared_here, suggestionName));
51165
- }
51166
- }
51167
- else {
51168
- if ((_b = moduleSymbol.exports) === null || _b === void 0 ? void 0 : _b.has("default" /* InternalSymbolName.Default */)) {
51169
- error(name, ts.Diagnostics.Module_0_has_no_exported_member_1_Did_you_mean_to_use_import_1_from_0_instead, moduleName, declarationName);
51170
- }
51171
- else {
51172
- reportNonExportedMember(node, name, declarationName, moduleSymbol, moduleName);
51173
- }
51174
- }
51177
+ errorNoModuleMemberSymbol(moduleSymbol, targetSymbol, node, name);
51175
51178
  }
51176
51179
  return symbol;
51177
51180
  }
51178
51181
  }
51179
51182
  }
51183
+ function errorNoModuleMemberSymbol(moduleSymbol, targetSymbol, node, name) {
51184
+ var _a;
51185
+ var moduleName = getFullyQualifiedName(moduleSymbol, node);
51186
+ var declarationName = ts.declarationNameToString(name);
51187
+ var suggestion = getSuggestedSymbolForNonexistentModule(name, targetSymbol);
51188
+ if (suggestion !== undefined) {
51189
+ var suggestionName = symbolToString(suggestion);
51190
+ var diagnostic = error(name, ts.Diagnostics._0_has_no_exported_member_named_1_Did_you_mean_2, moduleName, declarationName, suggestionName);
51191
+ if (suggestion.valueDeclaration) {
51192
+ ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(suggestion.valueDeclaration, ts.Diagnostics._0_is_declared_here, suggestionName));
51193
+ }
51194
+ }
51195
+ else {
51196
+ if ((_a = moduleSymbol.exports) === null || _a === void 0 ? void 0 : _a.has("default" /* InternalSymbolName.Default */)) {
51197
+ error(name, ts.Diagnostics.Module_0_has_no_exported_member_1_Did_you_mean_to_use_import_1_from_0_instead, moduleName, declarationName);
51198
+ }
51199
+ else {
51200
+ reportNonExportedMember(node, name, declarationName, moduleSymbol, moduleName);
51201
+ }
51202
+ }
51203
+ }
51180
51204
  function reportNonExportedMember(node, name, declarationName, moduleSymbol, moduleName) {
51181
51205
  var _a, _b;
51182
51206
  var localSymbol = (_b = (_a = moduleSymbol.valueDeclaration) === null || _a === void 0 ? void 0 : _a.locals) === null || _b === void 0 ? void 0 : _b.get(name.escapedText);
@@ -51222,6 +51246,13 @@ var ts;
51222
51246
  }
51223
51247
  }
51224
51248
  function getTargetOfImportSpecifier(node, dontResolveAlias) {
51249
+ if (ts.isImportSpecifier(node) && ts.idText(node.propertyName || node.name) === "default" /* InternalSymbolName.Default */) {
51250
+ var specifier = getModuleSpecifierForImportOrExport(node);
51251
+ var moduleSymbol = specifier && resolveExternalModuleName(node, specifier);
51252
+ if (moduleSymbol) {
51253
+ return getTargetofModuleDefault(moduleSymbol, node, dontResolveAlias);
51254
+ }
51255
+ }
51225
51256
  var root = ts.isBindingElement(node) ? ts.getRootDeclaration(node) : node.parent.parent.parent;
51226
51257
  var commonJSPropertyAccess = getCommonJSPropertyAccess(root);
51227
51258
  var resolved = getExternalModuleMember(root, commonJSPropertyAccess || node, dontResolveAlias);
@@ -51243,6 +51274,13 @@ var ts;
51243
51274
  return resolved;
51244
51275
  }
51245
51276
  function getTargetOfExportSpecifier(node, meaning, dontResolveAlias) {
51277
+ if (ts.idText(node.propertyName || node.name) === "default" /* InternalSymbolName.Default */) {
51278
+ var specifier = getModuleSpecifierForImportOrExport(node);
51279
+ var moduleSymbol = specifier && resolveExternalModuleName(node, specifier);
51280
+ if (moduleSymbol) {
51281
+ return getTargetofModuleDefault(moduleSymbol, node, !!dontResolveAlias);
51282
+ }
51283
+ }
51246
51284
  var resolved = node.parent.parent.moduleSpecifier ?
51247
51285
  getExternalModuleMember(node.parent.parent, node, dontResolveAlias) :
51248
51286
  resolveEntityName(node.propertyName || node.name, meaning, /*ignoreErrors*/ false, dontResolveAlias);
@@ -62193,7 +62231,7 @@ var ts;
62193
62231
  return includes & 8388608 /* TypeFlags.IncludesWildcard */ ? wildcardType : anyType;
62194
62232
  }
62195
62233
  if (!strictNullChecks && includes & 98304 /* TypeFlags.Nullable */) {
62196
- return includes & 32768 /* TypeFlags.Undefined */ ? undefinedType : nullType;
62234
+ return includes & 16777216 /* TypeFlags.IncludesEmptyObject */ ? neverType : includes & 32768 /* TypeFlags.Undefined */ ? undefinedType : nullType;
62197
62235
  }
62198
62236
  if (includes & 4 /* TypeFlags.String */ && includes & (128 /* TypeFlags.StringLiteral */ | 134217728 /* TypeFlags.TemplateLiteral */ | 268435456 /* TypeFlags.StringMapping */) ||
62199
62237
  includes & 8 /* TypeFlags.Number */ && includes & 256 /* TypeFlags.NumberLiteral */ ||
@@ -62883,7 +62921,7 @@ var ts;
62883
62921
  // (T | U)[K] -> T[K] | U[K] (reading)
62884
62922
  // (T | U)[K] -> T[K] & U[K] (writing)
62885
62923
  // (T & U)[K] -> T[K] & U[K]
62886
- if (objectType.flags & 3145728 /* TypeFlags.UnionOrIntersection */) {
62924
+ if (objectType.flags & 1048576 /* TypeFlags.Union */ || objectType.flags & 2097152 /* TypeFlags.Intersection */ && !shouldDeferIndexType(objectType)) {
62887
62925
  var types = ts.map(objectType.types, function (t) { return getSimplifiedType(getIndexedAccessType(t, indexType), writing); });
62888
62926
  return objectType.flags & 2097152 /* TypeFlags.Intersection */ || writing ? getIntersectionType(types) : getUnionType(types);
62889
62927
  }
@@ -65291,7 +65329,7 @@ var ts;
65291
65329
  if (reduced !== type) {
65292
65330
  return reduced;
65293
65331
  }
65294
- if (type.flags & 2097152 /* TypeFlags.Intersection */) {
65332
+ if (type.flags & 2097152 /* TypeFlags.Intersection */ && ts.some(type.types, isEmptyAnonymousObjectType)) {
65295
65333
  var normalizedTypes = ts.sameMap(type.types, function (t) { return getNormalizedType(t, writing); });
65296
65334
  if (normalizedTypes !== type.types) {
65297
65335
  return getIntersectionType(normalizedTypes);
@@ -66462,7 +66500,7 @@ var ts;
66462
66500
  // create a new chain for the constraint error
66463
66501
  resetErrorInfo(saveErrorInfo);
66464
66502
  }
66465
- if (result = isRelatedTo(source, constraint, 2 /* RecursionFlags.Target */, reportErrors)) {
66503
+ if (result = isRelatedTo(source, constraint, 2 /* RecursionFlags.Target */, reportErrors, /* headMessage */ undefined, intersectionState)) {
66466
66504
  return result;
66467
66505
  }
66468
66506
  // prefer the shorter chain of the constraint comparison chain, and the direct comparison chain
@@ -66554,8 +66592,8 @@ var ts;
66554
66592
  var skipTrue = !isTypeAssignableTo(getPermissiveInstantiation(c.checkType), getPermissiveInstantiation(c.extendsType));
66555
66593
  var skipFalse = !skipTrue && isTypeAssignableTo(getRestrictiveInstantiation(c.checkType), getRestrictiveInstantiation(c.extendsType));
66556
66594
  // TODO: Find a nice way to include potential conditional type breakdowns in error output, if they seem good (they usually don't)
66557
- if (result = skipTrue ? -1 /* Ternary.True */ : isRelatedTo(source, getTrueTypeFromConditionalType(c), 2 /* RecursionFlags.Target */, /*reportErrors*/ false)) {
66558
- result &= skipFalse ? -1 /* Ternary.True */ : isRelatedTo(source, getFalseTypeFromConditionalType(c), 2 /* RecursionFlags.Target */, /*reportErrors*/ false);
66595
+ if (result = skipTrue ? -1 /* Ternary.True */ : isRelatedTo(source, getTrueTypeFromConditionalType(c), 2 /* RecursionFlags.Target */, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState)) {
66596
+ result &= skipFalse ? -1 /* Ternary.True */ : isRelatedTo(source, getFalseTypeFromConditionalType(c), 2 /* RecursionFlags.Target */, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState);
66559
66597
  if (result) {
66560
66598
  return result;
66561
66599
  }
@@ -71584,7 +71622,7 @@ var ts;
71584
71622
  var narrowedPropType = narrowType(propType);
71585
71623
  return filterType(type, function (t) {
71586
71624
  var discriminantType = getTypeOfPropertyOrIndexSignature(t, propName);
71587
- return !(narrowedPropType.flags & 131072 /* TypeFlags.Never */) && isTypeComparableTo(narrowedPropType, discriminantType);
71625
+ return !(narrowedPropType.flags & 131072 /* TypeFlags.Never */) && areTypesComparable(narrowedPropType, discriminantType);
71588
71626
  });
71589
71627
  }
71590
71628
  function narrowTypeByDiscriminantProperty(type, access, operator, value, assumeTrue) {
@@ -71633,7 +71671,7 @@ var ts;
71633
71671
  }
71634
71672
  function narrowByInKeyword(type, name, assumeTrue) {
71635
71673
  if (type.flags & 1048576 /* TypeFlags.Union */
71636
- || type.flags & 524288 /* TypeFlags.Object */ && declaredType !== type
71674
+ || type.flags & 524288 /* TypeFlags.Object */ && declaredType !== type && !(declaredType === unknownType && isEmptyAnonymousObjectType(type))
71637
71675
  || ts.isThisTypeParameter(type)
71638
71676
  || type.flags & 2097152 /* TypeFlags.Intersection */ && ts.every(type.types, function (t) { return t.symbol !== globalThisSymbol; })) {
71639
71677
  return filterType(type, function (t) { return isTypePresencePossible(t, name, assumeTrue); });
@@ -71766,14 +71804,18 @@ var ts;
71766
71804
  assumeTrue = !assumeTrue;
71767
71805
  }
71768
71806
  var valueType = getTypeOfExpression(value);
71769
- if ((type.flags & 2 /* TypeFlags.Unknown */) && assumeTrue && (operator === 36 /* SyntaxKind.EqualsEqualsEqualsToken */ || operator === 37 /* SyntaxKind.ExclamationEqualsEqualsToken */)) {
71807
+ if (((type.flags & 2 /* TypeFlags.Unknown */) || isEmptyAnonymousObjectType(type) && !(valueType.flags & 98304 /* TypeFlags.Nullable */)) &&
71808
+ assumeTrue &&
71809
+ (operator === 36 /* SyntaxKind.EqualsEqualsEqualsToken */ || operator === 37 /* SyntaxKind.ExclamationEqualsEqualsToken */)) {
71770
71810
  if (valueType.flags & (131068 /* TypeFlags.Primitive */ | 67108864 /* TypeFlags.NonPrimitive */)) {
71771
71811
  return valueType;
71772
71812
  }
71773
71813
  if (valueType.flags & 524288 /* TypeFlags.Object */) {
71774
71814
  return nonPrimitiveType;
71775
71815
  }
71776
- return type;
71816
+ if (type.flags & 2 /* TypeFlags.Unknown */) {
71817
+ return type;
71818
+ }
71777
71819
  }
71778
71820
  if (valueType.flags & 98304 /* TypeFlags.Nullable */) {
71779
71821
  if (!strictNullChecks) {
@@ -72232,7 +72274,9 @@ var ts;
72232
72274
  !!(type.flags & 465829888 /* TypeFlags.Instantiable */ && getBaseConstraintOrType(type).flags & (98304 /* TypeFlags.Nullable */ | 1048576 /* TypeFlags.Union */));
72233
72275
  }
72234
72276
  function isGenericTypeWithoutNullableConstraint(type) {
72235
- return !!(type.flags & 465829888 /* TypeFlags.Instantiable */ && !maybeTypeOfKind(getBaseConstraintOrType(type), 98304 /* TypeFlags.Nullable */));
72277
+ return type.flags & 2097152 /* TypeFlags.Intersection */ ?
72278
+ ts.some(type.types, isGenericTypeWithoutNullableConstraint) :
72279
+ !!(type.flags & 465829888 /* TypeFlags.Instantiable */ && !maybeTypeOfKind(getBaseConstraintOrType(type), 98304 /* TypeFlags.Nullable */));
72236
72280
  }
72237
72281
  function hasContextualTypeWithNoGenericTypes(node, checkMode) {
72238
72282
  // Computing the contextual type for a child of a JSX element involves resolving the type of the
@@ -126929,9 +126973,7 @@ var ts;
126929
126973
  }
126930
126974
  }
126931
126975
  }
126932
- var seenRefs = buildInfoPath ? new ts.Set() : undefined;
126933
126976
  var buildInfoCacheEntry = state.buildInfoCache.get(resolvedPath);
126934
- seenRefs === null || seenRefs === void 0 ? void 0 : seenRefs.add(resolvedPath);
126935
126977
  /** Inputs are up-to-date, just need either timestamp update or bundle prepend manipulation to make it look up-to-date */
126936
126978
  var pseudoUpToDate = false;
126937
126979
  var usesPrepend = false;
@@ -126946,7 +126988,7 @@ var ts;
126946
126988
  continue;
126947
126989
  }
126948
126990
  // Check if tsbuildinfo path is shared, then we need to rebuild
126949
- if (buildInfoCacheEntry && hasSameBuildInfo(state, buildInfoCacheEntry, seenRefs, resolvedConfig, resolvedRefPath)) {
126991
+ if (buildInfoCacheEntry && hasSameBuildInfo(state, buildInfoCacheEntry, resolvedRefPath)) {
126950
126992
  return {
126951
126993
  type: ts.UpToDateStatusType.OutOfDateWithUpstream,
126952
126994
  outOfDateOutputFileName: buildInfoPath,
@@ -127004,25 +127046,9 @@ var ts;
127004
127046
  oldestOutputFileName: oldestOutputFileName
127005
127047
  };
127006
127048
  }
127007
- function hasSameBuildInfo(state, buildInfoCacheEntry, seenRefs, resolvedConfig, resolvedRefPath) {
127008
- if (seenRefs.has(resolvedRefPath))
127009
- return false;
127010
- seenRefs.add(resolvedRefPath);
127049
+ function hasSameBuildInfo(state, buildInfoCacheEntry, resolvedRefPath) {
127011
127050
  var refBuildInfo = state.buildInfoCache.get(resolvedRefPath);
127012
- if (refBuildInfo.path === buildInfoCacheEntry.path)
127013
- return true;
127014
- if (resolvedConfig.projectReferences) {
127015
- // Check references
127016
- for (var _i = 0, _a = resolvedConfig.projectReferences; _i < _a.length; _i++) {
127017
- var ref = _a[_i];
127018
- var resolvedRef = ts.resolveProjectReferencePath(ref);
127019
- var resolvedRefPath_1 = toResolvedConfigFilePath(state, resolvedRef);
127020
- var resolvedConfig_1 = parseConfigFile(state, resolvedRef, resolvedRefPath_1);
127021
- if (hasSameBuildInfo(state, buildInfoCacheEntry, seenRefs, resolvedConfig_1, resolvedRefPath_1))
127022
- return true;
127023
- }
127024
- }
127025
- return false;
127051
+ return refBuildInfo.path === buildInfoCacheEntry.path;
127026
127052
  }
127027
127053
  function getUpToDateStatus(state, project, resolvedPath) {
127028
127054
  if (project === undefined) {
@@ -171614,13 +171640,13 @@ var ts;
171614
171640
  return __generator(this, function (_a) {
171615
171641
  switch (_a.label) {
171616
171642
  case 0:
171617
- ts.Debug.assertIsDefined(host.importServicePlugin);
171643
+ ts.Debug.assertIsDefined(host.importPlugin);
171618
171644
  resolvedPath = ts.combinePaths(initialDir, "node_modules");
171619
171645
  log("Dynamically importing ".concat(moduleName, " from ").concat(initialDir, " (resolved to ").concat(resolvedPath, ")"));
171620
171646
  _a.label = 1;
171621
171647
  case 1:
171622
171648
  _a.trys.push([1, 3, , 4]);
171623
- return [4 /*yield*/, host.importServicePlugin(resolvedPath, moduleName)];
171649
+ return [4 /*yield*/, host.importPlugin(resolvedPath, moduleName)];
171624
171650
  case 2:
171625
171651
  result = _a.sent();
171626
171652
  return [3 /*break*/, 4];
@@ -172699,7 +172725,7 @@ var ts;
172699
172725
  };
172700
172726
  Project.prototype.enableGlobalPlugins = function (options, pluginConfigOverrides) {
172701
172727
  var host = this.projectService.host;
172702
- if (!host.require && !host.importServicePlugin) {
172728
+ if (!host.require && !host.importPlugin) {
172703
172729
  this.projectService.logger.info("Plugins were requested but not running in environment that supports 'require'. Nothing will be loaded");
172704
172730
  return;
172705
172731
  }
@@ -172756,7 +172782,7 @@ var ts;
172756
172782
  return __generator(this, function (_a) {
172757
172783
  switch (_a.label) {
172758
172784
  case 0:
172759
- ts.Debug.assertIsDefined(this.projectService.host.importServicePlugin);
172785
+ ts.Debug.assertIsDefined(this.projectService.host.importPlugin);
172760
172786
  log = function (message) { return _this.projectService.logger.info(message); };
172761
172787
  logError = function (message) {
172762
172788
  (errorLogs !== null && errorLogs !== void 0 ? errorLogs : (errorLogs = [])).push(message);
@@ -173457,7 +173483,7 @@ var ts;
173457
173483
  /*@internal*/
173458
173484
  ConfiguredProject.prototype.enablePluginsWithOptions = function (options, pluginConfigOverrides) {
173459
173485
  var host = this.projectService.host;
173460
- if (!host.require && !host.importServicePlugin) {
173486
+ if (!host.require && !host.importPlugin) {
173461
173487
  this.projectService.logger.info("Plugins were requested but not running in environment that supports 'require'. Nothing will be loaded");
173462
173488
  return;
173463
173489
  }
@@ -176901,7 +176927,7 @@ var ts;
176901
176927
  /*@internal*/
176902
176928
  ProjectService.prototype.requestEnablePlugin = function (project, pluginConfigEntry, searchPaths, pluginConfigOverrides) {
176903
176929
  var _a;
176904
- if (!this.host.importServicePlugin && !this.host.require) {
176930
+ if (!this.host.importPlugin && !this.host.require) {
176905
176931
  this.logger.info("Plugins were requested but not running in environment that supports 'require'. Nothing will be loaded");
176906
176932
  return;
176907
176933
  }
@@ -176911,7 +176937,7 @@ var ts;
176911
176937
  return;
176912
176938
  }
176913
176939
  // If the host supports dynamic import, begin enabling the plugin asynchronously.
176914
- if (this.host.importServicePlugin) {
176940
+ if (this.host.importPlugin) {
176915
176941
  var importPromise = project.beginEnablePluginAsync(pluginConfigEntry, searchPaths, pluginConfigOverrides);
176916
176942
  (_a = this.pendingPluginEnablements) !== null && _a !== void 0 ? _a : (this.pendingPluginEnablements = new ts.Map());
176917
176943
  var promises = this.pendingPluginEnablements.get(project);
@@ -181210,7 +181236,7 @@ var ts;
181210
181236
  setImmediate: function (x) { return setTimeout(x, 0); },
181211
181237
  clearImmediate: function (handle) { return clearTimeout(handle); },
181212
181238
  /* eslint-enable no-restricted-globals */
181213
- importServicePlugin: function (initialDir, moduleName) { return __awaiter(_this, void 0, void 0, function () {
181239
+ importPlugin: function (initialDir, moduleName) { return __awaiter(_this, void 0, void 0, function () {
181214
181240
  var packageRoot, packageJson, packageJsonResponse, e_1, browser, scriptPath, module_1, e_2;
181215
181241
  return __generator(this, function (_a) {
181216
181242
  switch (_a.label) {
@@ -7033,7 +7033,6 @@ declare namespace ts.server {
7033
7033
  gc?(): void;
7034
7034
  trace?(s: string): void;
7035
7035
  require?(initialPath: string, moduleName: string): ModuleImportResult;
7036
- importServicePlugin?(root: string, moduleName: string): Promise<ModuleImportResult>;
7037
7036
  }
7038
7037
  }
7039
7038
  declare namespace ts.server {