@typescript-deploys/pr-build 4.8.0-pr-48784-14 → 4.8.0-pr-48784-17

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 = ts.versionMajorMinor + ".0-insiders.20220527";
92
+ ts.version = ts.versionMajorMinor + ".0-insiders.20220601";
93
93
  /* @internal */
94
94
  var Comparison;
95
95
  (function (Comparison) {
@@ -5093,6 +5093,11 @@ var ts;
5093
5093
  // Flags that require TypeFlags.Union
5094
5094
  /* @internal */
5095
5095
  ObjectFlags[ObjectFlags["ContainsIntersections"] = 16777216] = "ContainsIntersections";
5096
+ /* @internal */
5097
+ ObjectFlags[ObjectFlags["IsUnknownLikeUnionComputed"] = 33554432] = "IsUnknownLikeUnionComputed";
5098
+ /* @internal */
5099
+ ObjectFlags[ObjectFlags["IsUnknownLikeUnion"] = 67108864] = "IsUnknownLikeUnion";
5100
+ /* @internal */
5096
5101
  // Flags that require TypeFlags.Intersection
5097
5102
  /* @internal */
5098
5103
  ObjectFlags[ObjectFlags["IsNeverIntersectionComputed"] = 16777216] = "IsNeverIntersectionComputed";
@@ -8417,6 +8422,7 @@ var ts;
8417
8422
  Construct_signatures_with_no_arguments_have_incompatible_return_types_0_and_1: diag(2205, ts.DiagnosticCategory.Error, "Construct_signatures_with_no_arguments_have_incompatible_return_types_0_and_1_2205", "Construct signatures with no arguments have incompatible return types '{0}' and '{1}'.", /*reportsUnnecessary*/ undefined, /*elidedInCompatabilityPyramid*/ true),
8418
8423
  The_type_modifier_cannot_be_used_on_a_named_import_when_import_type_is_used_on_its_import_statement: diag(2206, ts.DiagnosticCategory.Error, "The_type_modifier_cannot_be_used_on_a_named_import_when_import_type_is_used_on_its_import_statement_2206", "The 'type' modifier cannot be used on a named import when 'import type' is used on its import statement."),
8419
8424
  The_type_modifier_cannot_be_used_on_a_named_export_when_export_type_is_used_on_its_export_statement: diag(2207, ts.DiagnosticCategory.Error, "The_type_modifier_cannot_be_used_on_a_named_export_when_export_type_is_used_on_its_export_statement_2207", "The 'type' modifier cannot be used on a named export when 'export type' is used on its export statement."),
8425
+ This_type_parameter_probably_needs_an_extends_object_constraint: diag(2208, ts.DiagnosticCategory.Error, "This_type_parameter_probably_needs_an_extends_object_constraint_2208", "This type parameter probably needs an `extends object` constraint."),
8420
8426
  The_project_root_is_ambiguous_but_is_required_to_resolve_export_map_entry_0_in_file_1_Supply_the_rootDir_compiler_option_to_disambiguate: diag(2209, ts.DiagnosticCategory.Error, "The_project_root_is_ambiguous_but_is_required_to_resolve_export_map_entry_0_in_file_1_Supply_the_roo_2209", "The project root is ambiguous, but is required to resolve export map entry '{0}' in file '{1}'. Supply the `rootDir` compiler option to disambiguate."),
8421
8427
  The_project_root_is_ambiguous_but_is_required_to_resolve_import_map_entry_0_in_file_1_Supply_the_rootDir_compiler_option_to_disambiguate: diag(2210, ts.DiagnosticCategory.Error, "The_project_root_is_ambiguous_but_is_required_to_resolve_import_map_entry_0_in_file_1_Supply_the_roo_2210", "The project root is ambiguous, but is required to resolve import map entry '{0}' in file '{1}'. Supply the `rootDir` compiler option to disambiguate."),
8422
8428
  Duplicate_identifier_0: diag(2300, ts.DiagnosticCategory.Error, "Duplicate_identifier_0_2300", "Duplicate identifier '{0}'."),
@@ -8902,6 +8908,7 @@ var ts;
8902
8908
  Import_assertion_values_must_be_string_literal_expressions: diag(2837, ts.DiagnosticCategory.Error, "Import_assertion_values_must_be_string_literal_expressions_2837", "Import assertion values must be string literal expressions."),
8903
8909
  All_declarations_of_0_must_have_identical_constraints: diag(2838, ts.DiagnosticCategory.Error, "All_declarations_of_0_must_have_identical_constraints_2838", "All declarations of '{0}' must have identical constraints."),
8904
8910
  This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value: diag(2839, ts.DiagnosticCategory.Error, "This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value_2839", "This condition will always return '{0}' since JavaScript compares objects by reference, not value."),
8911
+ An_interface_cannot_extend_a_primitive_type_like_0_an_interface_can_only_extend_named_types_and_classes: diag(2840, ts.DiagnosticCategory.Error, "An_interface_cannot_extend_a_primitive_type_like_0_an_interface_can_only_extend_named_types_and_clas_2840", "An interface cannot extend a primitive type like '{0}'; an interface can only extend named types and classes"),
8905
8912
  Import_declaration_0_is_using_private_name_1: diag(4000, ts.DiagnosticCategory.Error, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."),
8906
8913
  Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", "Type parameter '{0}' of exported class has or is using private name '{1}'."),
8907
8914
  Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", "Type parameter '{0}' of exported interface has or is using private name '{1}'."),
@@ -44265,8 +44272,8 @@ var ts;
44265
44272
  var pathAndExtension = loadModuleFromFile(extensions, candidate, onlyRecordFailures, state) ||
44266
44273
  loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageInfo && packageInfo.packageJsonContent, packageInfo && packageInfo.versionPaths);
44267
44274
  if (!pathAndExtension && packageInfo
44268
- && packageInfo.packageJsonContent.exports === undefined
44269
- && packageInfo.packageJsonContent.main === undefined
44275
+ // eslint-disable-next-line no-null/no-null
44276
+ && (packageInfo.packageJsonContent.exports === undefined || packageInfo.packageJsonContent.exports === null)
44270
44277
  && state.features & NodeResolutionFeatures.EsmMode) {
44271
44278
  // EsmMode disables index lookup in `loadNodeModuleFromDirectoryWorker` generally, however non-relative package resolutions still assume
44272
44279
  // a default `index.js` entrypoint if no `main` or `exports` are present
@@ -47931,7 +47938,10 @@ var ts;
47931
47938
  TypeFacts[TypeFacts["NEUndefinedOrNull"] = 2097152] = "NEUndefinedOrNull";
47932
47939
  TypeFacts[TypeFacts["Truthy"] = 4194304] = "Truthy";
47933
47940
  TypeFacts[TypeFacts["Falsy"] = 8388608] = "Falsy";
47934
- TypeFacts[TypeFacts["All"] = 16777215] = "All";
47941
+ TypeFacts[TypeFacts["IsUndefined"] = 16777216] = "IsUndefined";
47942
+ TypeFacts[TypeFacts["IsNull"] = 33554432] = "IsNull";
47943
+ TypeFacts[TypeFacts["IsUndefinedOrNull"] = 50331648] = "IsUndefinedOrNull";
47944
+ TypeFacts[TypeFacts["All"] = 134217727] = "All";
47935
47945
  // The following members encode facts about particular kinds of types for use in the getTypeFacts function.
47936
47946
  // The presence of a particular fact means that the given test is true for some (and possibly all) values
47937
47947
  // of that kind of type.
@@ -47973,14 +47983,16 @@ var ts;
47973
47983
  TypeFacts[TypeFacts["ObjectFacts"] = 16736160] = "ObjectFacts";
47974
47984
  TypeFacts[TypeFacts["FunctionStrictFacts"] = 7880640] = "FunctionStrictFacts";
47975
47985
  TypeFacts[TypeFacts["FunctionFacts"] = 16728000] = "FunctionFacts";
47976
- TypeFacts[TypeFacts["UndefinedFacts"] = 9830144] = "UndefinedFacts";
47977
- TypeFacts[TypeFacts["NullFacts"] = 9363232] = "NullFacts";
47978
- TypeFacts[TypeFacts["EmptyObjectStrictFacts"] = 16318463] = "EmptyObjectStrictFacts";
47986
+ TypeFacts[TypeFacts["VoidFacts"] = 9830144] = "VoidFacts";
47987
+ TypeFacts[TypeFacts["UndefinedFacts"] = 26607360] = "UndefinedFacts";
47988
+ TypeFacts[TypeFacts["NullFacts"] = 42917664] = "NullFacts";
47989
+ TypeFacts[TypeFacts["EmptyObjectStrictFacts"] = 83427327] = "EmptyObjectStrictFacts";
47990
+ TypeFacts[TypeFacts["EmptyObjectFacts"] = 83886079] = "EmptyObjectFacts";
47991
+ TypeFacts[TypeFacts["UnknownFacts"] = 83886079] = "UnknownFacts";
47979
47992
  TypeFacts[TypeFacts["AllTypeofNE"] = 556800] = "AllTypeofNE";
47980
- TypeFacts[TypeFacts["EmptyObjectFacts"] = 16777215] = "EmptyObjectFacts";
47981
47993
  // Masks
47982
47994
  TypeFacts[TypeFacts["OrFactsMask"] = 8256] = "OrFactsMask";
47983
- TypeFacts[TypeFacts["AndFactsMask"] = 16768959] = "AndFactsMask";
47995
+ TypeFacts[TypeFacts["AndFactsMask"] = 134209471] = "AndFactsMask";
47984
47996
  })(TypeFacts || (TypeFacts = {}));
47985
47997
  var typeofEQFacts = new ts.Map(ts.getEntries({
47986
47998
  string: 1 /* TypeofEQString */,
@@ -48644,6 +48656,7 @@ var ts;
48644
48656
  var emptyTypeLiteralSymbol = createSymbol(2048 /* TypeLiteral */, "__type" /* Type */);
48645
48657
  emptyTypeLiteralSymbol.members = ts.createSymbolTable();
48646
48658
  var emptyTypeLiteralType = createAnonymousType(emptyTypeLiteralSymbol, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
48659
+ var unknownUnionType = strictNullChecks ? getUnionType([undefinedType, nullType, createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray)]) : unknownType;
48647
48660
  var emptyGenericType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
48648
48661
  emptyGenericType.instantiations = new ts.Map();
48649
48662
  var anyFunctionType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
@@ -50143,7 +50156,12 @@ var ts;
50143
50156
  function checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning) {
50144
50157
  if (meaning & (111551 /* Value */ & ~1024 /* NamespaceModule */)) {
50145
50158
  if (isPrimitiveTypeName(name)) {
50146
- error(errorLocation, ts.Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here, ts.unescapeLeadingUnderscores(name));
50159
+ if (isExtendedByInterface(errorLocation)) {
50160
+ error(errorLocation, ts.Diagnostics.An_interface_cannot_extend_a_primitive_type_like_0_an_interface_can_only_extend_named_types_and_classes, ts.unescapeLeadingUnderscores(name));
50161
+ }
50162
+ else {
50163
+ error(errorLocation, ts.Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here, ts.unescapeLeadingUnderscores(name));
50164
+ }
50147
50165
  return true;
50148
50166
  }
50149
50167
  var symbol = resolveSymbol(resolveName(errorLocation, name, 788968 /* Type */ & ~111551 /* Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false));
@@ -50163,6 +50181,16 @@ var ts;
50163
50181
  }
50164
50182
  return false;
50165
50183
  }
50184
+ function isExtendedByInterface(node) {
50185
+ var grandparent = node.parent.parent;
50186
+ var parentOfGrandparent = grandparent.parent;
50187
+ if (grandparent && parentOfGrandparent) {
50188
+ var isExtending = ts.isHeritageClause(grandparent) && grandparent.token === 94 /* ExtendsKeyword */;
50189
+ var isInterface = ts.isInterfaceDeclaration(parentOfGrandparent);
50190
+ return isExtending && isInterface;
50191
+ }
50192
+ return false;
50193
+ }
50166
50194
  function maybeMappedType(node, symbol) {
50167
50195
  var container = ts.findAncestor(node.parent, function (n) {
50168
50196
  return ts.isComputedPropertyName(n) || ts.isPropertySignature(n) ? false : ts.isTypeLiteralNode(n) || "quit";
@@ -53003,7 +53031,7 @@ var ts;
53003
53031
  anyType : getNonMissingTypeOfSymbol(propertySymbol);
53004
53032
  var saveEnclosingDeclaration = context.enclosingDeclaration;
53005
53033
  context.enclosingDeclaration = undefined;
53006
- if (context.tracker.trackSymbol && ts.getCheckFlags(propertySymbol) & 4096 /* Late */ && isLateBoundName(propertySymbol.escapedName)) {
53034
+ if (context.tracker.trackSymbol && isLateBoundName(propertySymbol.escapedName)) {
53007
53035
  if (propertySymbol.declarations) {
53008
53036
  var decl = ts.first(propertySymbol.declarations);
53009
53037
  if (hasLateBindableName(decl)) {
@@ -54687,7 +54715,7 @@ var ts;
54687
54715
  ? getBaseConstructorTypeOfClass(staticType)
54688
54716
  : anyType;
54689
54717
  var heritageClauses = __spreadArray(__spreadArray([], !ts.length(baseTypes) ? [] : [ts.factory.createHeritageClause(94 /* ExtendsKeyword */, ts.map(baseTypes, function (b) { return serializeBaseType(b, staticBaseType, localName); }))], true), !ts.length(implementsExpressions) ? [] : [ts.factory.createHeritageClause(117 /* ImplementsKeyword */, implementsExpressions)], true);
54690
- var symbolProps = getNonInterhitedProperties(classType, baseTypes, getPropertiesOfType(classType));
54718
+ var symbolProps = getNonInheritedProperties(classType, baseTypes, getPropertiesOfType(classType));
54691
54719
  var publicSymbolProps = ts.filter(symbolProps, function (s) {
54692
54720
  // `valueDeclaration` could be undefined if inherited from
54693
54721
  // a union/intersection base type, but inherited properties
@@ -55825,7 +55853,7 @@ var ts;
55825
55853
  if (ts.getEffectiveTypeAnnotationNode(ts.walkUpBindingElementsAndPatterns(declaration))) {
55826
55854
  // In strict null checking mode, if a default value of a non-undefined type is specified, remove
55827
55855
  // undefined from the final type.
55828
- return strictNullChecks && !(getFalsyFlags(checkDeclarationInitializer(declaration, 0 /* Normal */)) & 32768 /* Undefined */) ? getNonUndefinedType(type) : type;
55856
+ return strictNullChecks && !(getTypeFacts(checkDeclarationInitializer(declaration, 0 /* Normal */)) & 16777216 /* IsUndefined */) ? getNonUndefinedType(type) : type;
55829
55857
  }
55830
55858
  return widenTypeInferredFromInitializer(declaration, getUnionType([getNonUndefinedType(type), checkDeclarationInitializer(declaration, 0 /* Normal */)], 2 /* Subtype */));
55831
55859
  }
@@ -58814,7 +58842,7 @@ var ts;
58814
58842
  }
58815
58843
  }
58816
58844
  }
58817
- else if (t.flags & 469892092 /* DisjointDomains */) {
58845
+ else if (t.flags & 469892092 /* DisjointDomains */ || isEmptyAnonymousObjectType(t)) {
58818
58846
  hasDisjointDomainType = true;
58819
58847
  }
58820
58848
  }
@@ -58826,7 +58854,7 @@ var ts;
58826
58854
  // intersection operation to reduce the union constraints.
58827
58855
  for (var _a = 0, types_6 = types; _a < types_6.length; _a++) {
58828
58856
  var t = types_6[_a];
58829
- if (t.flags & 469892092 /* DisjointDomains */) {
58857
+ if (t.flags & 469892092 /* DisjointDomains */ || isEmptyAnonymousObjectType(t)) {
58830
58858
  constraints = ts.append(constraints, t);
58831
58859
  }
58832
58860
  }
@@ -59028,7 +59056,7 @@ var ts;
59028
59056
  var objectType;
59029
59057
  return !!(type.flags & 8388608 /* IndexedAccess */ && ts.getObjectFlags(objectType = type.objectType) & 32 /* Mapped */ &&
59030
59058
  !isGenericMappedType(objectType) && isGenericIndexType(type.indexType) &&
59031
- !objectType.declaration.questionToken && !objectType.declaration.nameType);
59059
+ !(getMappedTypeModifiers(objectType) & 8 /* ExcludeOptional */) && !objectType.declaration.nameType);
59032
59060
  }
59033
59061
  /**
59034
59062
  * For a type parameter, return the base constraint of the type parameter. For the string, number,
@@ -61375,7 +61403,7 @@ var ts;
61375
61403
  }
61376
61404
  return includes;
61377
61405
  }
61378
- function removeRedundantPrimitiveTypes(types, includes) {
61406
+ function removeRedundantSupertypes(types, includes) {
61379
61407
  var i = types.length;
61380
61408
  while (i > 0) {
61381
61409
  i--;
@@ -61383,7 +61411,9 @@ var ts;
61383
61411
  var remove = t.flags & 4 /* String */ && includes & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) ||
61384
61412
  t.flags & 8 /* Number */ && includes & 256 /* NumberLiteral */ ||
61385
61413
  t.flags & 64 /* BigInt */ && includes & 2048 /* BigIntLiteral */ ||
61386
- t.flags & 4096 /* ESSymbol */ && includes & 8192 /* UniqueESSymbol */;
61414
+ t.flags & 4096 /* ESSymbol */ && includes & 8192 /* UniqueESSymbol */ ||
61415
+ t.flags & 16384 /* Void */ && includes & 32768 /* Undefined */ ||
61416
+ isEmptyAnonymousObjectType(t) && includes & 470302716 /* DefinitelyNonNullable */;
61387
61417
  if (remove) {
61388
61418
  ts.orderedRemoveItemAt(types, i);
61389
61419
  }
@@ -61505,7 +61535,7 @@ var ts;
61505
61535
  // a type alias of the form "type List<T> = T & { next: List<T> }" cannot be reduced during its declaration.
61506
61536
  // Also, unlike union types, the order of the constituent types is preserved in order that overload resolution
61507
61537
  // for intersections of types with signatures can be deterministic.
61508
- function getIntersectionType(types, aliasSymbol, aliasTypeArguments) {
61538
+ function getIntersectionType(types, aliasSymbol, aliasTypeArguments, noSupertypeReduction) {
61509
61539
  var typeMembershipMap = new ts.Map();
61510
61540
  var includes = addTypesToIntersection(typeMembershipMap, 0, types);
61511
61541
  var typeSet = ts.arrayFrom(typeMembershipMap.values());
@@ -61542,11 +61572,11 @@ var ts;
61542
61572
  if (includes & 4 /* String */ && includes & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) ||
61543
61573
  includes & 8 /* Number */ && includes & 256 /* NumberLiteral */ ||
61544
61574
  includes & 64 /* BigInt */ && includes & 2048 /* BigIntLiteral */ ||
61545
- includes & 4096 /* ESSymbol */ && includes & 8192 /* UniqueESSymbol */) {
61546
- removeRedundantPrimitiveTypes(typeSet, includes);
61547
- }
61548
- if (includes & 16777216 /* IncludesEmptyObject */ && includes & 524288 /* Object */) {
61549
- ts.orderedRemoveItemAt(typeSet, ts.findIndex(typeSet, isEmptyAnonymousObjectType));
61575
+ includes & 4096 /* ESSymbol */ && includes & 8192 /* UniqueESSymbol */ ||
61576
+ includes & 16384 /* Void */ && includes & 32768 /* Undefined */ ||
61577
+ includes & 16777216 /* IncludesEmptyObject */ && includes & 470302716 /* DefinitelyNonNullable */) {
61578
+ if (!noSupertypeReduction)
61579
+ removeRedundantSupertypes(typeSet, includes);
61550
61580
  }
61551
61581
  if (includes & 262144 /* IncludesMissingType */) {
61552
61582
  typeSet[typeSet.indexOf(undefinedType)] = missingType;
@@ -61585,8 +61615,9 @@ var ts;
61585
61615
  }
61586
61616
  var constituents = getCrossProductIntersections(typeSet);
61587
61617
  // We attach a denormalized origin type when at least one constituent of the cross-product union is an
61588
- // intersection (i.e. when the intersection didn't just reduce one or more unions to smaller unions).
61589
- var origin = ts.some(constituents, function (t) { return !!(t.flags & 2097152 /* Intersection */); }) ? createOriginUnionOrIntersectionType(2097152 /* Intersection */, typeSet) : undefined;
61618
+ // intersection (i.e. when the intersection didn't just reduce one or more unions to smaller unions) and
61619
+ // the denormalized origin has fewer constituents than the union itself.
61620
+ var origin = ts.some(constituents, function (t) { return !!(t.flags & 2097152 /* Intersection */); }) && getConstituentCountOfTypes(constituents) > getConstituentCountOfTypes(typeSet) ? createOriginUnionOrIntersectionType(2097152 /* Intersection */, typeSet) : undefined;
61590
61621
  result = getUnionType(constituents, 1 /* Literal */, aliasSymbol, aliasTypeArguments, origin);
61591
61622
  }
61592
61623
  }
@@ -61629,11 +61660,21 @@ var ts;
61629
61660
  }
61630
61661
  return intersections;
61631
61662
  }
61663
+ function getConstituentCount(type) {
61664
+ return !(type.flags & 3145728 /* UnionOrIntersection */) || type.aliasSymbol ? 1 :
61665
+ type.flags & 1048576 /* Union */ && type.origin ? getConstituentCount(type.origin) :
61666
+ getConstituentCountOfTypes(type.types);
61667
+ }
61668
+ function getConstituentCountOfTypes(types) {
61669
+ return ts.reduceLeft(types, function (n, t) { return n + getConstituentCount(t); }, 0);
61670
+ }
61632
61671
  function getTypeFromIntersectionTypeNode(node) {
61633
61672
  var links = getNodeLinks(node);
61634
61673
  if (!links.resolvedType) {
61635
61674
  var aliasSymbol = getAliasSymbolForTypeNode(node);
61636
- links.resolvedType = getIntersectionType(ts.map(node.types, getTypeFromTypeNode), aliasSymbol, getTypeArgumentsForAliasSymbol(aliasSymbol));
61675
+ var types = ts.map(node.types, getTypeFromTypeNode);
61676
+ var noSupertypeReduction = types.length === 2 && !!(types[0].flags & (4 /* String */ | 8 /* Number */ | 64 /* BigInt */)) && types[1] === emptyTypeLiteralType;
61677
+ links.resolvedType = getIntersectionType(types, aliasSymbol, getTypeArgumentsForAliasSymbol(aliasSymbol), noSupertypeReduction);
61637
61678
  }
61638
61679
  return links.resolvedType;
61639
61680
  }
@@ -64307,7 +64348,7 @@ var ts;
64307
64348
  var sourceSig = checkMode & 3 /* Callback */ ? undefined : getSingleCallSignature(getNonNullableType(sourceType));
64308
64349
  var targetSig = checkMode & 3 /* Callback */ ? undefined : getSingleCallSignature(getNonNullableType(targetType));
64309
64350
  var callbacks = sourceSig && targetSig && !getTypePredicateOfSignature(sourceSig) && !getTypePredicateOfSignature(targetSig) &&
64310
- (getFalsyFlags(sourceType) & 98304 /* Nullable */) === (getFalsyFlags(targetType) & 98304 /* Nullable */);
64351
+ (getTypeFacts(sourceType) & 50331648 /* IsUndefinedOrNull */) === (getTypeFacts(targetType) & 50331648 /* IsUndefinedOrNull */);
64311
64352
  var related = callbacks ?
64312
64353
  compareSignaturesRelated(targetSig, sourceSig, (checkMode & 8 /* StrictArity */) | (strictVariance ? 2 /* StrictCallback */ : 1 /* BivariantCallback */), reportErrors, errorReporter, incompatibleErrorReporter, compareTypes, reportUnreliableMarkers) :
64313
64354
  !(checkMode & 3 /* Callback */) && !strictVariance && compareTypes(sourceType, targetType, /*reportErrors*/ false) || compareTypes(targetType, sourceType, reportErrors);
@@ -64419,6 +64460,17 @@ var ts;
64419
64460
  return !!(ts.getObjectFlags(type) & 16 /* Anonymous */ && (type.members && isEmptyResolvedType(type) ||
64420
64461
  type.symbol && type.symbol.flags & 2048 /* TypeLiteral */ && getMembersOfSymbol(type.symbol).size === 0));
64421
64462
  }
64463
+ function isUnknownLikeUnionType(type) {
64464
+ if (strictNullChecks && type.flags & 1048576 /* Union */) {
64465
+ if (!(type.objectFlags & 33554432 /* IsUnknownLikeUnionComputed */)) {
64466
+ var types = type.types;
64467
+ type.objectFlags |= 33554432 /* IsUnknownLikeUnionComputed */ | (types.length >= 3 && types[0].flags & 32768 /* Undefined */ &&
64468
+ types[1].flags & 65536 /* Null */ && ts.some(types, isEmptyAnonymousObjectType) ? 67108864 /* IsUnknownLikeUnion */ : 0);
64469
+ }
64470
+ return !!(type.objectFlags & 67108864 /* IsUnknownLikeUnion */);
64471
+ }
64472
+ return false;
64473
+ }
64422
64474
  function isStringIndexSignatureOnlyType(type) {
64423
64475
  return type.flags & 524288 /* Object */ && !isGenericMappedType(type) && getPropertiesOfType(type).length === 0 && getIndexInfosOfType(type).length === 1 && !!getIndexInfoOfType(type, stringType) ||
64424
64476
  type.flags & 3145728 /* UnionOrIntersection */ && ts.every(type.types, isStringIndexSignatureOnlyType) ||
@@ -64498,7 +64550,7 @@ var ts;
64498
64550
  return true;
64499
64551
  if (s & 65536 /* Null */ && (!strictNullChecks && !(t & 3145728 /* UnionOrIntersection */) || t & 65536 /* Null */))
64500
64552
  return true;
64501
- if (s & 524288 /* Object */ && t & 67108864 /* NonPrimitive */)
64553
+ if (s & 524288 /* Object */ && t & 67108864 /* NonPrimitive */ && !(relation === strictSubtypeRelation && isEmptyAnonymousObjectType(source)))
64502
64554
  return true;
64503
64555
  if (relation === assignableRelation || relation === comparableRelation) {
64504
64556
  if (s & 1 /* Any */)
@@ -64508,6 +64560,9 @@ var ts;
64508
64560
  // bit-flag enum types sometimes look like literal enum types with numeric literal values.
64509
64561
  if (s & (8 /* Number */ | 256 /* NumberLiteral */) && !(s & 1024 /* EnumLiteral */) && (t & 32 /* Enum */ || relation === assignableRelation && t & 256 /* NumberLiteral */ && t & 1024 /* EnumLiteral */))
64510
64562
  return true;
64563
+ // Anything is assignable to a union containing undefined, null, and {}
64564
+ if (isUnknownLikeUnionType(target))
64565
+ return true;
64511
64566
  }
64512
64567
  return false;
64513
64568
  }
@@ -64550,16 +64605,27 @@ var ts;
64550
64605
  function getNormalizedType(type, writing) {
64551
64606
  while (true) {
64552
64607
  var t = isFreshLiteralType(type) ? type.regularType :
64553
- ts.getObjectFlags(type) & 4 /* Reference */ && type.node ? createTypeReference(type.target, getTypeArguments(type)) :
64554
- type.flags & 3145728 /* UnionOrIntersection */ ? getReducedType(type) :
64608
+ ts.getObjectFlags(type) & 4 /* Reference */ ? type.node ? createTypeReference(type.target, getTypeArguments(type)) : getSingleBaseForNonAugmentingSubtype(type) || type :
64609
+ type.flags & 3145728 /* UnionOrIntersection */ ? getNormalizedUnionOrIntersectionType(type, writing) :
64555
64610
  type.flags & 33554432 /* Substitution */ ? writing ? type.baseType : type.substitute :
64556
64611
  type.flags & 25165824 /* Simplifiable */ ? getSimplifiedType(type, writing) :
64557
64612
  type;
64558
- t = getSingleBaseForNonAugmentingSubtype(t) || t;
64559
64613
  if (t === type)
64560
- break;
64614
+ return t;
64561
64615
  type = t;
64562
64616
  }
64617
+ }
64618
+ function getNormalizedUnionOrIntersectionType(type, writing) {
64619
+ var reduced = getReducedType(type);
64620
+ if (reduced !== type) {
64621
+ return reduced;
64622
+ }
64623
+ if (type.flags & 2097152 /* Intersection */) {
64624
+ var normalizedTypes = ts.sameMap(type.types, function (t) { return getNormalizedType(t, writing); });
64625
+ if (normalizedTypes !== type.types) {
64626
+ return getIntersectionType(normalizedTypes);
64627
+ }
64628
+ }
64563
64629
  return type;
64564
64630
  }
64565
64631
  /**
@@ -65006,6 +65072,7 @@ var ts;
65006
65072
  return 0 /* False */;
65007
65073
  }
65008
65074
  function reportErrorResults(originalSource, originalTarget, source, target, headMessage) {
65075
+ var _a, _b;
65009
65076
  var sourceHasBase = !!getSingleBaseForNonAugmentingSubtype(originalSource);
65010
65077
  var targetHasBase = !!getSingleBaseForNonAugmentingSubtype(originalTarget);
65011
65078
  source = (originalSource.aliasSymbol || sourceHasBase) ? originalSource : source;
@@ -65046,6 +65113,9 @@ var ts;
65046
65113
  return;
65047
65114
  }
65048
65115
  reportRelationError(headMessage, source, target);
65116
+ if (strictNullChecks && source.flags & 8650752 /* TypeVariable */ && ((_b = (_a = source.symbol) === null || _a === void 0 ? void 0 : _a.declarations) === null || _b === void 0 ? void 0 : _b[0]) && !getConstraintOfType(source) && isRelatedTo(emptyObjectType, extractTypesOfKind(target, ~67108864 /* NonPrimitive */))) {
65117
+ associateRelatedInfo(ts.createDiagnosticForNode(source.symbol.declarations[0], ts.Diagnostics.This_type_parameter_probably_needs_an_extends_object_constraint));
65118
+ }
65049
65119
  }
65050
65120
  function traceUnionsOrIntersectionsTooLarge(source, target) {
65051
65121
  if (!ts.tracing) {
@@ -65832,13 +65902,6 @@ var ts;
65832
65902
  // IndexedAccess comparisons are handled above in the `targetFlags & TypeFlage.IndexedAccess` branch
65833
65903
  if (!(sourceFlags & 8388608 /* IndexedAccess */ && targetFlags & 8388608 /* IndexedAccess */)) {
65834
65904
  var constraint = getConstraintOfType(source) || unknownType;
65835
- if (!getConstraintOfType(source) || (sourceFlags & 262144 /* TypeParameter */ && constraint.flags & 1 /* Any */)) {
65836
- // A type variable with no constraint is not related to the non-primitive object type.
65837
- if (result = isRelatedTo(emptyObjectType, extractTypesOfKind(target, ~67108864 /* NonPrimitive */), 3 /* Both */)) {
65838
- resetErrorInfo(saveErrorInfo);
65839
- return result;
65840
- }
65841
- }
65842
65905
  // hi-speed no-this-instantiation check (less accurate, but avoids costly `this`-instantiation when the constraint will suffice), see #28231 for report on why this is needed
65843
65906
  if (result = isRelatedTo(constraint, target, 1 /* Source */, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState)) {
65844
65907
  resetErrorInfo(saveErrorInfo);
@@ -67312,9 +67375,11 @@ var ts;
67312
67375
  return getSupertypeOrUnion(types);
67313
67376
  }
67314
67377
  var primaryTypes = ts.filter(types, function (t) { return !(t.flags & 98304 /* Nullable */); });
67315
- return primaryTypes.length ?
67316
- getNullableType(getSupertypeOrUnion(primaryTypes), getFalsyFlagsOfTypes(types) & 98304 /* Nullable */) :
67317
- getUnionType(types, 2 /* Subtype */);
67378
+ if (primaryTypes.length) {
67379
+ var supertypeOrUnion = getSupertypeOrUnion(primaryTypes);
67380
+ return primaryTypes === types ? supertypeOrUnion : getUnionType(__spreadArray([supertypeOrUnion], ts.filter(types, function (t) { return !!(t.flags & 98304 /* Nullable */); }), true));
67381
+ }
67382
+ return getUnionType(types, 2 /* Subtype */);
67318
67383
  }
67319
67384
  // Return the leftmost type for which no type to the right is a subtype.
67320
67385
  function getCommonSubtype(types) {
@@ -67501,29 +67566,8 @@ var ts;
67501
67566
  var value = _a.value;
67502
67567
  return value.base10Value === "0";
67503
67568
  }
67504
- function getFalsyFlagsOfTypes(types) {
67505
- var result = 0;
67506
- for (var _i = 0, types_14 = types; _i < types_14.length; _i++) {
67507
- var t = types_14[_i];
67508
- result |= getFalsyFlags(t);
67509
- }
67510
- return result;
67511
- }
67512
- // Returns the String, Number, Boolean, StringLiteral, NumberLiteral, BooleanLiteral, Void, Undefined, or Null
67513
- // flags for the string, number, boolean, "", 0, false, void, undefined, or null types respectively. Returns
67514
- // no flags for all other types (including non-falsy literal types).
67515
- function getFalsyFlags(type) {
67516
- return type.flags & 1048576 /* Union */ ? getFalsyFlagsOfTypes(type.types) :
67517
- type.flags & 128 /* StringLiteral */ ? type.value === "" ? 128 /* StringLiteral */ : 0 :
67518
- type.flags & 256 /* NumberLiteral */ ? type.value === 0 ? 256 /* NumberLiteral */ : 0 :
67519
- type.flags & 2048 /* BigIntLiteral */ ? isZeroBigInt(type) ? 2048 /* BigIntLiteral */ : 0 :
67520
- type.flags & 512 /* BooleanLiteral */ ? (type === falseType || type === regularFalseType) ? 512 /* BooleanLiteral */ : 0 :
67521
- type.flags & 117724 /* PossiblyFalsy */;
67522
- }
67523
67569
  function removeDefinitelyFalsyTypes(type) {
67524
- return getFalsyFlags(type) & 117632 /* DefinitelyFalsy */ ?
67525
- filterType(type, function (t) { return !(getFalsyFlags(t) & 117632 /* DefinitelyFalsy */); }) :
67526
- type;
67570
+ return filterType(type, function (t) { return !!(getTypeFacts(t) & 4194304 /* Truthy */); });
67527
67571
  }
67528
67572
  function extractDefinitelyFalsyTypes(type) {
67529
67573
  return mapType(type, getDefinitelyFalsyPartOfType);
@@ -67558,20 +67602,15 @@ var ts;
67558
67602
  return type.flags & 32768 /* Undefined */ ? type : getUnionType([type, isProperty ? missingType : undefinedType]);
67559
67603
  }
67560
67604
  function getGlobalNonNullableTypeInstantiation(type) {
67561
- // First reduce away any constituents that are assignable to 'undefined' or 'null'. This not only eliminates
67562
- // 'undefined' and 'null', but also higher-order types such as a type parameter 'U extends undefined | null'
67563
- // that isn't eliminated by a NonNullable<T> instantiation.
67564
- var reducedType = getTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
67565
67605
  if (!deferredGlobalNonNullableTypeAlias) {
67566
67606
  deferredGlobalNonNullableTypeAlias = getGlobalSymbol("NonNullable", 524288 /* TypeAlias */, /*diagnostic*/ undefined) || unknownSymbol;
67567
67607
  }
67568
- // If the NonNullable<T> type is available, return an instantiation. Otherwise just return the reduced type.
67569
67608
  return deferredGlobalNonNullableTypeAlias !== unknownSymbol ?
67570
- getTypeAliasInstantiation(deferredGlobalNonNullableTypeAlias, [reducedType]) :
67571
- reducedType;
67609
+ getTypeAliasInstantiation(deferredGlobalNonNullableTypeAlias, [type]) :
67610
+ getIntersectionType([type, emptyObjectType]);
67572
67611
  }
67573
67612
  function getNonNullableType(type) {
67574
- return strictNullChecks ? getGlobalNonNullableTypeInstantiation(type) : type;
67613
+ return strictNullChecks ? getAdjustedTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */) : type;
67575
67614
  }
67576
67615
  function addOptionalTypeMarker(type) {
67577
67616
  return strictNullChecks ? getUnionType([type, optionalType]) : type;
@@ -68715,8 +68754,8 @@ var ts;
68715
68754
  }
68716
68755
  function getSingleTypeVariableFromIntersectionTypes(types) {
68717
68756
  var typeVariable;
68718
- for (var _i = 0, types_15 = types; _i < types_15.length; _i++) {
68719
- var type = types_15[_i];
68757
+ for (var _i = 0, types_14 = types; _i < types_14.length; _i++) {
68758
+ var type = types_14[_i];
68720
68759
  var t = type.flags & 2097152 /* Intersection */ && ts.find(type.types, function (t) { return !!getInferenceInfoForType(t); });
68721
68760
  if (!t || typeVariable && t !== typeVariable) {
68722
68761
  return undefined;
@@ -69469,8 +69508,8 @@ var ts;
69469
69508
  }
69470
69509
  }
69471
69510
  };
69472
- for (var _i = 0, types_16 = types; _i < types_16.length; _i++) {
69473
- var type = types_16[_i];
69511
+ for (var _i = 0, types_15 = types; _i < types_15.length; _i++) {
69512
+ var type = types_15[_i];
69474
69513
  var state_9 = _loop_24(type);
69475
69514
  if (typeof state_9 === "object")
69476
69515
  return state_9.value;
@@ -69585,14 +69624,16 @@ var ts;
69585
69624
  return !!(resolved.callSignatures.length || resolved.constructSignatures.length ||
69586
69625
  resolved.members.get("bind") && isTypeSubtypeOf(type, globalFunctionType));
69587
69626
  }
69588
- function getTypeFacts(type, ignoreObjects) {
69589
- if (ignoreObjects === void 0) { ignoreObjects = false; }
69627
+ function getTypeFacts(type) {
69628
+ if (type.flags & (2097152 /* Intersection */ | 465829888 /* Instantiable */)) {
69629
+ type = getBaseConstraintOfType(type) || unknownType;
69630
+ }
69590
69631
  var flags = type.flags;
69591
- if (flags & 4 /* String */) {
69632
+ if (flags & (4 /* String */ | 268435456 /* StringMapping */)) {
69592
69633
  return strictNullChecks ? 16317953 /* StringStrictFacts */ : 16776705 /* StringFacts */;
69593
69634
  }
69594
- if (flags & 128 /* StringLiteral */) {
69595
- var isEmpty = type.value === "";
69635
+ if (flags & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */)) {
69636
+ var isEmpty = flags & 128 /* StringLiteral */ && type.value === "";
69596
69637
  return strictNullChecks ?
69597
69638
  isEmpty ? 12123649 /* EmptyStringStrictFacts */ : 7929345 /* NonEmptyStringStrictFacts */ :
69598
69639
  isEmpty ? 12582401 /* EmptyStringFacts */ : 16776705 /* NonEmptyStringFacts */;
@@ -69624,20 +69665,20 @@ var ts;
69624
69665
  (type === falseType || type === regularFalseType) ? 12580616 /* FalseFacts */ : 16774920 /* TrueFacts */;
69625
69666
  }
69626
69667
  if (flags & 524288 /* Object */) {
69627
- if (ignoreObjects) {
69628
- return 16768959 /* AndFactsMask */; // This is the identity element for computing type facts of intersection.
69629
- }
69630
69668
  return ts.getObjectFlags(type) & 16 /* Anonymous */ && isEmptyObjectType(type) ?
69631
- strictNullChecks ? 16318463 /* EmptyObjectStrictFacts */ : 16777215 /* EmptyObjectFacts */ :
69669
+ strictNullChecks ? 83427327 /* EmptyObjectStrictFacts */ : 83886079 /* EmptyObjectFacts */ :
69632
69670
  isFunctionObjectType(type) ?
69633
69671
  strictNullChecks ? 7880640 /* FunctionStrictFacts */ : 16728000 /* FunctionFacts */ :
69634
69672
  strictNullChecks ? 7888800 /* ObjectStrictFacts */ : 16736160 /* ObjectFacts */;
69635
69673
  }
69636
- if (flags & (16384 /* Void */ | 32768 /* Undefined */)) {
69637
- return 9830144 /* UndefinedFacts */;
69674
+ if (flags & 16384 /* Void */) {
69675
+ return 9830144 /* VoidFacts */;
69676
+ }
69677
+ if (flags & 32768 /* Undefined */) {
69678
+ return 26607360 /* UndefinedFacts */;
69638
69679
  }
69639
69680
  if (flags & 65536 /* Null */) {
69640
- return 9363232 /* NullFacts */;
69681
+ return 42917664 /* NullFacts */;
69641
69682
  }
69642
69683
  if (flags & 12288 /* ESSymbolLike */) {
69643
69684
  return strictNullChecks ? 7925520 /* SymbolStrictFacts */ : 16772880 /* SymbolFacts */;
@@ -69648,37 +69689,56 @@ var ts;
69648
69689
  if (flags & 131072 /* Never */) {
69649
69690
  return 0 /* None */;
69650
69691
  }
69651
- if (flags & 465829888 /* Instantiable */) {
69652
- return !isPatternLiteralType(type) ? getTypeFacts(getBaseConstraintOfType(type) || unknownType, ignoreObjects) :
69653
- strictNullChecks ? 7929345 /* NonEmptyStringStrictFacts */ : 16776705 /* NonEmptyStringFacts */;
69654
- }
69655
69692
  if (flags & 1048576 /* Union */) {
69656
- return ts.reduceLeft(type.types, function (facts, t) { return facts | getTypeFacts(t, ignoreObjects); }, 0 /* None */);
69693
+ return ts.reduceLeft(type.types, function (facts, t) { return facts | getTypeFacts(t); }, 0 /* None */);
69657
69694
  }
69658
69695
  if (flags & 2097152 /* Intersection */) {
69659
- // When an intersection contains a primitive type we ignore object type constituents as they are
69660
- // presumably type tags. For example, in string & { __kind__: "name" } we ignore the object type.
69661
- ignoreObjects || (ignoreObjects = maybeTypeOfKind(type, 131068 /* Primitive */));
69662
- return getIntersectionTypeFacts(type, ignoreObjects);
69696
+ return getIntersectionTypeFacts(type);
69663
69697
  }
69664
- return 16777215 /* All */;
69698
+ return 83886079 /* UnknownFacts */;
69665
69699
  }
69666
- function getIntersectionTypeFacts(type, ignoreObjects) {
69700
+ function getIntersectionTypeFacts(type) {
69701
+ // When an intersection contains a primitive type we ignore object type constituents as they are
69702
+ // presumably type tags. For example, in string & { __kind__: "name" } we ignore the object type.
69703
+ var ignoreObjects = maybeTypeOfKind(type, 131068 /* Primitive */);
69667
69704
  // When computing the type facts of an intersection type, certain type facts are computed as `and`
69668
69705
  // and others are computed as `or`.
69669
69706
  var oredFacts = 0 /* None */;
69670
- var andedFacts = 16777215 /* All */;
69707
+ var andedFacts = 134217727 /* All */;
69671
69708
  for (var _i = 0, _a = type.types; _i < _a.length; _i++) {
69672
69709
  var t = _a[_i];
69673
- var f = getTypeFacts(t, ignoreObjects);
69674
- oredFacts |= f;
69675
- andedFacts &= f;
69710
+ if (!(ignoreObjects && t.flags & 524288 /* Object */)) {
69711
+ var f = getTypeFacts(t);
69712
+ oredFacts |= f;
69713
+ andedFacts &= f;
69714
+ }
69676
69715
  }
69677
- return oredFacts & 8256 /* OrFactsMask */ | andedFacts & 16768959 /* AndFactsMask */;
69716
+ return oredFacts & 8256 /* OrFactsMask */ | andedFacts & 134209471 /* AndFactsMask */;
69678
69717
  }
69679
69718
  function getTypeWithFacts(type, include) {
69680
69719
  return filterType(type, function (t) { return (getTypeFacts(t) & include) !== 0; });
69681
69720
  }
69721
+ // This function is similar to getTypeWithFacts, except that in strictNullChecks mode it replaces type
69722
+ // unknown with the union {} | null | undefined (and reduces that accordingly), and it intersects remaining
69723
+ // instantiable types with {}, {} | null, or {} | undefined in order to remove null and/or undefined.
69724
+ function getAdjustedTypeWithFacts(type, facts) {
69725
+ var reduced = recombineUnknownType(getTypeWithFacts(strictNullChecks && type.flags & 2 /* Unknown */ ? unknownUnionType : type, facts));
69726
+ if (strictNullChecks) {
69727
+ switch (facts) {
69728
+ case 524288 /* NEUndefined */:
69729
+ return mapType(reduced, function (t) { return getTypeFacts(t) & 65536 /* EQUndefined */ ? getIntersectionType([t, getTypeFacts(t) & 131072 /* EQNull */ && !maybeTypeOfKind(reduced, 65536 /* Null */) ? getUnionType([emptyObjectType, nullType]) : emptyObjectType]) : t; });
69730
+ case 1048576 /* NENull */:
69731
+ return mapType(reduced, function (t) { return getTypeFacts(t) & 131072 /* EQNull */ ? getIntersectionType([t, getTypeFacts(t) & 65536 /* EQUndefined */ && !maybeTypeOfKind(reduced, 32768 /* Undefined */) ? getUnionType([emptyObjectType, undefinedType]) : emptyObjectType]) : t; });
69732
+ case 2097152 /* NEUndefinedOrNull */:
69733
+ case 4194304 /* Truthy */:
69734
+ return mapType(reduced, function (t) { return getTypeFacts(t) & 262144 /* EQUndefinedOrNull */ ? getGlobalNonNullableTypeInstantiation(t) : t; });
69735
+ }
69736
+ }
69737
+ return reduced;
69738
+ }
69739
+ function recombineUnknownType(type) {
69740
+ return type === unknownUnionType ? unknownType : type;
69741
+ }
69682
69742
  function getTypeWithDefault(type, defaultExpression) {
69683
69743
  return defaultExpression ?
69684
69744
  getUnionType([getNonUndefinedType(type), getTypeOfExpression(defaultExpression)]) :
@@ -69927,8 +69987,8 @@ var ts;
69927
69987
  var types = origin && origin.flags & 1048576 /* Union */ ? origin.types : type.types;
69928
69988
  var mappedTypes;
69929
69989
  var changed = false;
69930
- for (var _i = 0, types_17 = types; _i < types_17.length; _i++) {
69931
- var t = types_17[_i];
69990
+ for (var _i = 0, types_16 = types; _i < types_16.length; _i++) {
69991
+ var t = types_16[_i];
69932
69992
  var mapped = t.flags & 1048576 /* Union */ ? mapType(t, mapper, noReductions) : mapper(t);
69933
69993
  changed || (changed = t !== mapped);
69934
69994
  if (mapped) {
@@ -70014,8 +70074,8 @@ var ts;
70014
70074
  }
70015
70075
  function isEvolvingArrayTypeList(types) {
70016
70076
  var hasEvolvingArrayType = false;
70017
- for (var _i = 0, types_18 = types; _i < types_18.length; _i++) {
70018
- var t = types_18[_i];
70077
+ for (var _i = 0, types_17 = types; _i < types_17.length; _i++) {
70078
+ var t = types_17[_i];
70019
70079
  if (!(t.flags & 131072 /* Never */)) {
70020
70080
  if (!(ts.getObjectFlags(t) & 256 /* EvolvingArray */)) {
70021
70081
  return false;
@@ -70736,7 +70796,7 @@ var ts;
70736
70796
  if (isEvolvingArrayTypeList(types)) {
70737
70797
  return getEvolvingArrayType(getUnionType(ts.map(types, getElementTypeOfEvolvingArrayType)));
70738
70798
  }
70739
- var result = getUnionType(ts.sameMap(types, finalizeEvolvingArrayType), subtypeReduction);
70799
+ var result = recombineUnknownType(getUnionType(ts.sameMap(types, finalizeEvolvingArrayType), subtypeReduction));
70740
70800
  if (result !== declaredType && result.flags & declaredType.flags & 1048576 /* Union */ && ts.arraysEqual(result.types, declaredType.types)) {
70741
70801
  return declaredType;
70742
70802
  }
@@ -70838,11 +70898,10 @@ var ts;
70838
70898
  }
70839
70899
  function narrowTypeByTruthiness(type, expr, assumeTrue) {
70840
70900
  if (isMatchingReference(reference, expr)) {
70841
- return type.flags & 2 /* Unknown */ && assumeTrue ? nonNullUnknownType :
70842
- getTypeWithFacts(type, assumeTrue ? 4194304 /* Truthy */ : 8388608 /* Falsy */);
70901
+ return getAdjustedTypeWithFacts(type, assumeTrue ? 4194304 /* Truthy */ : 8388608 /* Falsy */);
70843
70902
  }
70844
70903
  if (strictNullChecks && assumeTrue && optionalChainContainsReference(expr, reference)) {
70845
- type = getTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
70904
+ type = getAdjustedTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
70846
70905
  }
70847
70906
  var access = getDiscriminantPropertyAccess(expr, type);
70848
70907
  if (access) {
@@ -70982,7 +71041,7 @@ var ts;
70982
71041
  // Note that we include any and unknown in the exclusion test because their domain includes null and undefined.
70983
71042
  var removeNullable = equalsOperator !== assumeTrue && everyType(valueType, function (t) { return !!(t.flags & nullableFlags); }) ||
70984
71043
  equalsOperator === assumeTrue && everyType(valueType, function (t) { return !(t.flags & (3 /* AnyOrUnknown */ | nullableFlags)); });
70985
- return removeNullable ? getTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */) : type;
71044
+ return removeNullable ? getAdjustedTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */) : type;
70986
71045
  }
70987
71046
  function narrowTypeByEquality(type, operator, value, assumeTrue) {
70988
71047
  if (type.flags & 1 /* Any */) {
@@ -70992,9 +71051,6 @@ var ts;
70992
71051
  assumeTrue = !assumeTrue;
70993
71052
  }
70994
71053
  var valueType = getTypeOfExpression(value);
70995
- if (assumeTrue && (type.flags & 2 /* Unknown */) && (operator === 34 /* EqualsEqualsToken */ || operator === 35 /* ExclamationEqualsToken */) && (valueType.flags & 65536 /* Null */)) {
70996
- return getUnionType([nullType, undefinedType]);
70997
- }
70998
71054
  if ((type.flags & 2 /* Unknown */) && assumeTrue && (operator === 36 /* EqualsEqualsEqualsToken */ || operator === 37 /* ExclamationEqualsEqualsToken */)) {
70999
71055
  if (valueType.flags & (131068 /* Primitive */ | 67108864 /* NonPrimitive */)) {
71000
71056
  return valueType;
@@ -71014,7 +71070,7 @@ var ts;
71014
71070
  valueType.flags & 65536 /* Null */ ?
71015
71071
  assumeTrue ? 131072 /* EQNull */ : 1048576 /* NENull */ :
71016
71072
  assumeTrue ? 65536 /* EQUndefined */ : 524288 /* NEUndefined */;
71017
- return type.flags & 2 /* Unknown */ && facts & (1048576 /* NENull */ | 2097152 /* NEUndefinedOrNull */) ? nonNullUnknownType : getTypeWithFacts(type, facts);
71073
+ return getAdjustedTypeWithFacts(type, facts);
71018
71074
  }
71019
71075
  if (assumeTrue) {
71020
71076
  var filterFn = operator === 34 /* EqualsEqualsToken */ ?
@@ -71035,24 +71091,18 @@ var ts;
71035
71091
  var target = getReferenceCandidate(typeOfExpr.expression);
71036
71092
  if (!isMatchingReference(reference, target)) {
71037
71093
  if (strictNullChecks && optionalChainContainsReference(target, reference) && assumeTrue === (literal.text !== "undefined")) {
71038
- return getTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
71094
+ return getAdjustedTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
71039
71095
  }
71040
71096
  return type;
71041
71097
  }
71042
71098
  if (type.flags & 1 /* Any */ && literal.text === "function") {
71043
71099
  return type;
71044
71100
  }
71045
- if (assumeTrue && type.flags & 2 /* Unknown */ && literal.text === "object") {
71046
- // The non-null unknown type is used to track whether a previous narrowing operation has removed the null type
71047
- // from the unknown type. For example, the expression `x && typeof x === 'object'` first narrows x to the non-null
71048
- // unknown type, and then narrows that to the non-primitive type.
71049
- return type === nonNullUnknownType ? nonPrimitiveType : getUnionType([nonPrimitiveType, nullType]);
71050
- }
71051
71101
  var facts = assumeTrue ?
71052
71102
  typeofEQFacts.get(literal.text) || 128 /* TypeofEQHostObject */ :
71053
71103
  typeofNEFacts.get(literal.text) || 32768 /* TypeofNEHostObject */;
71054
71104
  var impliedType = getImpliedTypeFromTypeofGuard(type, literal.text);
71055
- return getTypeWithFacts(assumeTrue && impliedType ? mapType(type, narrowUnionMemberByTypeof(impliedType)) : type, facts);
71105
+ return getTypeWithFacts(assumeTrue && impliedType ? narrowTypeByImpliedType(type, impliedType) : type, facts);
71056
71106
  }
71057
71107
  function narrowTypeBySwitchOptionalChainContainment(type, switchStatement, clauseStart, clauseEnd, clauseCheck) {
71058
71108
  var everyClauseChecks = clauseStart !== clauseEnd && ts.every(getSwitchClauseTypes(switchStatement).slice(clauseStart, clauseEnd), clauseCheck);
@@ -71101,10 +71151,10 @@ var ts;
71101
71151
  }
71102
71152
  function getImpliedTypeFromTypeofGuard(type, text) {
71103
71153
  switch (text) {
71154
+ case "object":
71155
+ return type.flags & 1 /* Any */ ? type : getUnionType([nullType, nonPrimitiveType]);
71104
71156
  case "function":
71105
71157
  return type.flags & 1 /* Any */ ? type : globalFunctionType;
71106
- case "object":
71107
- return type.flags & 2 /* Unknown */ ? getUnionType([nonPrimitiveType, nullType]) : type;
71108
71158
  default:
71109
71159
  return typeofTypesByName.get(text);
71110
71160
  }
@@ -71115,22 +71165,27 @@ var ts;
71115
71165
  // the guard. For example: narrowing `{} | undefined` by `"boolean"` should produce the type `boolean`, not
71116
71166
  // the filtered type `{}`. For this reason we narrow constituents of the union individually, in addition to
71117
71167
  // filtering by type-facts.
71118
- function narrowUnionMemberByTypeof(candidate) {
71119
- return function (type) {
71120
- if (isTypeSubtypeOf(type, candidate)) {
71121
- return type;
71122
- }
71123
- if (isTypeSubtypeOf(candidate, type)) {
71124
- return candidate;
71168
+ function narrowTypeByImpliedType(type, candidate) {
71169
+ if (type.flags & 3 /* AnyOrUnknown */) {
71170
+ return candidate;
71171
+ }
71172
+ return mapType(type, function (t) {
71173
+ if (isTypeRelatedTo(t, candidate, strictSubtypeRelation)) {
71174
+ return t;
71125
71175
  }
71126
- if (type.flags & 465829888 /* Instantiable */) {
71127
- var constraint = getBaseConstraintOfType(type) || anyType;
71128
- if (isTypeSubtypeOf(candidate, constraint)) {
71129
- return getIntersectionType([type, candidate]);
71176
+ return mapType(candidate, function (c) {
71177
+ if (!areTypesComparable(t, c)) {
71178
+ return neverType;
71130
71179
  }
71131
- }
71132
- return type;
71133
- };
71180
+ if (c.flags & 131068 /* Primitive */ && t.flags & 524288 /* Object */ && !isEmptyAnonymousObjectType(t)) {
71181
+ return isTypeSubtypeOf(c, t) ? c : neverType;
71182
+ }
71183
+ if (c === globalFunctionType && isTypeSubtypeOf(c, t)) {
71184
+ return c;
71185
+ }
71186
+ return getIntersectionType([t, c]);
71187
+ });
71188
+ });
71134
71189
  }
71135
71190
  function narrowBySwitchOnTypeOf(type, switchStatement, clauseStart, clauseEnd) {
71136
71191
  var switchWitnesses = getSwitchClauseTypeOfWitnesses(switchStatement, /*retainDefault*/ true);
@@ -71189,7 +71244,7 @@ var ts;
71189
71244
  because it is caught in the first clause.
71190
71245
  */
71191
71246
  var impliedType = getTypeWithFacts(getUnionType(clauseWitnesses.map(function (text) { return getImpliedTypeFromTypeofGuard(type, text) || type; })), switchFacts);
71192
- return getTypeWithFacts(mapType(type, narrowUnionMemberByTypeof(impliedType)), switchFacts);
71247
+ return getTypeWithFacts(narrowTypeByImpliedType(type, impliedType), switchFacts);
71193
71248
  }
71194
71249
  function isMatchingConstructorReference(expr) {
71195
71250
  return (ts.isPropertyAccessExpression(expr) && ts.idText(expr.name) === "constructor" ||
@@ -71240,7 +71295,7 @@ var ts;
71240
71295
  var left = getReferenceCandidate(expr.left);
71241
71296
  if (!isMatchingReference(reference, left)) {
71242
71297
  if (assumeTrue && strictNullChecks && optionalChainContainsReference(left, reference)) {
71243
- return getTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
71298
+ return getAdjustedTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
71244
71299
  }
71245
71300
  return type;
71246
71301
  }
@@ -71328,7 +71383,7 @@ var ts;
71328
71383
  }
71329
71384
  if (strictNullChecks && assumeTrue && optionalChainContainsReference(predicateArgument, reference) &&
71330
71385
  !(getTypeFacts(predicate.type) & 65536 /* EQUndefined */)) {
71331
- type = getTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
71386
+ type = getAdjustedTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
71332
71387
  }
71333
71388
  var access = getDiscriminantPropertyAccess(predicateArgument, type);
71334
71389
  if (access) {
@@ -71385,7 +71440,7 @@ var ts;
71385
71440
  }
71386
71441
  function narrowTypeByOptionality(type, expr, assumePresent) {
71387
71442
  if (isMatchingReference(reference, expr)) {
71388
- return getTypeWithFacts(type, assumePresent ? 2097152 /* NEUndefinedOrNull */ : 262144 /* EQUndefinedOrNull */);
71443
+ return getAdjustedTypeWithFacts(type, assumePresent ? 2097152 /* NEUndefinedOrNull */ : 262144 /* EQUndefinedOrNull */);
71389
71444
  }
71390
71445
  var access = getDiscriminantPropertyAccess(expr, type);
71391
71446
  if (access) {
@@ -71471,8 +71526,8 @@ var ts;
71471
71526
  var annotationIncludesUndefined = strictNullChecks &&
71472
71527
  declaration.kind === 164 /* Parameter */ &&
71473
71528
  declaration.initializer &&
71474
- getFalsyFlags(declaredType) & 32768 /* Undefined */ &&
71475
- !(getFalsyFlags(checkExpression(declaration.initializer)) & 32768 /* Undefined */);
71529
+ getTypeFacts(declaredType) & 16777216 /* IsUndefined */ &&
71530
+ !(getTypeFacts(checkExpression(declaration.initializer)) & 16777216 /* IsUndefined */);
71476
71531
  popTypeResolution();
71477
71532
  return annotationIncludesUndefined ? getTypeWithFacts(declaredType, 524288 /* NEUndefined */) : declaredType;
71478
71533
  }
@@ -71493,7 +71548,9 @@ var ts;
71493
71548
  !(someType(type, isGenericTypeWithoutNullableConstraint) && isGenericIndexType(getTypeOfExpression(parent.argumentExpression)));
71494
71549
  }
71495
71550
  function isGenericTypeWithUnionConstraint(type) {
71496
- return !!(type.flags & 465829888 /* Instantiable */ && getBaseConstraintOrType(type).flags & (98304 /* Nullable */ | 1048576 /* Union */));
71551
+ return type.flags & 2097152 /* Intersection */ ?
71552
+ ts.some(type.types, isGenericTypeWithUnionConstraint) :
71553
+ !!(type.flags & 465829888 /* Instantiable */ && getBaseConstraintOrType(type).flags & (98304 /* Nullable */ | 1048576 /* Union */));
71497
71554
  }
71498
71555
  function isGenericTypeWithoutNullableConstraint(type) {
71499
71556
  return !!(type.flags & 465829888 /* Instantiable */ && !maybeTypeOfKind(getBaseConstraintOrType(type), 98304 /* Nullable */));
@@ -71521,7 +71578,7 @@ var ts;
71521
71578
  var substituteConstraints = !(checkMode && checkMode & 2 /* Inferential */) &&
71522
71579
  someType(type, isGenericTypeWithUnionConstraint) &&
71523
71580
  (isConstraintPosition(type, reference) || hasContextualTypeWithNoGenericTypes(reference, checkMode));
71524
- return substituteConstraints ? mapType(type, function (t) { return t.flags & 465829888 /* Instantiable */ ? getBaseConstraintOrType(t) : t; }) : type;
71581
+ return substituteConstraints ? mapType(type, getBaseConstraintOrType) : type;
71525
71582
  }
71526
71583
  function isExportOrExportExpression(location) {
71527
71584
  return !!ts.findAncestor(location, function (n) {
@@ -71798,7 +71855,7 @@ var ts;
71798
71855
  return convertAutoToAny(flowType);
71799
71856
  }
71800
71857
  }
71801
- else if (!assumeInitialized && !(getFalsyFlags(type) & 32768 /* Undefined */) && getFalsyFlags(flowType) & 32768 /* Undefined */) {
71858
+ else if (!assumeInitialized && !(getTypeFacts(type) & 16777216 /* IsUndefined */) && getTypeFacts(flowType) & 16777216 /* IsUndefined */) {
71802
71859
  error(node, ts.Diagnostics.Variable_0_is_used_before_being_assigned, symbolToString(symbol));
71803
71860
  // Return the declared type to reduce follow-on errors
71804
71861
  return type;
@@ -73327,8 +73384,8 @@ var ts;
73327
73384
  }
73328
73385
  var signatureList;
73329
73386
  var types = type.types;
73330
- for (var _i = 0, types_19 = types; _i < types_19.length; _i++) {
73331
- var current = types_19[_i];
73387
+ for (var _i = 0, types_18 = types; _i < types_18.length; _i++) {
73388
+ var current = types_18[_i];
73332
73389
  var signature = getContextualCallSignature(current, node);
73333
73390
  if (signature) {
73334
73391
  if (!signatureList) {
@@ -74490,19 +74547,19 @@ var ts;
74490
74547
  return checkNonNullType(checkExpression(node), node);
74491
74548
  }
74492
74549
  function isNullableType(type) {
74493
- return !!((strictNullChecks ? getFalsyFlags(type) : type.flags) & 98304 /* Nullable */);
74550
+ return !!(getTypeFacts(type) & 50331648 /* IsUndefinedOrNull */);
74494
74551
  }
74495
74552
  function getNonNullableTypeIfNeeded(type) {
74496
74553
  return isNullableType(type) ? getNonNullableType(type) : type;
74497
74554
  }
74498
- function reportObjectPossiblyNullOrUndefinedError(node, flags) {
74499
- error(node, flags & 32768 /* Undefined */ ? flags & 65536 /* Null */ ?
74555
+ function reportObjectPossiblyNullOrUndefinedError(node, facts) {
74556
+ error(node, facts & 16777216 /* IsUndefined */ ? facts & 33554432 /* IsNull */ ?
74500
74557
  ts.Diagnostics.Object_is_possibly_null_or_undefined :
74501
74558
  ts.Diagnostics.Object_is_possibly_undefined :
74502
74559
  ts.Diagnostics.Object_is_possibly_null);
74503
74560
  }
74504
- function reportCannotInvokePossiblyNullOrUndefinedError(node, flags) {
74505
- error(node, flags & 32768 /* Undefined */ ? flags & 65536 /* Null */ ?
74561
+ function reportCannotInvokePossiblyNullOrUndefinedError(node, facts) {
74562
+ error(node, facts & 16777216 /* IsUndefined */ ? facts & 33554432 /* IsNull */ ?
74506
74563
  ts.Diagnostics.Cannot_invoke_an_object_which_is_possibly_null_or_undefined :
74507
74564
  ts.Diagnostics.Cannot_invoke_an_object_which_is_possibly_undefined :
74508
74565
  ts.Diagnostics.Cannot_invoke_an_object_which_is_possibly_null);
@@ -74512,9 +74569,9 @@ var ts;
74512
74569
  error(node, ts.Diagnostics.Object_is_of_type_unknown);
74513
74570
  return errorType;
74514
74571
  }
74515
- var kind = (strictNullChecks ? getFalsyFlags(type) : type.flags) & 98304 /* Nullable */;
74516
- if (kind) {
74517
- reportError(node, kind);
74572
+ var facts = getTypeFacts(type);
74573
+ if (facts & 50331648 /* IsUndefinedOrNull */) {
74574
+ reportError(node, facts);
74518
74575
  var t = getNonNullableType(type);
74519
74576
  return t.flags & (98304 /* Nullable */ | 131072 /* Never */) ? errorType : t;
74520
74577
  }
@@ -74809,7 +74866,7 @@ var ts;
74809
74866
  assumeUninitialized = true;
74810
74867
  }
74811
74868
  var flowType = getFlowTypeOfReference(node, propType, assumeUninitialized ? getOptionalType(propType) : propType);
74812
- if (assumeUninitialized && !(getFalsyFlags(propType) & 32768 /* Undefined */) && getFalsyFlags(flowType) & 32768 /* Undefined */) {
74869
+ if (assumeUninitialized && !(getTypeFacts(propType) & 16777216 /* IsUndefined */) && getTypeFacts(flowType) & 16777216 /* IsUndefined */) {
74813
74870
  error(errorNode, ts.Diagnostics.Property_0_is_used_before_being_assigned, symbolToString(prop)); // TODO: GH#18217
74814
74871
  // Return the declared type to reduce follow-on errors
74815
74872
  return propType;
@@ -76725,8 +76782,8 @@ var ts;
76725
76782
  if (apparentType.flags & 1048576 /* Union */) {
76726
76783
  var types = apparentType.types;
76727
76784
  var hasSignatures = false;
76728
- for (var _i = 0, types_20 = types; _i < types_20.length; _i++) {
76729
- var constituent = types_20[_i];
76785
+ for (var _i = 0, types_19 = types; _i < types_19.length; _i++) {
76786
+ var constituent = types_19[_i];
76730
76787
  var signatures = getSignaturesOfType(constituent, kind);
76731
76788
  if (signatures.length !== 0) {
76732
76789
  hasSignatures = true;
@@ -78417,7 +78474,7 @@ var ts;
78417
78474
  var type = getTypeOfSymbol(symbol);
78418
78475
  if (strictNullChecks &&
78419
78476
  !(type.flags & (3 /* AnyOrUnknown */ | 131072 /* Never */)) &&
78420
- !(exactOptionalPropertyTypes ? symbol.flags & 16777216 /* Optional */ : getFalsyFlags(type) & 32768 /* Undefined */)) {
78477
+ !(exactOptionalPropertyTypes ? symbol.flags & 16777216 /* Optional */ : getTypeFacts(type) & 16777216 /* IsUndefined */)) {
78421
78478
  error(expr, ts.Diagnostics.The_operand_of_a_delete_operator_must_be_optional);
78422
78479
  }
78423
78480
  }
@@ -78585,8 +78642,8 @@ var ts;
78585
78642
  }
78586
78643
  if (type.flags & 3145728 /* UnionOrIntersection */) {
78587
78644
  var types = type.types;
78588
- for (var _i = 0, types_21 = types; _i < types_21.length; _i++) {
78589
- var t = types_21[_i];
78645
+ for (var _i = 0, types_20 = types; _i < types_20.length; _i++) {
78646
+ var t = types_20[_i];
78590
78647
  if (maybeTypeOfKind(t, kind)) {
78591
78648
  return true;
78592
78649
  }
@@ -78813,7 +78870,7 @@ var ts;
78813
78870
  // In strict null checking mode, if a default value of a non-undefined type is specified, remove
78814
78871
  // undefined from the final type.
78815
78872
  if (strictNullChecks &&
78816
- !(getFalsyFlags(checkExpression(prop.objectAssignmentInitializer)) & 32768 /* Undefined */)) {
78873
+ !(getTypeFacts(checkExpression(prop.objectAssignmentInitializer)) & 16777216 /* IsUndefined */)) {
78817
78874
  sourceType = getTypeWithFacts(sourceType, 524288 /* NEUndefined */);
78818
78875
  }
78819
78876
  checkBinaryLikeExpression(prop.name, prop.equalsToken, prop.objectAssignmentInitializer, checkMode);
@@ -79213,7 +79270,7 @@ var ts;
79213
79270
  case 56 /* BarBarToken */:
79214
79271
  case 75 /* BarBarEqualsToken */: {
79215
79272
  var resultType_3 = getTypeFacts(leftType) & 8388608 /* Falsy */ ?
79216
- getUnionType([removeDefinitelyFalsyTypes(leftType), rightType], 2 /* Subtype */) :
79273
+ getUnionType([getNonNullableType(removeDefinitelyFalsyTypes(leftType)), rightType], 2 /* Subtype */) :
79217
79274
  leftType;
79218
79275
  if (operator === 75 /* BarBarEqualsToken */) {
79219
79276
  checkAssignmentOperator(rightType);
@@ -81754,8 +81811,8 @@ var ts;
81754
81811
  }
81755
81812
  function getEntityNameForDecoratorMetadataFromTypeList(types) {
81756
81813
  var commonEntityName;
81757
- for (var _i = 0, types_22 = types; _i < types_22.length; _i++) {
81758
- var typeNode = types_22[_i];
81814
+ for (var _i = 0, types_21 = types; _i < types_21.length; _i++) {
81815
+ var typeNode = types_21[_i];
81759
81816
  while (typeNode.kind === 191 /* ParenthesizedType */ || typeNode.kind === 197 /* NamedTupleMember */) {
81760
81817
  typeNode = typeNode.type; // Skip parens if need be
81761
81818
  }
@@ -82621,7 +82678,7 @@ var ts;
82621
82678
  // For a binding pattern, validate the initializer and exit
82622
82679
  if (ts.isBindingPattern(node.name)) {
82623
82680
  var needCheckInitializer = node.initializer && node.parent.parent.kind !== 243 /* ForInStatement */;
82624
- var needCheckWidenedType = node.name.elements.length === 0;
82681
+ var needCheckWidenedType = !ts.some(node.name.elements, ts.not(ts.isOmittedExpression));
82625
82682
  if (needCheckInitializer || needCheckWidenedType) {
82626
82683
  // Don't validate for-in initializer as it is already an error
82627
82684
  var widenedType = getWidenedTypeForVariableLikeDeclaration(node);
@@ -82774,7 +82831,7 @@ var ts;
82774
82831
  return;
82775
82832
  var type = checkTruthinessExpression(location);
82776
82833
  var isPropertyExpressionCast = ts.isPropertyAccessExpression(location) && isTypeAssertion(location.expression);
82777
- if (getFalsyFlags(type) || isPropertyExpressionCast)
82834
+ if (!(getTypeFacts(type) & 4194304 /* Truthy */) || isPropertyExpressionCast)
82778
82835
  return;
82779
82836
  // While it technically should be invalid for any known-truthy value
82780
82837
  // to be tested, we de-scope to functions and Promises unreferenced in
@@ -84460,18 +84517,17 @@ var ts;
84460
84517
  // but not by other kinds of members.
84461
84518
  // Base class instance member variables and accessors can be overridden by
84462
84519
  // derived class instance member variables and accessors, but not by other kinds of members.
84463
- var _a, _b;
84520
+ var _a, _b, _c, _d;
84464
84521
  // NOTE: assignability is checked in checkClassDeclaration
84465
84522
  var baseProperties = getPropertiesOfType(baseType);
84466
- basePropertyCheck: for (var _i = 0, baseProperties_1 = baseProperties; _i < baseProperties_1.length; _i++) {
84467
- var baseProperty = baseProperties_1[_i];
84523
+ var _loop_33 = function (baseProperty) {
84468
84524
  var base = getTargetSymbol(baseProperty);
84469
84525
  if (base.flags & 4194304 /* Prototype */) {
84470
- continue;
84526
+ return "continue";
84471
84527
  }
84472
84528
  var baseSymbol = getPropertyOfObjectType(type, base.escapedName);
84473
84529
  if (!baseSymbol) {
84474
- continue;
84530
+ return "continue";
84475
84531
  }
84476
84532
  var derived = getTargetSymbol(baseSymbol);
84477
84533
  var baseDeclarationFlags = ts.getDeclarationModifierFlagsFromSymbol(base);
@@ -84489,14 +84545,14 @@ var ts;
84489
84545
  // Searches other base types for a declaration that would satisfy the inherited abstract member.
84490
84546
  // (The class may have more than one base type via declaration merging with an interface with the
84491
84547
  // same name.)
84492
- for (var _c = 0, _d = getBaseTypes(type); _c < _d.length; _c++) {
84493
- var otherBaseType = _d[_c];
84548
+ for (var _e = 0, _f = getBaseTypes(type); _e < _f.length; _e++) {
84549
+ var otherBaseType = _f[_e];
84494
84550
  if (otherBaseType === baseType)
84495
84551
  continue;
84496
84552
  var baseSymbol_1 = getPropertyOfObjectType(otherBaseType, base.escapedName);
84497
84553
  var derivedElsewhere = baseSymbol_1 && getTargetSymbol(baseSymbol_1);
84498
84554
  if (derivedElsewhere && derivedElsewhere !== base) {
84499
- continue basePropertyCheck;
84555
+ return "continue-basePropertyCheck";
84500
84556
  }
84501
84557
  }
84502
84558
  if (derivedClassDecl.kind === 226 /* ClassExpression */) {
@@ -84511,20 +84567,19 @@ var ts;
84511
84567
  // derived overrides base.
84512
84568
  var derivedDeclarationFlags = ts.getDeclarationModifierFlagsFromSymbol(derived);
84513
84569
  if (baseDeclarationFlags & 8 /* Private */ || derivedDeclarationFlags & 8 /* Private */) {
84514
- // either base or derived property is private - not override, skip it
84515
- continue;
84570
+ return "continue";
84516
84571
  }
84517
84572
  var errorMessage = void 0;
84518
84573
  var basePropertyFlags = base.flags & 98308 /* PropertyOrAccessor */;
84519
84574
  var derivedPropertyFlags = derived.flags & 98308 /* PropertyOrAccessor */;
84520
84575
  if (basePropertyFlags && derivedPropertyFlags) {
84521
84576
  // property/accessor is overridden with property/accessor
84522
- if (baseDeclarationFlags & 128 /* Abstract */ && !(base.valueDeclaration && ts.isPropertyDeclaration(base.valueDeclaration) && base.valueDeclaration.initializer)
84523
- || base.valueDeclaration && base.valueDeclaration.parent.kind === 258 /* InterfaceDeclaration */
84577
+ if ((ts.getCheckFlags(base) & 6 /* Synthetic */
84578
+ ? (_a = base.declarations) === null || _a === void 0 ? void 0 : _a.some(function (d) { return isPropertyAbstractOrInterface(d, baseDeclarationFlags); })
84579
+ : (_b = base.declarations) === null || _b === void 0 ? void 0 : _b.every(function (d) { return isPropertyAbstractOrInterface(d, baseDeclarationFlags); }))
84580
+ || ts.getCheckFlags(base) & 262144 /* Mapped */
84524
84581
  || derived.valueDeclaration && ts.isBinaryExpression(derived.valueDeclaration)) {
84525
- // when the base property is abstract or from an interface, base/derived flags don't need to match
84526
- // same when the derived property is from an assignment
84527
- continue;
84582
+ return "continue";
84528
84583
  }
84529
84584
  var overriddenInstanceProperty = basePropertyFlags !== 4 /* Property */ && derivedPropertyFlags === 4 /* Property */;
84530
84585
  var overriddenInstanceAccessor = basePropertyFlags === 4 /* Property */ && derivedPropertyFlags !== 4 /* Property */;
@@ -84535,12 +84590,12 @@ var ts;
84535
84590
  error(ts.getNameOfDeclaration(derived.valueDeclaration) || derived.valueDeclaration, errorMessage_1, symbolToString(base), typeToString(baseType), typeToString(type));
84536
84591
  }
84537
84592
  else if (useDefineForClassFields) {
84538
- var uninitialized = (_a = derived.declarations) === null || _a === void 0 ? void 0 : _a.find(function (d) { return d.kind === 167 /* PropertyDeclaration */ && !d.initializer; });
84593
+ var uninitialized = (_c = derived.declarations) === null || _c === void 0 ? void 0 : _c.find(function (d) { return d.kind === 167 /* PropertyDeclaration */ && !d.initializer; });
84539
84594
  if (uninitialized
84540
84595
  && !(derived.flags & 33554432 /* Transient */)
84541
84596
  && !(baseDeclarationFlags & 128 /* Abstract */)
84542
84597
  && !(derivedDeclarationFlags & 128 /* Abstract */)
84543
- && !((_b = derived.declarations) === null || _b === void 0 ? void 0 : _b.some(function (d) { return !!(d.flags & 16777216 /* Ambient */); }))) {
84598
+ && !((_d = derived.declarations) === null || _d === void 0 ? void 0 : _d.some(function (d) { return !!(d.flags & 16777216 /* Ambient */); }))) {
84544
84599
  var constructor = findConstructorDeclaration(ts.getClassLikeDeclarationOfSymbol(type.symbol));
84545
84600
  var propName = uninitialized.name;
84546
84601
  if (uninitialized.exclamationToken
@@ -84553,13 +84608,11 @@ var ts;
84553
84608
  }
84554
84609
  }
84555
84610
  }
84556
- // correct case
84557
- continue;
84611
+ return "continue";
84558
84612
  }
84559
84613
  else if (isPrototypeProperty(base)) {
84560
84614
  if (isPrototypeProperty(derived) || derived.flags & 4 /* Property */) {
84561
- // method is overridden with method or property -- correct case
84562
- continue;
84615
+ return "continue";
84563
84616
  }
84564
84617
  else {
84565
84618
  ts.Debug.assert(!!(derived.flags & 98304 /* Accessor */));
@@ -84574,9 +84627,20 @@ var ts;
84574
84627
  }
84575
84628
  error(ts.getNameOfDeclaration(derived.valueDeclaration) || derived.valueDeclaration, errorMessage, typeToString(baseType), symbolToString(base), typeToString(type));
84576
84629
  }
84630
+ };
84631
+ basePropertyCheck: for (var _i = 0, baseProperties_1 = baseProperties; _i < baseProperties_1.length; _i++) {
84632
+ var baseProperty = baseProperties_1[_i];
84633
+ var state_10 = _loop_33(baseProperty);
84634
+ switch (state_10) {
84635
+ case "continue-basePropertyCheck": continue basePropertyCheck;
84636
+ }
84577
84637
  }
84578
84638
  }
84579
- function getNonInterhitedProperties(type, baseTypes, properties) {
84639
+ function isPropertyAbstractOrInterface(declaration, baseDeclarationFlags) {
84640
+ return baseDeclarationFlags & 128 /* Abstract */ && (!ts.isPropertyDeclaration(declaration) || !declaration.initializer)
84641
+ || ts.isInterfaceDeclaration(declaration.parent);
84642
+ }
84643
+ function getNonInheritedProperties(type, baseTypes, properties) {
84580
84644
  if (!ts.length(baseTypes)) {
84581
84645
  return properties;
84582
84646
  }
@@ -84645,7 +84709,7 @@ var ts;
84645
84709
  var propName = member.name;
84646
84710
  if (ts.isIdentifier(propName) || ts.isPrivateIdentifier(propName) || ts.isComputedPropertyName(propName)) {
84647
84711
  var type = getTypeOfSymbol(getSymbolOfNode(member));
84648
- if (!(type.flags & 3 /* AnyOrUnknown */ || getFalsyFlags(type) & 32768 /* Undefined */)) {
84712
+ if (!(type.flags & 3 /* AnyOrUnknown */ || getTypeFacts(type) & 16777216 /* IsUndefined */)) {
84649
84713
  if (!constructor || !isPropertyInitializedInConstructor(propName, type, constructor)) {
84650
84714
  error(member.name, ts.Diagnostics.Property_0_has_no_initializer_and_is_not_definitely_assigned_in_the_constructor, ts.declarationNameToString(propName));
84651
84715
  }
@@ -84670,7 +84734,7 @@ var ts;
84670
84734
  ts.setParent(reference, staticBlock);
84671
84735
  reference.flowNode = staticBlock.returnFlowNode;
84672
84736
  var flowType = getFlowTypeOfReference(reference, propType, getOptionalType(propType));
84673
- if (!(getFalsyFlags(flowType) & 32768 /* Undefined */)) {
84737
+ if (!(getTypeFacts(flowType) & 16777216 /* IsUndefined */)) {
84674
84738
  return true;
84675
84739
  }
84676
84740
  }
@@ -84685,7 +84749,7 @@ var ts;
84685
84749
  ts.setParent(reference, constructor);
84686
84750
  reference.flowNode = constructor.returnFlowNode;
84687
84751
  var flowType = getFlowTypeOfReference(reference, propType, getOptionalType(propType));
84688
- return !(getFalsyFlags(flowType) & 32768 /* Undefined */);
84752
+ return !(getTypeFacts(flowType) & 16777216 /* IsUndefined */);
84689
84753
  }
84690
84754
  function checkInterfaceDeclaration(node) {
84691
84755
  // Grammar checking
@@ -92973,8 +93037,8 @@ var ts;
92973
93037
  // Note when updating logic here also update getEntityNameForDecoratorMetadata
92974
93038
  // so that aliases can be marked as referenced
92975
93039
  var serializedUnion;
92976
- for (var _i = 0, types_23 = types; _i < types_23.length; _i++) {
92977
- var typeNode = types_23[_i];
93040
+ for (var _i = 0, types_22 = types; _i < types_22.length; _i++) {
93041
+ var typeNode = types_22[_i];
92978
93042
  while (typeNode.kind === 191 /* ParenthesizedType */) {
92979
93043
  typeNode = typeNode.type; // Skip parens if need be
92980
93044
  }
@@ -113623,8 +113687,8 @@ var ts;
113623
113687
  bundleFileInfo.sections.push({ pos: pos, end: writer.getTextPos(), kind: "reference" /* Reference */, data: directive.fileName });
113624
113688
  writeLine();
113625
113689
  }
113626
- for (var _d = 0, types_24 = types; _d < types_24.length; _d++) {
113627
- var directive = types_24[_d];
113690
+ for (var _d = 0, types_23 = types; _d < types_23.length; _d++) {
113691
+ var directive = types_23[_d];
113628
113692
  var pos = writer.getTextPos();
113629
113693
  var resolutionMode = directive.resolutionMode && directive.resolutionMode !== (currentSourceFile === null || currentSourceFile === void 0 ? void 0 : currentSourceFile.impliedNodeFormat)
113630
113694
  ? "resolution-mode=\"" + (directive.resolutionMode === ts.ModuleKind.ESNext ? "import" : "require") + "\""
@@ -122415,7 +122479,7 @@ var ts;
122415
122479
  });
122416
122480
  // Sort by paths closest to importing file Name directory
122417
122481
  var sortedPaths = [];
122418
- var _loop_33 = function (directory) {
122482
+ var _loop_34 = function (directory) {
122419
122483
  var directoryStart = ts.ensureTrailingDirectorySeparator(directory);
122420
122484
  var pathsInDirectory;
122421
122485
  allFileNames.forEach(function (_a, fileName) {
@@ -122439,9 +122503,9 @@ var ts;
122439
122503
  };
122440
122504
  var out_directory_1;
122441
122505
  for (var directory = ts.getDirectoryPath(importingFileName); allFileNames.size !== 0;) {
122442
- var state_10 = _loop_33(directory);
122506
+ var state_11 = _loop_34(directory);
122443
122507
  directory = out_directory_1;
122444
- if (state_10 === "break")
122508
+ if (state_11 === "break")
122445
122509
  break;
122446
122510
  }
122447
122511
  if (allFileNames.size) {