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.
@@ -89,7 +89,7 @@ var ts;
89
89
  // The following is baselined as a literal template type without intervention
90
90
  /** The version of the TypeScript compiler release */
91
91
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
92
- ts.version = "4.8.2";
92
+ ts.version = "4.8.3";
93
93
  /* @internal */
94
94
  var Comparison;
95
95
  (function (Comparison) {
@@ -8855,7 +8855,7 @@ var ts;
8855
8855
  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."),
8856
8856
  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."),
8857
8857
  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."),
8858
- 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."),
8858
+ 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."),
8859
8859
  _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."),
8860
8860
  _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."),
8861
8861
  _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."),
@@ -44616,7 +44616,7 @@ var ts;
44616
44616
  var _a, _b;
44617
44617
  if (path === undefined)
44618
44618
  return path;
44619
- return ts.hostGetCanonicalFileName({ useCaseSensitiveFileNames: useCaseSensitiveFileNames })(ts.getNormalizedAbsolutePath(path, (_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a)));
44619
+ return ts.getNormalizedAbsolutePath(path, (_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a));
44620
44620
  }
44621
44621
  function combineDirectoryPath(root, dir) {
44622
44622
  return ts.ensureTrailingDirectorySeparator(ts.combinePaths(root, dir));
@@ -44636,7 +44636,7 @@ var ts;
44636
44636
  if ((extensions === Extensions.TypeScript || extensions === Extensions.JavaScript || extensions === Extensions.Json)
44637
44637
  && (state.compilerOptions.declarationDir || state.compilerOptions.outDir)
44638
44638
  && finalPath.indexOf("/node_modules/") === -1
44639
- && (state.compilerOptions.configFile ? ts.startsWith(toAbsolutePath(state.compilerOptions.configFile.fileName), scope.packageDirectory) : true)) {
44639
+ && (state.compilerOptions.configFile ? ts.containsPath(scope.packageDirectory, toAbsolutePath(state.compilerOptions.configFile.fileName), !useCaseSensitiveFileNames()) : true)) {
44640
44640
  // 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.
44641
44641
  // Even with all that, we still don't know if the root of the output file structure will be (relative to the package file)
44642
44642
  // `.`, `./src` or any other deeper directory structure. (If project references are used, it's definitely `.` by fiat, so that should be pretty common.)
@@ -44692,7 +44692,7 @@ var ts;
44692
44692
  var candidateDirectories = getOutputDirectoriesForBaseDirectory(commonSourceDirGuess);
44693
44693
  for (var _e = 0, candidateDirectories_1 = candidateDirectories; _e < candidateDirectories_1.length; _e++) {
44694
44694
  var candidateDir = candidateDirectories_1[_e];
44695
- if (ts.startsWith(finalPath, candidateDir)) {
44695
+ if (ts.containsPath(candidateDir, finalPath, !useCaseSensitiveFileNames())) {
44696
44696
  // 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
44697
44697
  var pathFragment = finalPath.slice(candidateDir.length + 1); // +1 to also remove directory seperator
44698
44698
  var possibleInputBase = ts.combinePaths(commonSourceDirGuess, pathFragment);
@@ -50974,41 +50974,61 @@ var ts;
50974
50974
  return typeof file.externalModuleIndicator !== "object" && !resolveExportByName(moduleSymbol, ts.escapeLeadingUnderscores("__esModule"), /*sourceNode*/ undefined, dontResolveAlias);
50975
50975
  }
50976
50976
  function getTargetOfImportClause(node, dontResolveAlias) {
50977
- var _a;
50978
50977
  var moduleSymbol = resolveExternalModuleName(node, node.parent.moduleSpecifier);
50979
50978
  if (moduleSymbol) {
50980
- var exportDefaultSymbol = void 0;
50981
- if (ts.isShorthandAmbientModuleSymbol(moduleSymbol)) {
50982
- exportDefaultSymbol = moduleSymbol;
50983
- }
50984
- else {
50985
- exportDefaultSymbol = resolveExportByName(moduleSymbol, "default" /* InternalSymbolName.Default */, node, dontResolveAlias);
50986
- }
50987
- var file = (_a = moduleSymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(ts.isSourceFile);
50988
- var hasDefaultOnly = isOnlyImportedAsDefault(node.parent.moduleSpecifier);
50989
- var hasSyntheticDefault = canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, node.parent.moduleSpecifier);
50990
- if (!exportDefaultSymbol && !hasSyntheticDefault && !hasDefaultOnly) {
50991
- if (hasExportAssignmentSymbol(moduleSymbol)) {
50992
- var compilerOptionName = moduleKind >= ts.ModuleKind.ES2015 ? "allowSyntheticDefaultImports" : "esModuleInterop";
50993
- var exportEqualsSymbol = moduleSymbol.exports.get("export=" /* InternalSymbolName.ExportEquals */);
50994
- var exportAssignment = exportEqualsSymbol.valueDeclaration;
50995
- var err = error(node.name, ts.Diagnostics.Module_0_can_only_be_default_imported_using_the_1_flag, symbolToString(moduleSymbol), compilerOptionName);
50996
- if (exportAssignment) {
50997
- 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));
50998
- }
50999
- }
51000
- else {
51001
- reportNonDefaultExport(moduleSymbol, node);
50979
+ return getTargetofModuleDefault(moduleSymbol, node, dontResolveAlias);
50980
+ }
50981
+ }
50982
+ function getTargetofModuleDefault(moduleSymbol, node, dontResolveAlias) {
50983
+ var _a;
50984
+ var exportDefaultSymbol;
50985
+ if (ts.isShorthandAmbientModuleSymbol(moduleSymbol)) {
50986
+ exportDefaultSymbol = moduleSymbol;
50987
+ }
50988
+ else {
50989
+ exportDefaultSymbol = resolveExportByName(moduleSymbol, "default" /* InternalSymbolName.Default */, node, dontResolveAlias);
50990
+ }
50991
+ var file = (_a = moduleSymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(ts.isSourceFile);
50992
+ var specifier = getModuleSpecifierForImportOrExport(node);
50993
+ if (!specifier) {
50994
+ return exportDefaultSymbol;
50995
+ }
50996
+ var hasDefaultOnly = isOnlyImportedAsDefault(specifier);
50997
+ var hasSyntheticDefault = canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, specifier);
50998
+ if (!exportDefaultSymbol && !hasSyntheticDefault && !hasDefaultOnly) {
50999
+ if (hasExportAssignmentSymbol(moduleSymbol)) {
51000
+ var compilerOptionName = moduleKind >= ts.ModuleKind.ES2015 ? "allowSyntheticDefaultImports" : "esModuleInterop";
51001
+ var exportEqualsSymbol = moduleSymbol.exports.get("export=" /* InternalSymbolName.ExportEquals */);
51002
+ var exportAssignment = exportEqualsSymbol.valueDeclaration;
51003
+ var err = error(node.name, ts.Diagnostics.Module_0_can_only_be_default_imported_using_the_1_flag, symbolToString(moduleSymbol), compilerOptionName);
51004
+ if (exportAssignment) {
51005
+ 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));
51002
51006
  }
51003
51007
  }
51004
- else if (hasSyntheticDefault || hasDefaultOnly) {
51005
- // per emit behavior, a synthetic default overrides a "real" .default member if `__esModule` is not present
51006
- var resolved = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias) || resolveSymbol(moduleSymbol, dontResolveAlias);
51007
- markSymbolOfAliasDeclarationIfTypeOnly(node, moduleSymbol, resolved, /*overwriteTypeOnly*/ false);
51008
- return resolved;
51008
+ else if (ts.isImportClause(node)) {
51009
+ reportNonDefaultExport(moduleSymbol, node);
51010
+ }
51011
+ else {
51012
+ errorNoModuleMemberSymbol(moduleSymbol, moduleSymbol, node, ts.isImportOrExportSpecifier(node) && node.propertyName || node.name);
51009
51013
  }
51010
- markSymbolOfAliasDeclarationIfTypeOnly(node, exportDefaultSymbol, /*finalTarget*/ undefined, /*overwriteTypeOnly*/ false);
51011
- return exportDefaultSymbol;
51014
+ }
51015
+ else if (hasSyntheticDefault || hasDefaultOnly) {
51016
+ // per emit behavior, a synthetic default overrides a "real" .default member if `__esModule` is not present
51017
+ var resolved = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias) || resolveSymbol(moduleSymbol, dontResolveAlias);
51018
+ markSymbolOfAliasDeclarationIfTypeOnly(node, moduleSymbol, resolved, /*overwriteTypeOnly*/ false);
51019
+ return resolved;
51020
+ }
51021
+ markSymbolOfAliasDeclarationIfTypeOnly(node, exportDefaultSymbol, /*finalTarget*/ undefined, /*overwriteTypeOnly*/ false);
51022
+ return exportDefaultSymbol;
51023
+ }
51024
+ function getModuleSpecifierForImportOrExport(node) {
51025
+ switch (node.kind) {
51026
+ case 267 /* SyntaxKind.ImportClause */: return node.parent.moduleSpecifier;
51027
+ case 265 /* SyntaxKind.ImportEqualsDeclaration */: return ts.isExternalModuleReference(node.moduleReference) ? node.moduleReference.expression : undefined;
51028
+ case 268 /* SyntaxKind.NamespaceImport */: return node.parent.parent.moduleSpecifier;
51029
+ case 270 /* SyntaxKind.ImportSpecifier */: return node.parent.parent.parent.moduleSpecifier;
51030
+ case 275 /* SyntaxKind.ExportSpecifier */: return node.parent.parent.moduleSpecifier;
51031
+ default: return ts.Debug.assertNever(node);
51012
51032
  }
51013
51033
  }
51014
51034
  function reportNonDefaultExport(moduleSymbol, node) {
@@ -51098,7 +51118,7 @@ var ts;
51098
51118
  }
51099
51119
  }
51100
51120
  function getExternalModuleMember(node, specifier, dontResolveAlias) {
51101
- var _a, _b;
51121
+ var _a;
51102
51122
  if (dontResolveAlias === void 0) { dontResolveAlias = false; }
51103
51123
  var moduleSpecifier = ts.getExternalModuleRequireArgument(node) || node.moduleSpecifier;
51104
51124
  var moduleSymbol = resolveExternalModuleName(node, moduleSpecifier); // TODO: GH#18217
@@ -51134,29 +51154,33 @@ var ts;
51134
51154
  combineValueAndTypeSymbols(symbolFromVariable, symbolFromModule) :
51135
51155
  symbolFromModule || symbolFromVariable;
51136
51156
  if (!symbol) {
51137
- var moduleName = getFullyQualifiedName(moduleSymbol, node);
51138
- var declarationName = ts.declarationNameToString(name);
51139
- var suggestion = getSuggestedSymbolForNonexistentModule(name, targetSymbol);
51140
- if (suggestion !== undefined) {
51141
- var suggestionName = symbolToString(suggestion);
51142
- var diagnostic = error(name, ts.Diagnostics._0_has_no_exported_member_named_1_Did_you_mean_2, moduleName, declarationName, suggestionName);
51143
- if (suggestion.valueDeclaration) {
51144
- ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(suggestion.valueDeclaration, ts.Diagnostics._0_is_declared_here, suggestionName));
51145
- }
51146
- }
51147
- else {
51148
- if ((_b = moduleSymbol.exports) === null || _b === void 0 ? void 0 : _b.has("default" /* InternalSymbolName.Default */)) {
51149
- error(name, ts.Diagnostics.Module_0_has_no_exported_member_1_Did_you_mean_to_use_import_1_from_0_instead, moduleName, declarationName);
51150
- }
51151
- else {
51152
- reportNonExportedMember(node, name, declarationName, moduleSymbol, moduleName);
51153
- }
51154
- }
51157
+ errorNoModuleMemberSymbol(moduleSymbol, targetSymbol, node, name);
51155
51158
  }
51156
51159
  return symbol;
51157
51160
  }
51158
51161
  }
51159
51162
  }
51163
+ function errorNoModuleMemberSymbol(moduleSymbol, targetSymbol, node, name) {
51164
+ var _a;
51165
+ var moduleName = getFullyQualifiedName(moduleSymbol, node);
51166
+ var declarationName = ts.declarationNameToString(name);
51167
+ var suggestion = getSuggestedSymbolForNonexistentModule(name, targetSymbol);
51168
+ if (suggestion !== undefined) {
51169
+ var suggestionName = symbolToString(suggestion);
51170
+ var diagnostic = error(name, ts.Diagnostics._0_has_no_exported_member_named_1_Did_you_mean_2, moduleName, declarationName, suggestionName);
51171
+ if (suggestion.valueDeclaration) {
51172
+ ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(suggestion.valueDeclaration, ts.Diagnostics._0_is_declared_here, suggestionName));
51173
+ }
51174
+ }
51175
+ else {
51176
+ if ((_a = moduleSymbol.exports) === null || _a === void 0 ? void 0 : _a.has("default" /* InternalSymbolName.Default */)) {
51177
+ error(name, ts.Diagnostics.Module_0_has_no_exported_member_1_Did_you_mean_to_use_import_1_from_0_instead, moduleName, declarationName);
51178
+ }
51179
+ else {
51180
+ reportNonExportedMember(node, name, declarationName, moduleSymbol, moduleName);
51181
+ }
51182
+ }
51183
+ }
51160
51184
  function reportNonExportedMember(node, name, declarationName, moduleSymbol, moduleName) {
51161
51185
  var _a, _b;
51162
51186
  var localSymbol = (_b = (_a = moduleSymbol.valueDeclaration) === null || _a === void 0 ? void 0 : _a.locals) === null || _b === void 0 ? void 0 : _b.get(name.escapedText);
@@ -51202,6 +51226,13 @@ var ts;
51202
51226
  }
51203
51227
  }
51204
51228
  function getTargetOfImportSpecifier(node, dontResolveAlias) {
51229
+ if (ts.isImportSpecifier(node) && ts.idText(node.propertyName || node.name) === "default" /* InternalSymbolName.Default */) {
51230
+ var specifier = getModuleSpecifierForImportOrExport(node);
51231
+ var moduleSymbol = specifier && resolveExternalModuleName(node, specifier);
51232
+ if (moduleSymbol) {
51233
+ return getTargetofModuleDefault(moduleSymbol, node, dontResolveAlias);
51234
+ }
51235
+ }
51205
51236
  var root = ts.isBindingElement(node) ? ts.getRootDeclaration(node) : node.parent.parent.parent;
51206
51237
  var commonJSPropertyAccess = getCommonJSPropertyAccess(root);
51207
51238
  var resolved = getExternalModuleMember(root, commonJSPropertyAccess || node, dontResolveAlias);
@@ -51223,6 +51254,13 @@ var ts;
51223
51254
  return resolved;
51224
51255
  }
51225
51256
  function getTargetOfExportSpecifier(node, meaning, dontResolveAlias) {
51257
+ if (ts.idText(node.propertyName || node.name) === "default" /* InternalSymbolName.Default */) {
51258
+ var specifier = getModuleSpecifierForImportOrExport(node);
51259
+ var moduleSymbol = specifier && resolveExternalModuleName(node, specifier);
51260
+ if (moduleSymbol) {
51261
+ return getTargetofModuleDefault(moduleSymbol, node, !!dontResolveAlias);
51262
+ }
51263
+ }
51226
51264
  var resolved = node.parent.parent.moduleSpecifier ?
51227
51265
  getExternalModuleMember(node.parent.parent, node, dontResolveAlias) :
51228
51266
  resolveEntityName(node.propertyName || node.name, meaning, /*ignoreErrors*/ false, dontResolveAlias);
@@ -62173,7 +62211,7 @@ var ts;
62173
62211
  return includes & 8388608 /* TypeFlags.IncludesWildcard */ ? wildcardType : anyType;
62174
62212
  }
62175
62213
  if (!strictNullChecks && includes & 98304 /* TypeFlags.Nullable */) {
62176
- return includes & 32768 /* TypeFlags.Undefined */ ? undefinedType : nullType;
62214
+ return includes & 16777216 /* TypeFlags.IncludesEmptyObject */ ? neverType : includes & 32768 /* TypeFlags.Undefined */ ? undefinedType : nullType;
62177
62215
  }
62178
62216
  if (includes & 4 /* TypeFlags.String */ && includes & (128 /* TypeFlags.StringLiteral */ | 134217728 /* TypeFlags.TemplateLiteral */ | 268435456 /* TypeFlags.StringMapping */) ||
62179
62217
  includes & 8 /* TypeFlags.Number */ && includes & 256 /* TypeFlags.NumberLiteral */ ||
@@ -62863,7 +62901,7 @@ var ts;
62863
62901
  // (T | U)[K] -> T[K] | U[K] (reading)
62864
62902
  // (T | U)[K] -> T[K] & U[K] (writing)
62865
62903
  // (T & U)[K] -> T[K] & U[K]
62866
- if (objectType.flags & 3145728 /* TypeFlags.UnionOrIntersection */) {
62904
+ if (objectType.flags & 1048576 /* TypeFlags.Union */ || objectType.flags & 2097152 /* TypeFlags.Intersection */ && !shouldDeferIndexType(objectType)) {
62867
62905
  var types = ts.map(objectType.types, function (t) { return getSimplifiedType(getIndexedAccessType(t, indexType), writing); });
62868
62906
  return objectType.flags & 2097152 /* TypeFlags.Intersection */ || writing ? getIntersectionType(types) : getUnionType(types);
62869
62907
  }
@@ -65271,7 +65309,7 @@ var ts;
65271
65309
  if (reduced !== type) {
65272
65310
  return reduced;
65273
65311
  }
65274
- if (type.flags & 2097152 /* TypeFlags.Intersection */) {
65312
+ if (type.flags & 2097152 /* TypeFlags.Intersection */ && ts.some(type.types, isEmptyAnonymousObjectType)) {
65275
65313
  var normalizedTypes = ts.sameMap(type.types, function (t) { return getNormalizedType(t, writing); });
65276
65314
  if (normalizedTypes !== type.types) {
65277
65315
  return getIntersectionType(normalizedTypes);
@@ -66442,7 +66480,7 @@ var ts;
66442
66480
  // create a new chain for the constraint error
66443
66481
  resetErrorInfo(saveErrorInfo);
66444
66482
  }
66445
- if (result = isRelatedTo(source, constraint, 2 /* RecursionFlags.Target */, reportErrors)) {
66483
+ if (result = isRelatedTo(source, constraint, 2 /* RecursionFlags.Target */, reportErrors, /* headMessage */ undefined, intersectionState)) {
66446
66484
  return result;
66447
66485
  }
66448
66486
  // prefer the shorter chain of the constraint comparison chain, and the direct comparison chain
@@ -66534,8 +66572,8 @@ var ts;
66534
66572
  var skipTrue = !isTypeAssignableTo(getPermissiveInstantiation(c.checkType), getPermissiveInstantiation(c.extendsType));
66535
66573
  var skipFalse = !skipTrue && isTypeAssignableTo(getRestrictiveInstantiation(c.checkType), getRestrictiveInstantiation(c.extendsType));
66536
66574
  // TODO: Find a nice way to include potential conditional type breakdowns in error output, if they seem good (they usually don't)
66537
- if (result = skipTrue ? -1 /* Ternary.True */ : isRelatedTo(source, getTrueTypeFromConditionalType(c), 2 /* RecursionFlags.Target */, /*reportErrors*/ false)) {
66538
- result &= skipFalse ? -1 /* Ternary.True */ : isRelatedTo(source, getFalseTypeFromConditionalType(c), 2 /* RecursionFlags.Target */, /*reportErrors*/ false);
66575
+ if (result = skipTrue ? -1 /* Ternary.True */ : isRelatedTo(source, getTrueTypeFromConditionalType(c), 2 /* RecursionFlags.Target */, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState)) {
66576
+ result &= skipFalse ? -1 /* Ternary.True */ : isRelatedTo(source, getFalseTypeFromConditionalType(c), 2 /* RecursionFlags.Target */, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState);
66539
66577
  if (result) {
66540
66578
  return result;
66541
66579
  }
@@ -71564,7 +71602,7 @@ var ts;
71564
71602
  var narrowedPropType = narrowType(propType);
71565
71603
  return filterType(type, function (t) {
71566
71604
  var discriminantType = getTypeOfPropertyOrIndexSignature(t, propName);
71567
- return !(narrowedPropType.flags & 131072 /* TypeFlags.Never */) && isTypeComparableTo(narrowedPropType, discriminantType);
71605
+ return !(narrowedPropType.flags & 131072 /* TypeFlags.Never */) && areTypesComparable(narrowedPropType, discriminantType);
71568
71606
  });
71569
71607
  }
71570
71608
  function narrowTypeByDiscriminantProperty(type, access, operator, value, assumeTrue) {
@@ -71613,7 +71651,7 @@ var ts;
71613
71651
  }
71614
71652
  function narrowByInKeyword(type, name, assumeTrue) {
71615
71653
  if (type.flags & 1048576 /* TypeFlags.Union */
71616
- || type.flags & 524288 /* TypeFlags.Object */ && declaredType !== type
71654
+ || type.flags & 524288 /* TypeFlags.Object */ && declaredType !== type && !(declaredType === unknownType && isEmptyAnonymousObjectType(type))
71617
71655
  || ts.isThisTypeParameter(type)
71618
71656
  || type.flags & 2097152 /* TypeFlags.Intersection */ && ts.every(type.types, function (t) { return t.symbol !== globalThisSymbol; })) {
71619
71657
  return filterType(type, function (t) { return isTypePresencePossible(t, name, assumeTrue); });
@@ -71746,14 +71784,18 @@ var ts;
71746
71784
  assumeTrue = !assumeTrue;
71747
71785
  }
71748
71786
  var valueType = getTypeOfExpression(value);
71749
- if ((type.flags & 2 /* TypeFlags.Unknown */) && assumeTrue && (operator === 36 /* SyntaxKind.EqualsEqualsEqualsToken */ || operator === 37 /* SyntaxKind.ExclamationEqualsEqualsToken */)) {
71787
+ if (((type.flags & 2 /* TypeFlags.Unknown */) || isEmptyAnonymousObjectType(type) && !(valueType.flags & 98304 /* TypeFlags.Nullable */)) &&
71788
+ assumeTrue &&
71789
+ (operator === 36 /* SyntaxKind.EqualsEqualsEqualsToken */ || operator === 37 /* SyntaxKind.ExclamationEqualsEqualsToken */)) {
71750
71790
  if (valueType.flags & (131068 /* TypeFlags.Primitive */ | 67108864 /* TypeFlags.NonPrimitive */)) {
71751
71791
  return valueType;
71752
71792
  }
71753
71793
  if (valueType.flags & 524288 /* TypeFlags.Object */) {
71754
71794
  return nonPrimitiveType;
71755
71795
  }
71756
- return type;
71796
+ if (type.flags & 2 /* TypeFlags.Unknown */) {
71797
+ return type;
71798
+ }
71757
71799
  }
71758
71800
  if (valueType.flags & 98304 /* TypeFlags.Nullable */) {
71759
71801
  if (!strictNullChecks) {
@@ -72212,7 +72254,9 @@ var ts;
72212
72254
  !!(type.flags & 465829888 /* TypeFlags.Instantiable */ && getBaseConstraintOrType(type).flags & (98304 /* TypeFlags.Nullable */ | 1048576 /* TypeFlags.Union */));
72213
72255
  }
72214
72256
  function isGenericTypeWithoutNullableConstraint(type) {
72215
- return !!(type.flags & 465829888 /* TypeFlags.Instantiable */ && !maybeTypeOfKind(getBaseConstraintOrType(type), 98304 /* TypeFlags.Nullable */));
72257
+ return type.flags & 2097152 /* TypeFlags.Intersection */ ?
72258
+ ts.some(type.types, isGenericTypeWithoutNullableConstraint) :
72259
+ !!(type.flags & 465829888 /* TypeFlags.Instantiable */ && !maybeTypeOfKind(getBaseConstraintOrType(type), 98304 /* TypeFlags.Nullable */));
72216
72260
  }
72217
72261
  function hasContextualTypeWithNoGenericTypes(node, checkMode) {
72218
72262
  // Computing the contextual type for a child of a JSX element involves resolving the type of the
@@ -126909,9 +126953,7 @@ var ts;
126909
126953
  }
126910
126954
  }
126911
126955
  }
126912
- var seenRefs = buildInfoPath ? new ts.Set() : undefined;
126913
126956
  var buildInfoCacheEntry = state.buildInfoCache.get(resolvedPath);
126914
- seenRefs === null || seenRefs === void 0 ? void 0 : seenRefs.add(resolvedPath);
126915
126957
  /** Inputs are up-to-date, just need either timestamp update or bundle prepend manipulation to make it look up-to-date */
126916
126958
  var pseudoUpToDate = false;
126917
126959
  var usesPrepend = false;
@@ -126926,7 +126968,7 @@ var ts;
126926
126968
  continue;
126927
126969
  }
126928
126970
  // Check if tsbuildinfo path is shared, then we need to rebuild
126929
- if (buildInfoCacheEntry && hasSameBuildInfo(state, buildInfoCacheEntry, seenRefs, resolvedConfig, resolvedRefPath)) {
126971
+ if (buildInfoCacheEntry && hasSameBuildInfo(state, buildInfoCacheEntry, resolvedRefPath)) {
126930
126972
  return {
126931
126973
  type: ts.UpToDateStatusType.OutOfDateWithUpstream,
126932
126974
  outOfDateOutputFileName: buildInfoPath,
@@ -126984,25 +127026,9 @@ var ts;
126984
127026
  oldestOutputFileName: oldestOutputFileName
126985
127027
  };
126986
127028
  }
126987
- function hasSameBuildInfo(state, buildInfoCacheEntry, seenRefs, resolvedConfig, resolvedRefPath) {
126988
- if (seenRefs.has(resolvedRefPath))
126989
- return false;
126990
- seenRefs.add(resolvedRefPath);
127029
+ function hasSameBuildInfo(state, buildInfoCacheEntry, resolvedRefPath) {
126991
127030
  var refBuildInfo = state.buildInfoCache.get(resolvedRefPath);
126992
- if (refBuildInfo.path === buildInfoCacheEntry.path)
126993
- return true;
126994
- if (resolvedConfig.projectReferences) {
126995
- // Check references
126996
- for (var _i = 0, _a = resolvedConfig.projectReferences; _i < _a.length; _i++) {
126997
- var ref = _a[_i];
126998
- var resolvedRef = ts.resolveProjectReferencePath(ref);
126999
- var resolvedRefPath_1 = toResolvedConfigFilePath(state, resolvedRef);
127000
- var resolvedConfig_1 = parseConfigFile(state, resolvedRef, resolvedRefPath_1);
127001
- if (hasSameBuildInfo(state, buildInfoCacheEntry, seenRefs, resolvedConfig_1, resolvedRefPath_1))
127002
- return true;
127003
- }
127004
- }
127005
- return false;
127031
+ return refBuildInfo.path === buildInfoCacheEntry.path;
127006
127032
  }
127007
127033
  function getUpToDateStatus(state, project, resolvedPath) {
127008
127034
  if (project === undefined) {
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "typescript",
3
3
  "author": "Microsoft Corp.",
4
4
  "homepage": "https://www.typescriptlang.org/",
5
- "version": "4.8.2",
5
+ "version": "4.8.3",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [