@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.
@@ -294,7 +294,7 @@ var ts;
294
294
  // The following is baselined as a literal template type without intervention
295
295
  /** The version of the TypeScript compiler release */
296
296
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
297
- ts.version = ts.versionMajorMinor + ".0-insiders.20220527";
297
+ ts.version = ts.versionMajorMinor + ".0-insiders.20220601";
298
298
  /* @internal */
299
299
  var Comparison;
300
300
  (function (Comparison) {
@@ -5298,6 +5298,11 @@ var ts;
5298
5298
  // Flags that require TypeFlags.Union
5299
5299
  /* @internal */
5300
5300
  ObjectFlags[ObjectFlags["ContainsIntersections"] = 16777216] = "ContainsIntersections";
5301
+ /* @internal */
5302
+ ObjectFlags[ObjectFlags["IsUnknownLikeUnionComputed"] = 33554432] = "IsUnknownLikeUnionComputed";
5303
+ /* @internal */
5304
+ ObjectFlags[ObjectFlags["IsUnknownLikeUnion"] = 67108864] = "IsUnknownLikeUnion";
5305
+ /* @internal */
5301
5306
  // Flags that require TypeFlags.Intersection
5302
5307
  /* @internal */
5303
5308
  ObjectFlags[ObjectFlags["IsNeverIntersectionComputed"] = 16777216] = "IsNeverIntersectionComputed";
@@ -8622,6 +8627,7 @@ var ts;
8622
8627
  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),
8623
8628
  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."),
8624
8629
  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."),
8630
+ 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."),
8625
8631
  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."),
8626
8632
  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."),
8627
8633
  Duplicate_identifier_0: diag(2300, ts.DiagnosticCategory.Error, "Duplicate_identifier_0_2300", "Duplicate identifier '{0}'."),
@@ -9107,6 +9113,7 @@ var ts;
9107
9113
  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."),
9108
9114
  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."),
9109
9115
  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."),
9116
+ 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"),
9110
9117
  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}'."),
9111
9118
  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}'."),
9112
9119
  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}'."),
@@ -44470,8 +44477,8 @@ var ts;
44470
44477
  var pathAndExtension = loadModuleFromFile(extensions, candidate, onlyRecordFailures, state) ||
44471
44478
  loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageInfo && packageInfo.packageJsonContent, packageInfo && packageInfo.versionPaths);
44472
44479
  if (!pathAndExtension && packageInfo
44473
- && packageInfo.packageJsonContent.exports === undefined
44474
- && packageInfo.packageJsonContent.main === undefined
44480
+ // eslint-disable-next-line no-null/no-null
44481
+ && (packageInfo.packageJsonContent.exports === undefined || packageInfo.packageJsonContent.exports === null)
44475
44482
  && state.features & NodeResolutionFeatures.EsmMode) {
44476
44483
  // EsmMode disables index lookup in `loadNodeModuleFromDirectoryWorker` generally, however non-relative package resolutions still assume
44477
44484
  // a default `index.js` entrypoint if no `main` or `exports` are present
@@ -48136,7 +48143,10 @@ var ts;
48136
48143
  TypeFacts[TypeFacts["NEUndefinedOrNull"] = 2097152] = "NEUndefinedOrNull";
48137
48144
  TypeFacts[TypeFacts["Truthy"] = 4194304] = "Truthy";
48138
48145
  TypeFacts[TypeFacts["Falsy"] = 8388608] = "Falsy";
48139
- TypeFacts[TypeFacts["All"] = 16777215] = "All";
48146
+ TypeFacts[TypeFacts["IsUndefined"] = 16777216] = "IsUndefined";
48147
+ TypeFacts[TypeFacts["IsNull"] = 33554432] = "IsNull";
48148
+ TypeFacts[TypeFacts["IsUndefinedOrNull"] = 50331648] = "IsUndefinedOrNull";
48149
+ TypeFacts[TypeFacts["All"] = 134217727] = "All";
48140
48150
  // The following members encode facts about particular kinds of types for use in the getTypeFacts function.
48141
48151
  // The presence of a particular fact means that the given test is true for some (and possibly all) values
48142
48152
  // of that kind of type.
@@ -48178,14 +48188,16 @@ var ts;
48178
48188
  TypeFacts[TypeFacts["ObjectFacts"] = 16736160] = "ObjectFacts";
48179
48189
  TypeFacts[TypeFacts["FunctionStrictFacts"] = 7880640] = "FunctionStrictFacts";
48180
48190
  TypeFacts[TypeFacts["FunctionFacts"] = 16728000] = "FunctionFacts";
48181
- TypeFacts[TypeFacts["UndefinedFacts"] = 9830144] = "UndefinedFacts";
48182
- TypeFacts[TypeFacts["NullFacts"] = 9363232] = "NullFacts";
48183
- TypeFacts[TypeFacts["EmptyObjectStrictFacts"] = 16318463] = "EmptyObjectStrictFacts";
48191
+ TypeFacts[TypeFacts["VoidFacts"] = 9830144] = "VoidFacts";
48192
+ TypeFacts[TypeFacts["UndefinedFacts"] = 26607360] = "UndefinedFacts";
48193
+ TypeFacts[TypeFacts["NullFacts"] = 42917664] = "NullFacts";
48194
+ TypeFacts[TypeFacts["EmptyObjectStrictFacts"] = 83427327] = "EmptyObjectStrictFacts";
48195
+ TypeFacts[TypeFacts["EmptyObjectFacts"] = 83886079] = "EmptyObjectFacts";
48196
+ TypeFacts[TypeFacts["UnknownFacts"] = 83886079] = "UnknownFacts";
48184
48197
  TypeFacts[TypeFacts["AllTypeofNE"] = 556800] = "AllTypeofNE";
48185
- TypeFacts[TypeFacts["EmptyObjectFacts"] = 16777215] = "EmptyObjectFacts";
48186
48198
  // Masks
48187
48199
  TypeFacts[TypeFacts["OrFactsMask"] = 8256] = "OrFactsMask";
48188
- TypeFacts[TypeFacts["AndFactsMask"] = 16768959] = "AndFactsMask";
48200
+ TypeFacts[TypeFacts["AndFactsMask"] = 134209471] = "AndFactsMask";
48189
48201
  })(TypeFacts || (TypeFacts = {}));
48190
48202
  var typeofEQFacts = new ts.Map(ts.getEntries({
48191
48203
  string: 1 /* TypeofEQString */,
@@ -48849,6 +48861,7 @@ var ts;
48849
48861
  var emptyTypeLiteralSymbol = createSymbol(2048 /* TypeLiteral */, "__type" /* Type */);
48850
48862
  emptyTypeLiteralSymbol.members = ts.createSymbolTable();
48851
48863
  var emptyTypeLiteralType = createAnonymousType(emptyTypeLiteralSymbol, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
48864
+ var unknownUnionType = strictNullChecks ? getUnionType([undefinedType, nullType, createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray)]) : unknownType;
48852
48865
  var emptyGenericType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
48853
48866
  emptyGenericType.instantiations = new ts.Map();
48854
48867
  var anyFunctionType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
@@ -50348,7 +50361,12 @@ var ts;
50348
50361
  function checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning) {
50349
50362
  if (meaning & (111551 /* Value */ & ~1024 /* NamespaceModule */)) {
50350
50363
  if (isPrimitiveTypeName(name)) {
50351
- error(errorLocation, ts.Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here, ts.unescapeLeadingUnderscores(name));
50364
+ if (isExtendedByInterface(errorLocation)) {
50365
+ 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));
50366
+ }
50367
+ else {
50368
+ error(errorLocation, ts.Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here, ts.unescapeLeadingUnderscores(name));
50369
+ }
50352
50370
  return true;
50353
50371
  }
50354
50372
  var symbol = resolveSymbol(resolveName(errorLocation, name, 788968 /* Type */ & ~111551 /* Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false));
@@ -50368,6 +50386,16 @@ var ts;
50368
50386
  }
50369
50387
  return false;
50370
50388
  }
50389
+ function isExtendedByInterface(node) {
50390
+ var grandparent = node.parent.parent;
50391
+ var parentOfGrandparent = grandparent.parent;
50392
+ if (grandparent && parentOfGrandparent) {
50393
+ var isExtending = ts.isHeritageClause(grandparent) && grandparent.token === 94 /* ExtendsKeyword */;
50394
+ var isInterface = ts.isInterfaceDeclaration(parentOfGrandparent);
50395
+ return isExtending && isInterface;
50396
+ }
50397
+ return false;
50398
+ }
50371
50399
  function maybeMappedType(node, symbol) {
50372
50400
  var container = ts.findAncestor(node.parent, function (n) {
50373
50401
  return ts.isComputedPropertyName(n) || ts.isPropertySignature(n) ? false : ts.isTypeLiteralNode(n) || "quit";
@@ -53208,7 +53236,7 @@ var ts;
53208
53236
  anyType : getNonMissingTypeOfSymbol(propertySymbol);
53209
53237
  var saveEnclosingDeclaration = context.enclosingDeclaration;
53210
53238
  context.enclosingDeclaration = undefined;
53211
- if (context.tracker.trackSymbol && ts.getCheckFlags(propertySymbol) & 4096 /* Late */ && isLateBoundName(propertySymbol.escapedName)) {
53239
+ if (context.tracker.trackSymbol && isLateBoundName(propertySymbol.escapedName)) {
53212
53240
  if (propertySymbol.declarations) {
53213
53241
  var decl = ts.first(propertySymbol.declarations);
53214
53242
  if (hasLateBindableName(decl)) {
@@ -54892,7 +54920,7 @@ var ts;
54892
54920
  ? getBaseConstructorTypeOfClass(staticType)
54893
54921
  : anyType;
54894
54922
  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);
54895
- var symbolProps = getNonInterhitedProperties(classType, baseTypes, getPropertiesOfType(classType));
54923
+ var symbolProps = getNonInheritedProperties(classType, baseTypes, getPropertiesOfType(classType));
54896
54924
  var publicSymbolProps = ts.filter(symbolProps, function (s) {
54897
54925
  // `valueDeclaration` could be undefined if inherited from
54898
54926
  // a union/intersection base type, but inherited properties
@@ -56030,7 +56058,7 @@ var ts;
56030
56058
  if (ts.getEffectiveTypeAnnotationNode(ts.walkUpBindingElementsAndPatterns(declaration))) {
56031
56059
  // In strict null checking mode, if a default value of a non-undefined type is specified, remove
56032
56060
  // undefined from the final type.
56033
- return strictNullChecks && !(getFalsyFlags(checkDeclarationInitializer(declaration, 0 /* Normal */)) & 32768 /* Undefined */) ? getNonUndefinedType(type) : type;
56061
+ return strictNullChecks && !(getTypeFacts(checkDeclarationInitializer(declaration, 0 /* Normal */)) & 16777216 /* IsUndefined */) ? getNonUndefinedType(type) : type;
56034
56062
  }
56035
56063
  return widenTypeInferredFromInitializer(declaration, getUnionType([getNonUndefinedType(type), checkDeclarationInitializer(declaration, 0 /* Normal */)], 2 /* Subtype */));
56036
56064
  }
@@ -59019,7 +59047,7 @@ var ts;
59019
59047
  }
59020
59048
  }
59021
59049
  }
59022
- else if (t.flags & 469892092 /* DisjointDomains */) {
59050
+ else if (t.flags & 469892092 /* DisjointDomains */ || isEmptyAnonymousObjectType(t)) {
59023
59051
  hasDisjointDomainType = true;
59024
59052
  }
59025
59053
  }
@@ -59031,7 +59059,7 @@ var ts;
59031
59059
  // intersection operation to reduce the union constraints.
59032
59060
  for (var _a = 0, types_6 = types; _a < types_6.length; _a++) {
59033
59061
  var t = types_6[_a];
59034
- if (t.flags & 469892092 /* DisjointDomains */) {
59062
+ if (t.flags & 469892092 /* DisjointDomains */ || isEmptyAnonymousObjectType(t)) {
59035
59063
  constraints = ts.append(constraints, t);
59036
59064
  }
59037
59065
  }
@@ -59233,7 +59261,7 @@ var ts;
59233
59261
  var objectType;
59234
59262
  return !!(type.flags & 8388608 /* IndexedAccess */ && ts.getObjectFlags(objectType = type.objectType) & 32 /* Mapped */ &&
59235
59263
  !isGenericMappedType(objectType) && isGenericIndexType(type.indexType) &&
59236
- !objectType.declaration.questionToken && !objectType.declaration.nameType);
59264
+ !(getMappedTypeModifiers(objectType) & 8 /* ExcludeOptional */) && !objectType.declaration.nameType);
59237
59265
  }
59238
59266
  /**
59239
59267
  * For a type parameter, return the base constraint of the type parameter. For the string, number,
@@ -61580,7 +61608,7 @@ var ts;
61580
61608
  }
61581
61609
  return includes;
61582
61610
  }
61583
- function removeRedundantPrimitiveTypes(types, includes) {
61611
+ function removeRedundantSupertypes(types, includes) {
61584
61612
  var i = types.length;
61585
61613
  while (i > 0) {
61586
61614
  i--;
@@ -61588,7 +61616,9 @@ var ts;
61588
61616
  var remove = t.flags & 4 /* String */ && includes & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) ||
61589
61617
  t.flags & 8 /* Number */ && includes & 256 /* NumberLiteral */ ||
61590
61618
  t.flags & 64 /* BigInt */ && includes & 2048 /* BigIntLiteral */ ||
61591
- t.flags & 4096 /* ESSymbol */ && includes & 8192 /* UniqueESSymbol */;
61619
+ t.flags & 4096 /* ESSymbol */ && includes & 8192 /* UniqueESSymbol */ ||
61620
+ t.flags & 16384 /* Void */ && includes & 32768 /* Undefined */ ||
61621
+ isEmptyAnonymousObjectType(t) && includes & 470302716 /* DefinitelyNonNullable */;
61592
61622
  if (remove) {
61593
61623
  ts.orderedRemoveItemAt(types, i);
61594
61624
  }
@@ -61710,7 +61740,7 @@ var ts;
61710
61740
  // a type alias of the form "type List<T> = T & { next: List<T> }" cannot be reduced during its declaration.
61711
61741
  // Also, unlike union types, the order of the constituent types is preserved in order that overload resolution
61712
61742
  // for intersections of types with signatures can be deterministic.
61713
- function getIntersectionType(types, aliasSymbol, aliasTypeArguments) {
61743
+ function getIntersectionType(types, aliasSymbol, aliasTypeArguments, noSupertypeReduction) {
61714
61744
  var typeMembershipMap = new ts.Map();
61715
61745
  var includes = addTypesToIntersection(typeMembershipMap, 0, types);
61716
61746
  var typeSet = ts.arrayFrom(typeMembershipMap.values());
@@ -61747,11 +61777,11 @@ var ts;
61747
61777
  if (includes & 4 /* String */ && includes & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) ||
61748
61778
  includes & 8 /* Number */ && includes & 256 /* NumberLiteral */ ||
61749
61779
  includes & 64 /* BigInt */ && includes & 2048 /* BigIntLiteral */ ||
61750
- includes & 4096 /* ESSymbol */ && includes & 8192 /* UniqueESSymbol */) {
61751
- removeRedundantPrimitiveTypes(typeSet, includes);
61752
- }
61753
- if (includes & 16777216 /* IncludesEmptyObject */ && includes & 524288 /* Object */) {
61754
- ts.orderedRemoveItemAt(typeSet, ts.findIndex(typeSet, isEmptyAnonymousObjectType));
61780
+ includes & 4096 /* ESSymbol */ && includes & 8192 /* UniqueESSymbol */ ||
61781
+ includes & 16384 /* Void */ && includes & 32768 /* Undefined */ ||
61782
+ includes & 16777216 /* IncludesEmptyObject */ && includes & 470302716 /* DefinitelyNonNullable */) {
61783
+ if (!noSupertypeReduction)
61784
+ removeRedundantSupertypes(typeSet, includes);
61755
61785
  }
61756
61786
  if (includes & 262144 /* IncludesMissingType */) {
61757
61787
  typeSet[typeSet.indexOf(undefinedType)] = missingType;
@@ -61790,8 +61820,9 @@ var ts;
61790
61820
  }
61791
61821
  var constituents = getCrossProductIntersections(typeSet);
61792
61822
  // We attach a denormalized origin type when at least one constituent of the cross-product union is an
61793
- // intersection (i.e. when the intersection didn't just reduce one or more unions to smaller unions).
61794
- var origin = ts.some(constituents, function (t) { return !!(t.flags & 2097152 /* Intersection */); }) ? createOriginUnionOrIntersectionType(2097152 /* Intersection */, typeSet) : undefined;
61823
+ // intersection (i.e. when the intersection didn't just reduce one or more unions to smaller unions) and
61824
+ // the denormalized origin has fewer constituents than the union itself.
61825
+ var origin = ts.some(constituents, function (t) { return !!(t.flags & 2097152 /* Intersection */); }) && getConstituentCountOfTypes(constituents) > getConstituentCountOfTypes(typeSet) ? createOriginUnionOrIntersectionType(2097152 /* Intersection */, typeSet) : undefined;
61795
61826
  result = getUnionType(constituents, 1 /* Literal */, aliasSymbol, aliasTypeArguments, origin);
61796
61827
  }
61797
61828
  }
@@ -61834,11 +61865,21 @@ var ts;
61834
61865
  }
61835
61866
  return intersections;
61836
61867
  }
61868
+ function getConstituentCount(type) {
61869
+ return !(type.flags & 3145728 /* UnionOrIntersection */) || type.aliasSymbol ? 1 :
61870
+ type.flags & 1048576 /* Union */ && type.origin ? getConstituentCount(type.origin) :
61871
+ getConstituentCountOfTypes(type.types);
61872
+ }
61873
+ function getConstituentCountOfTypes(types) {
61874
+ return ts.reduceLeft(types, function (n, t) { return n + getConstituentCount(t); }, 0);
61875
+ }
61837
61876
  function getTypeFromIntersectionTypeNode(node) {
61838
61877
  var links = getNodeLinks(node);
61839
61878
  if (!links.resolvedType) {
61840
61879
  var aliasSymbol = getAliasSymbolForTypeNode(node);
61841
- links.resolvedType = getIntersectionType(ts.map(node.types, getTypeFromTypeNode), aliasSymbol, getTypeArgumentsForAliasSymbol(aliasSymbol));
61880
+ var types = ts.map(node.types, getTypeFromTypeNode);
61881
+ var noSupertypeReduction = types.length === 2 && !!(types[0].flags & (4 /* String */ | 8 /* Number */ | 64 /* BigInt */)) && types[1] === emptyTypeLiteralType;
61882
+ links.resolvedType = getIntersectionType(types, aliasSymbol, getTypeArgumentsForAliasSymbol(aliasSymbol), noSupertypeReduction);
61842
61883
  }
61843
61884
  return links.resolvedType;
61844
61885
  }
@@ -64512,7 +64553,7 @@ var ts;
64512
64553
  var sourceSig = checkMode & 3 /* Callback */ ? undefined : getSingleCallSignature(getNonNullableType(sourceType));
64513
64554
  var targetSig = checkMode & 3 /* Callback */ ? undefined : getSingleCallSignature(getNonNullableType(targetType));
64514
64555
  var callbacks = sourceSig && targetSig && !getTypePredicateOfSignature(sourceSig) && !getTypePredicateOfSignature(targetSig) &&
64515
- (getFalsyFlags(sourceType) & 98304 /* Nullable */) === (getFalsyFlags(targetType) & 98304 /* Nullable */);
64556
+ (getTypeFacts(sourceType) & 50331648 /* IsUndefinedOrNull */) === (getTypeFacts(targetType) & 50331648 /* IsUndefinedOrNull */);
64516
64557
  var related = callbacks ?
64517
64558
  compareSignaturesRelated(targetSig, sourceSig, (checkMode & 8 /* StrictArity */) | (strictVariance ? 2 /* StrictCallback */ : 1 /* BivariantCallback */), reportErrors, errorReporter, incompatibleErrorReporter, compareTypes, reportUnreliableMarkers) :
64518
64559
  !(checkMode & 3 /* Callback */) && !strictVariance && compareTypes(sourceType, targetType, /*reportErrors*/ false) || compareTypes(targetType, sourceType, reportErrors);
@@ -64624,6 +64665,17 @@ var ts;
64624
64665
  return !!(ts.getObjectFlags(type) & 16 /* Anonymous */ && (type.members && isEmptyResolvedType(type) ||
64625
64666
  type.symbol && type.symbol.flags & 2048 /* TypeLiteral */ && getMembersOfSymbol(type.symbol).size === 0));
64626
64667
  }
64668
+ function isUnknownLikeUnionType(type) {
64669
+ if (strictNullChecks && type.flags & 1048576 /* Union */) {
64670
+ if (!(type.objectFlags & 33554432 /* IsUnknownLikeUnionComputed */)) {
64671
+ var types = type.types;
64672
+ type.objectFlags |= 33554432 /* IsUnknownLikeUnionComputed */ | (types.length >= 3 && types[0].flags & 32768 /* Undefined */ &&
64673
+ types[1].flags & 65536 /* Null */ && ts.some(types, isEmptyAnonymousObjectType) ? 67108864 /* IsUnknownLikeUnion */ : 0);
64674
+ }
64675
+ return !!(type.objectFlags & 67108864 /* IsUnknownLikeUnion */);
64676
+ }
64677
+ return false;
64678
+ }
64627
64679
  function isStringIndexSignatureOnlyType(type) {
64628
64680
  return type.flags & 524288 /* Object */ && !isGenericMappedType(type) && getPropertiesOfType(type).length === 0 && getIndexInfosOfType(type).length === 1 && !!getIndexInfoOfType(type, stringType) ||
64629
64681
  type.flags & 3145728 /* UnionOrIntersection */ && ts.every(type.types, isStringIndexSignatureOnlyType) ||
@@ -64703,7 +64755,7 @@ var ts;
64703
64755
  return true;
64704
64756
  if (s & 65536 /* Null */ && (!strictNullChecks && !(t & 3145728 /* UnionOrIntersection */) || t & 65536 /* Null */))
64705
64757
  return true;
64706
- if (s & 524288 /* Object */ && t & 67108864 /* NonPrimitive */)
64758
+ if (s & 524288 /* Object */ && t & 67108864 /* NonPrimitive */ && !(relation === strictSubtypeRelation && isEmptyAnonymousObjectType(source)))
64707
64759
  return true;
64708
64760
  if (relation === assignableRelation || relation === comparableRelation) {
64709
64761
  if (s & 1 /* Any */)
@@ -64713,6 +64765,9 @@ var ts;
64713
64765
  // bit-flag enum types sometimes look like literal enum types with numeric literal values.
64714
64766
  if (s & (8 /* Number */ | 256 /* NumberLiteral */) && !(s & 1024 /* EnumLiteral */) && (t & 32 /* Enum */ || relation === assignableRelation && t & 256 /* NumberLiteral */ && t & 1024 /* EnumLiteral */))
64715
64767
  return true;
64768
+ // Anything is assignable to a union containing undefined, null, and {}
64769
+ if (isUnknownLikeUnionType(target))
64770
+ return true;
64716
64771
  }
64717
64772
  return false;
64718
64773
  }
@@ -64755,16 +64810,27 @@ var ts;
64755
64810
  function getNormalizedType(type, writing) {
64756
64811
  while (true) {
64757
64812
  var t = isFreshLiteralType(type) ? type.regularType :
64758
- ts.getObjectFlags(type) & 4 /* Reference */ && type.node ? createTypeReference(type.target, getTypeArguments(type)) :
64759
- type.flags & 3145728 /* UnionOrIntersection */ ? getReducedType(type) :
64813
+ ts.getObjectFlags(type) & 4 /* Reference */ ? type.node ? createTypeReference(type.target, getTypeArguments(type)) : getSingleBaseForNonAugmentingSubtype(type) || type :
64814
+ type.flags & 3145728 /* UnionOrIntersection */ ? getNormalizedUnionOrIntersectionType(type, writing) :
64760
64815
  type.flags & 33554432 /* Substitution */ ? writing ? type.baseType : type.substitute :
64761
64816
  type.flags & 25165824 /* Simplifiable */ ? getSimplifiedType(type, writing) :
64762
64817
  type;
64763
- t = getSingleBaseForNonAugmentingSubtype(t) || t;
64764
64818
  if (t === type)
64765
- break;
64819
+ return t;
64766
64820
  type = t;
64767
64821
  }
64822
+ }
64823
+ function getNormalizedUnionOrIntersectionType(type, writing) {
64824
+ var reduced = getReducedType(type);
64825
+ if (reduced !== type) {
64826
+ return reduced;
64827
+ }
64828
+ if (type.flags & 2097152 /* Intersection */) {
64829
+ var normalizedTypes = ts.sameMap(type.types, function (t) { return getNormalizedType(t, writing); });
64830
+ if (normalizedTypes !== type.types) {
64831
+ return getIntersectionType(normalizedTypes);
64832
+ }
64833
+ }
64768
64834
  return type;
64769
64835
  }
64770
64836
  /**
@@ -65211,6 +65277,7 @@ var ts;
65211
65277
  return 0 /* False */;
65212
65278
  }
65213
65279
  function reportErrorResults(originalSource, originalTarget, source, target, headMessage) {
65280
+ var _a, _b;
65214
65281
  var sourceHasBase = !!getSingleBaseForNonAugmentingSubtype(originalSource);
65215
65282
  var targetHasBase = !!getSingleBaseForNonAugmentingSubtype(originalTarget);
65216
65283
  source = (originalSource.aliasSymbol || sourceHasBase) ? originalSource : source;
@@ -65251,6 +65318,9 @@ var ts;
65251
65318
  return;
65252
65319
  }
65253
65320
  reportRelationError(headMessage, source, target);
65321
+ 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 */))) {
65322
+ associateRelatedInfo(ts.createDiagnosticForNode(source.symbol.declarations[0], ts.Diagnostics.This_type_parameter_probably_needs_an_extends_object_constraint));
65323
+ }
65254
65324
  }
65255
65325
  function traceUnionsOrIntersectionsTooLarge(source, target) {
65256
65326
  if (!ts.tracing) {
@@ -66037,13 +66107,6 @@ var ts;
66037
66107
  // IndexedAccess comparisons are handled above in the `targetFlags & TypeFlage.IndexedAccess` branch
66038
66108
  if (!(sourceFlags & 8388608 /* IndexedAccess */ && targetFlags & 8388608 /* IndexedAccess */)) {
66039
66109
  var constraint = getConstraintOfType(source) || unknownType;
66040
- if (!getConstraintOfType(source) || (sourceFlags & 262144 /* TypeParameter */ && constraint.flags & 1 /* Any */)) {
66041
- // A type variable with no constraint is not related to the non-primitive object type.
66042
- if (result = isRelatedTo(emptyObjectType, extractTypesOfKind(target, ~67108864 /* NonPrimitive */), 3 /* Both */)) {
66043
- resetErrorInfo(saveErrorInfo);
66044
- return result;
66045
- }
66046
- }
66047
66110
  // 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
66048
66111
  if (result = isRelatedTo(constraint, target, 1 /* Source */, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState)) {
66049
66112
  resetErrorInfo(saveErrorInfo);
@@ -67517,9 +67580,11 @@ var ts;
67517
67580
  return getSupertypeOrUnion(types);
67518
67581
  }
67519
67582
  var primaryTypes = ts.filter(types, function (t) { return !(t.flags & 98304 /* Nullable */); });
67520
- return primaryTypes.length ?
67521
- getNullableType(getSupertypeOrUnion(primaryTypes), getFalsyFlagsOfTypes(types) & 98304 /* Nullable */) :
67522
- getUnionType(types, 2 /* Subtype */);
67583
+ if (primaryTypes.length) {
67584
+ var supertypeOrUnion = getSupertypeOrUnion(primaryTypes);
67585
+ return primaryTypes === types ? supertypeOrUnion : getUnionType(__spreadArray([supertypeOrUnion], ts.filter(types, function (t) { return !!(t.flags & 98304 /* Nullable */); }), true));
67586
+ }
67587
+ return getUnionType(types, 2 /* Subtype */);
67523
67588
  }
67524
67589
  // Return the leftmost type for which no type to the right is a subtype.
67525
67590
  function getCommonSubtype(types) {
@@ -67706,29 +67771,8 @@ var ts;
67706
67771
  var value = _a.value;
67707
67772
  return value.base10Value === "0";
67708
67773
  }
67709
- function getFalsyFlagsOfTypes(types) {
67710
- var result = 0;
67711
- for (var _i = 0, types_14 = types; _i < types_14.length; _i++) {
67712
- var t = types_14[_i];
67713
- result |= getFalsyFlags(t);
67714
- }
67715
- return result;
67716
- }
67717
- // Returns the String, Number, Boolean, StringLiteral, NumberLiteral, BooleanLiteral, Void, Undefined, or Null
67718
- // flags for the string, number, boolean, "", 0, false, void, undefined, or null types respectively. Returns
67719
- // no flags for all other types (including non-falsy literal types).
67720
- function getFalsyFlags(type) {
67721
- return type.flags & 1048576 /* Union */ ? getFalsyFlagsOfTypes(type.types) :
67722
- type.flags & 128 /* StringLiteral */ ? type.value === "" ? 128 /* StringLiteral */ : 0 :
67723
- type.flags & 256 /* NumberLiteral */ ? type.value === 0 ? 256 /* NumberLiteral */ : 0 :
67724
- type.flags & 2048 /* BigIntLiteral */ ? isZeroBigInt(type) ? 2048 /* BigIntLiteral */ : 0 :
67725
- type.flags & 512 /* BooleanLiteral */ ? (type === falseType || type === regularFalseType) ? 512 /* BooleanLiteral */ : 0 :
67726
- type.flags & 117724 /* PossiblyFalsy */;
67727
- }
67728
67774
  function removeDefinitelyFalsyTypes(type) {
67729
- return getFalsyFlags(type) & 117632 /* DefinitelyFalsy */ ?
67730
- filterType(type, function (t) { return !(getFalsyFlags(t) & 117632 /* DefinitelyFalsy */); }) :
67731
- type;
67775
+ return filterType(type, function (t) { return !!(getTypeFacts(t) & 4194304 /* Truthy */); });
67732
67776
  }
67733
67777
  function extractDefinitelyFalsyTypes(type) {
67734
67778
  return mapType(type, getDefinitelyFalsyPartOfType);
@@ -67763,20 +67807,15 @@ var ts;
67763
67807
  return type.flags & 32768 /* Undefined */ ? type : getUnionType([type, isProperty ? missingType : undefinedType]);
67764
67808
  }
67765
67809
  function getGlobalNonNullableTypeInstantiation(type) {
67766
- // First reduce away any constituents that are assignable to 'undefined' or 'null'. This not only eliminates
67767
- // 'undefined' and 'null', but also higher-order types such as a type parameter 'U extends undefined | null'
67768
- // that isn't eliminated by a NonNullable<T> instantiation.
67769
- var reducedType = getTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
67770
67810
  if (!deferredGlobalNonNullableTypeAlias) {
67771
67811
  deferredGlobalNonNullableTypeAlias = getGlobalSymbol("NonNullable", 524288 /* TypeAlias */, /*diagnostic*/ undefined) || unknownSymbol;
67772
67812
  }
67773
- // If the NonNullable<T> type is available, return an instantiation. Otherwise just return the reduced type.
67774
67813
  return deferredGlobalNonNullableTypeAlias !== unknownSymbol ?
67775
- getTypeAliasInstantiation(deferredGlobalNonNullableTypeAlias, [reducedType]) :
67776
- reducedType;
67814
+ getTypeAliasInstantiation(deferredGlobalNonNullableTypeAlias, [type]) :
67815
+ getIntersectionType([type, emptyObjectType]);
67777
67816
  }
67778
67817
  function getNonNullableType(type) {
67779
- return strictNullChecks ? getGlobalNonNullableTypeInstantiation(type) : type;
67818
+ return strictNullChecks ? getAdjustedTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */) : type;
67780
67819
  }
67781
67820
  function addOptionalTypeMarker(type) {
67782
67821
  return strictNullChecks ? getUnionType([type, optionalType]) : type;
@@ -68920,8 +68959,8 @@ var ts;
68920
68959
  }
68921
68960
  function getSingleTypeVariableFromIntersectionTypes(types) {
68922
68961
  var typeVariable;
68923
- for (var _i = 0, types_15 = types; _i < types_15.length; _i++) {
68924
- var type = types_15[_i];
68962
+ for (var _i = 0, types_14 = types; _i < types_14.length; _i++) {
68963
+ var type = types_14[_i];
68925
68964
  var t = type.flags & 2097152 /* Intersection */ && ts.find(type.types, function (t) { return !!getInferenceInfoForType(t); });
68926
68965
  if (!t || typeVariable && t !== typeVariable) {
68927
68966
  return undefined;
@@ -69674,8 +69713,8 @@ var ts;
69674
69713
  }
69675
69714
  }
69676
69715
  };
69677
- for (var _i = 0, types_16 = types; _i < types_16.length; _i++) {
69678
- var type = types_16[_i];
69716
+ for (var _i = 0, types_15 = types; _i < types_15.length; _i++) {
69717
+ var type = types_15[_i];
69679
69718
  var state_9 = _loop_24(type);
69680
69719
  if (typeof state_9 === "object")
69681
69720
  return state_9.value;
@@ -69790,14 +69829,16 @@ var ts;
69790
69829
  return !!(resolved.callSignatures.length || resolved.constructSignatures.length ||
69791
69830
  resolved.members.get("bind") && isTypeSubtypeOf(type, globalFunctionType));
69792
69831
  }
69793
- function getTypeFacts(type, ignoreObjects) {
69794
- if (ignoreObjects === void 0) { ignoreObjects = false; }
69832
+ function getTypeFacts(type) {
69833
+ if (type.flags & (2097152 /* Intersection */ | 465829888 /* Instantiable */)) {
69834
+ type = getBaseConstraintOfType(type) || unknownType;
69835
+ }
69795
69836
  var flags = type.flags;
69796
- if (flags & 4 /* String */) {
69837
+ if (flags & (4 /* String */ | 268435456 /* StringMapping */)) {
69797
69838
  return strictNullChecks ? 16317953 /* StringStrictFacts */ : 16776705 /* StringFacts */;
69798
69839
  }
69799
- if (flags & 128 /* StringLiteral */) {
69800
- var isEmpty = type.value === "";
69840
+ if (flags & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */)) {
69841
+ var isEmpty = flags & 128 /* StringLiteral */ && type.value === "";
69801
69842
  return strictNullChecks ?
69802
69843
  isEmpty ? 12123649 /* EmptyStringStrictFacts */ : 7929345 /* NonEmptyStringStrictFacts */ :
69803
69844
  isEmpty ? 12582401 /* EmptyStringFacts */ : 16776705 /* NonEmptyStringFacts */;
@@ -69829,20 +69870,20 @@ var ts;
69829
69870
  (type === falseType || type === regularFalseType) ? 12580616 /* FalseFacts */ : 16774920 /* TrueFacts */;
69830
69871
  }
69831
69872
  if (flags & 524288 /* Object */) {
69832
- if (ignoreObjects) {
69833
- return 16768959 /* AndFactsMask */; // This is the identity element for computing type facts of intersection.
69834
- }
69835
69873
  return ts.getObjectFlags(type) & 16 /* Anonymous */ && isEmptyObjectType(type) ?
69836
- strictNullChecks ? 16318463 /* EmptyObjectStrictFacts */ : 16777215 /* EmptyObjectFacts */ :
69874
+ strictNullChecks ? 83427327 /* EmptyObjectStrictFacts */ : 83886079 /* EmptyObjectFacts */ :
69837
69875
  isFunctionObjectType(type) ?
69838
69876
  strictNullChecks ? 7880640 /* FunctionStrictFacts */ : 16728000 /* FunctionFacts */ :
69839
69877
  strictNullChecks ? 7888800 /* ObjectStrictFacts */ : 16736160 /* ObjectFacts */;
69840
69878
  }
69841
- if (flags & (16384 /* Void */ | 32768 /* Undefined */)) {
69842
- return 9830144 /* UndefinedFacts */;
69879
+ if (flags & 16384 /* Void */) {
69880
+ return 9830144 /* VoidFacts */;
69881
+ }
69882
+ if (flags & 32768 /* Undefined */) {
69883
+ return 26607360 /* UndefinedFacts */;
69843
69884
  }
69844
69885
  if (flags & 65536 /* Null */) {
69845
- return 9363232 /* NullFacts */;
69886
+ return 42917664 /* NullFacts */;
69846
69887
  }
69847
69888
  if (flags & 12288 /* ESSymbolLike */) {
69848
69889
  return strictNullChecks ? 7925520 /* SymbolStrictFacts */ : 16772880 /* SymbolFacts */;
@@ -69853,37 +69894,56 @@ var ts;
69853
69894
  if (flags & 131072 /* Never */) {
69854
69895
  return 0 /* None */;
69855
69896
  }
69856
- if (flags & 465829888 /* Instantiable */) {
69857
- return !isPatternLiteralType(type) ? getTypeFacts(getBaseConstraintOfType(type) || unknownType, ignoreObjects) :
69858
- strictNullChecks ? 7929345 /* NonEmptyStringStrictFacts */ : 16776705 /* NonEmptyStringFacts */;
69859
- }
69860
69897
  if (flags & 1048576 /* Union */) {
69861
- return ts.reduceLeft(type.types, function (facts, t) { return facts | getTypeFacts(t, ignoreObjects); }, 0 /* None */);
69898
+ return ts.reduceLeft(type.types, function (facts, t) { return facts | getTypeFacts(t); }, 0 /* None */);
69862
69899
  }
69863
69900
  if (flags & 2097152 /* Intersection */) {
69864
- // When an intersection contains a primitive type we ignore object type constituents as they are
69865
- // presumably type tags. For example, in string & { __kind__: "name" } we ignore the object type.
69866
- ignoreObjects || (ignoreObjects = maybeTypeOfKind(type, 131068 /* Primitive */));
69867
- return getIntersectionTypeFacts(type, ignoreObjects);
69901
+ return getIntersectionTypeFacts(type);
69868
69902
  }
69869
- return 16777215 /* All */;
69903
+ return 83886079 /* UnknownFacts */;
69870
69904
  }
69871
- function getIntersectionTypeFacts(type, ignoreObjects) {
69905
+ function getIntersectionTypeFacts(type) {
69906
+ // When an intersection contains a primitive type we ignore object type constituents as they are
69907
+ // presumably type tags. For example, in string & { __kind__: "name" } we ignore the object type.
69908
+ var ignoreObjects = maybeTypeOfKind(type, 131068 /* Primitive */);
69872
69909
  // When computing the type facts of an intersection type, certain type facts are computed as `and`
69873
69910
  // and others are computed as `or`.
69874
69911
  var oredFacts = 0 /* None */;
69875
- var andedFacts = 16777215 /* All */;
69912
+ var andedFacts = 134217727 /* All */;
69876
69913
  for (var _i = 0, _a = type.types; _i < _a.length; _i++) {
69877
69914
  var t = _a[_i];
69878
- var f = getTypeFacts(t, ignoreObjects);
69879
- oredFacts |= f;
69880
- andedFacts &= f;
69915
+ if (!(ignoreObjects && t.flags & 524288 /* Object */)) {
69916
+ var f = getTypeFacts(t);
69917
+ oredFacts |= f;
69918
+ andedFacts &= f;
69919
+ }
69881
69920
  }
69882
- return oredFacts & 8256 /* OrFactsMask */ | andedFacts & 16768959 /* AndFactsMask */;
69921
+ return oredFacts & 8256 /* OrFactsMask */ | andedFacts & 134209471 /* AndFactsMask */;
69883
69922
  }
69884
69923
  function getTypeWithFacts(type, include) {
69885
69924
  return filterType(type, function (t) { return (getTypeFacts(t) & include) !== 0; });
69886
69925
  }
69926
+ // This function is similar to getTypeWithFacts, except that in strictNullChecks mode it replaces type
69927
+ // unknown with the union {} | null | undefined (and reduces that accordingly), and it intersects remaining
69928
+ // instantiable types with {}, {} | null, or {} | undefined in order to remove null and/or undefined.
69929
+ function getAdjustedTypeWithFacts(type, facts) {
69930
+ var reduced = recombineUnknownType(getTypeWithFacts(strictNullChecks && type.flags & 2 /* Unknown */ ? unknownUnionType : type, facts));
69931
+ if (strictNullChecks) {
69932
+ switch (facts) {
69933
+ case 524288 /* NEUndefined */:
69934
+ 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; });
69935
+ case 1048576 /* NENull */:
69936
+ 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; });
69937
+ case 2097152 /* NEUndefinedOrNull */:
69938
+ case 4194304 /* Truthy */:
69939
+ return mapType(reduced, function (t) { return getTypeFacts(t) & 262144 /* EQUndefinedOrNull */ ? getGlobalNonNullableTypeInstantiation(t) : t; });
69940
+ }
69941
+ }
69942
+ return reduced;
69943
+ }
69944
+ function recombineUnknownType(type) {
69945
+ return type === unknownUnionType ? unknownType : type;
69946
+ }
69887
69947
  function getTypeWithDefault(type, defaultExpression) {
69888
69948
  return defaultExpression ?
69889
69949
  getUnionType([getNonUndefinedType(type), getTypeOfExpression(defaultExpression)]) :
@@ -70132,8 +70192,8 @@ var ts;
70132
70192
  var types = origin && origin.flags & 1048576 /* Union */ ? origin.types : type.types;
70133
70193
  var mappedTypes;
70134
70194
  var changed = false;
70135
- for (var _i = 0, types_17 = types; _i < types_17.length; _i++) {
70136
- var t = types_17[_i];
70195
+ for (var _i = 0, types_16 = types; _i < types_16.length; _i++) {
70196
+ var t = types_16[_i];
70137
70197
  var mapped = t.flags & 1048576 /* Union */ ? mapType(t, mapper, noReductions) : mapper(t);
70138
70198
  changed || (changed = t !== mapped);
70139
70199
  if (mapped) {
@@ -70219,8 +70279,8 @@ var ts;
70219
70279
  }
70220
70280
  function isEvolvingArrayTypeList(types) {
70221
70281
  var hasEvolvingArrayType = false;
70222
- for (var _i = 0, types_18 = types; _i < types_18.length; _i++) {
70223
- var t = types_18[_i];
70282
+ for (var _i = 0, types_17 = types; _i < types_17.length; _i++) {
70283
+ var t = types_17[_i];
70224
70284
  if (!(t.flags & 131072 /* Never */)) {
70225
70285
  if (!(ts.getObjectFlags(t) & 256 /* EvolvingArray */)) {
70226
70286
  return false;
@@ -70941,7 +71001,7 @@ var ts;
70941
71001
  if (isEvolvingArrayTypeList(types)) {
70942
71002
  return getEvolvingArrayType(getUnionType(ts.map(types, getElementTypeOfEvolvingArrayType)));
70943
71003
  }
70944
- var result = getUnionType(ts.sameMap(types, finalizeEvolvingArrayType), subtypeReduction);
71004
+ var result = recombineUnknownType(getUnionType(ts.sameMap(types, finalizeEvolvingArrayType), subtypeReduction));
70945
71005
  if (result !== declaredType && result.flags & declaredType.flags & 1048576 /* Union */ && ts.arraysEqual(result.types, declaredType.types)) {
70946
71006
  return declaredType;
70947
71007
  }
@@ -71043,11 +71103,10 @@ var ts;
71043
71103
  }
71044
71104
  function narrowTypeByTruthiness(type, expr, assumeTrue) {
71045
71105
  if (isMatchingReference(reference, expr)) {
71046
- return type.flags & 2 /* Unknown */ && assumeTrue ? nonNullUnknownType :
71047
- getTypeWithFacts(type, assumeTrue ? 4194304 /* Truthy */ : 8388608 /* Falsy */);
71106
+ return getAdjustedTypeWithFacts(type, assumeTrue ? 4194304 /* Truthy */ : 8388608 /* Falsy */);
71048
71107
  }
71049
71108
  if (strictNullChecks && assumeTrue && optionalChainContainsReference(expr, reference)) {
71050
- type = getTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
71109
+ type = getAdjustedTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
71051
71110
  }
71052
71111
  var access = getDiscriminantPropertyAccess(expr, type);
71053
71112
  if (access) {
@@ -71187,7 +71246,7 @@ var ts;
71187
71246
  // Note that we include any and unknown in the exclusion test because their domain includes null and undefined.
71188
71247
  var removeNullable = equalsOperator !== assumeTrue && everyType(valueType, function (t) { return !!(t.flags & nullableFlags); }) ||
71189
71248
  equalsOperator === assumeTrue && everyType(valueType, function (t) { return !(t.flags & (3 /* AnyOrUnknown */ | nullableFlags)); });
71190
- return removeNullable ? getTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */) : type;
71249
+ return removeNullable ? getAdjustedTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */) : type;
71191
71250
  }
71192
71251
  function narrowTypeByEquality(type, operator, value, assumeTrue) {
71193
71252
  if (type.flags & 1 /* Any */) {
@@ -71197,9 +71256,6 @@ var ts;
71197
71256
  assumeTrue = !assumeTrue;
71198
71257
  }
71199
71258
  var valueType = getTypeOfExpression(value);
71200
- if (assumeTrue && (type.flags & 2 /* Unknown */) && (operator === 34 /* EqualsEqualsToken */ || operator === 35 /* ExclamationEqualsToken */) && (valueType.flags & 65536 /* Null */)) {
71201
- return getUnionType([nullType, undefinedType]);
71202
- }
71203
71259
  if ((type.flags & 2 /* Unknown */) && assumeTrue && (operator === 36 /* EqualsEqualsEqualsToken */ || operator === 37 /* ExclamationEqualsEqualsToken */)) {
71204
71260
  if (valueType.flags & (131068 /* Primitive */ | 67108864 /* NonPrimitive */)) {
71205
71261
  return valueType;
@@ -71219,7 +71275,7 @@ var ts;
71219
71275
  valueType.flags & 65536 /* Null */ ?
71220
71276
  assumeTrue ? 131072 /* EQNull */ : 1048576 /* NENull */ :
71221
71277
  assumeTrue ? 65536 /* EQUndefined */ : 524288 /* NEUndefined */;
71222
- return type.flags & 2 /* Unknown */ && facts & (1048576 /* NENull */ | 2097152 /* NEUndefinedOrNull */) ? nonNullUnknownType : getTypeWithFacts(type, facts);
71278
+ return getAdjustedTypeWithFacts(type, facts);
71223
71279
  }
71224
71280
  if (assumeTrue) {
71225
71281
  var filterFn = operator === 34 /* EqualsEqualsToken */ ?
@@ -71240,24 +71296,18 @@ var ts;
71240
71296
  var target = getReferenceCandidate(typeOfExpr.expression);
71241
71297
  if (!isMatchingReference(reference, target)) {
71242
71298
  if (strictNullChecks && optionalChainContainsReference(target, reference) && assumeTrue === (literal.text !== "undefined")) {
71243
- return getTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
71299
+ return getAdjustedTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
71244
71300
  }
71245
71301
  return type;
71246
71302
  }
71247
71303
  if (type.flags & 1 /* Any */ && literal.text === "function") {
71248
71304
  return type;
71249
71305
  }
71250
- if (assumeTrue && type.flags & 2 /* Unknown */ && literal.text === "object") {
71251
- // The non-null unknown type is used to track whether a previous narrowing operation has removed the null type
71252
- // from the unknown type. For example, the expression `x && typeof x === 'object'` first narrows x to the non-null
71253
- // unknown type, and then narrows that to the non-primitive type.
71254
- return type === nonNullUnknownType ? nonPrimitiveType : getUnionType([nonPrimitiveType, nullType]);
71255
- }
71256
71306
  var facts = assumeTrue ?
71257
71307
  typeofEQFacts.get(literal.text) || 128 /* TypeofEQHostObject */ :
71258
71308
  typeofNEFacts.get(literal.text) || 32768 /* TypeofNEHostObject */;
71259
71309
  var impliedType = getImpliedTypeFromTypeofGuard(type, literal.text);
71260
- return getTypeWithFacts(assumeTrue && impliedType ? mapType(type, narrowUnionMemberByTypeof(impliedType)) : type, facts);
71310
+ return getTypeWithFacts(assumeTrue && impliedType ? narrowTypeByImpliedType(type, impliedType) : type, facts);
71261
71311
  }
71262
71312
  function narrowTypeBySwitchOptionalChainContainment(type, switchStatement, clauseStart, clauseEnd, clauseCheck) {
71263
71313
  var everyClauseChecks = clauseStart !== clauseEnd && ts.every(getSwitchClauseTypes(switchStatement).slice(clauseStart, clauseEnd), clauseCheck);
@@ -71306,10 +71356,10 @@ var ts;
71306
71356
  }
71307
71357
  function getImpliedTypeFromTypeofGuard(type, text) {
71308
71358
  switch (text) {
71359
+ case "object":
71360
+ return type.flags & 1 /* Any */ ? type : getUnionType([nullType, nonPrimitiveType]);
71309
71361
  case "function":
71310
71362
  return type.flags & 1 /* Any */ ? type : globalFunctionType;
71311
- case "object":
71312
- return type.flags & 2 /* Unknown */ ? getUnionType([nonPrimitiveType, nullType]) : type;
71313
71363
  default:
71314
71364
  return typeofTypesByName.get(text);
71315
71365
  }
@@ -71320,22 +71370,27 @@ var ts;
71320
71370
  // the guard. For example: narrowing `{} | undefined` by `"boolean"` should produce the type `boolean`, not
71321
71371
  // the filtered type `{}`. For this reason we narrow constituents of the union individually, in addition to
71322
71372
  // filtering by type-facts.
71323
- function narrowUnionMemberByTypeof(candidate) {
71324
- return function (type) {
71325
- if (isTypeSubtypeOf(type, candidate)) {
71326
- return type;
71327
- }
71328
- if (isTypeSubtypeOf(candidate, type)) {
71329
- return candidate;
71373
+ function narrowTypeByImpliedType(type, candidate) {
71374
+ if (type.flags & 3 /* AnyOrUnknown */) {
71375
+ return candidate;
71376
+ }
71377
+ return mapType(type, function (t) {
71378
+ if (isTypeRelatedTo(t, candidate, strictSubtypeRelation)) {
71379
+ return t;
71330
71380
  }
71331
- if (type.flags & 465829888 /* Instantiable */) {
71332
- var constraint = getBaseConstraintOfType(type) || anyType;
71333
- if (isTypeSubtypeOf(candidate, constraint)) {
71334
- return getIntersectionType([type, candidate]);
71381
+ return mapType(candidate, function (c) {
71382
+ if (!areTypesComparable(t, c)) {
71383
+ return neverType;
71335
71384
  }
71336
- }
71337
- return type;
71338
- };
71385
+ if (c.flags & 131068 /* Primitive */ && t.flags & 524288 /* Object */ && !isEmptyAnonymousObjectType(t)) {
71386
+ return isTypeSubtypeOf(c, t) ? c : neverType;
71387
+ }
71388
+ if (c === globalFunctionType && isTypeSubtypeOf(c, t)) {
71389
+ return c;
71390
+ }
71391
+ return getIntersectionType([t, c]);
71392
+ });
71393
+ });
71339
71394
  }
71340
71395
  function narrowBySwitchOnTypeOf(type, switchStatement, clauseStart, clauseEnd) {
71341
71396
  var switchWitnesses = getSwitchClauseTypeOfWitnesses(switchStatement, /*retainDefault*/ true);
@@ -71394,7 +71449,7 @@ var ts;
71394
71449
  because it is caught in the first clause.
71395
71450
  */
71396
71451
  var impliedType = getTypeWithFacts(getUnionType(clauseWitnesses.map(function (text) { return getImpliedTypeFromTypeofGuard(type, text) || type; })), switchFacts);
71397
- return getTypeWithFacts(mapType(type, narrowUnionMemberByTypeof(impliedType)), switchFacts);
71452
+ return getTypeWithFacts(narrowTypeByImpliedType(type, impliedType), switchFacts);
71398
71453
  }
71399
71454
  function isMatchingConstructorReference(expr) {
71400
71455
  return (ts.isPropertyAccessExpression(expr) && ts.idText(expr.name) === "constructor" ||
@@ -71445,7 +71500,7 @@ var ts;
71445
71500
  var left = getReferenceCandidate(expr.left);
71446
71501
  if (!isMatchingReference(reference, left)) {
71447
71502
  if (assumeTrue && strictNullChecks && optionalChainContainsReference(left, reference)) {
71448
- return getTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
71503
+ return getAdjustedTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
71449
71504
  }
71450
71505
  return type;
71451
71506
  }
@@ -71533,7 +71588,7 @@ var ts;
71533
71588
  }
71534
71589
  if (strictNullChecks && assumeTrue && optionalChainContainsReference(predicateArgument, reference) &&
71535
71590
  !(getTypeFacts(predicate.type) & 65536 /* EQUndefined */)) {
71536
- type = getTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
71591
+ type = getAdjustedTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
71537
71592
  }
71538
71593
  var access = getDiscriminantPropertyAccess(predicateArgument, type);
71539
71594
  if (access) {
@@ -71590,7 +71645,7 @@ var ts;
71590
71645
  }
71591
71646
  function narrowTypeByOptionality(type, expr, assumePresent) {
71592
71647
  if (isMatchingReference(reference, expr)) {
71593
- return getTypeWithFacts(type, assumePresent ? 2097152 /* NEUndefinedOrNull */ : 262144 /* EQUndefinedOrNull */);
71648
+ return getAdjustedTypeWithFacts(type, assumePresent ? 2097152 /* NEUndefinedOrNull */ : 262144 /* EQUndefinedOrNull */);
71594
71649
  }
71595
71650
  var access = getDiscriminantPropertyAccess(expr, type);
71596
71651
  if (access) {
@@ -71676,8 +71731,8 @@ var ts;
71676
71731
  var annotationIncludesUndefined = strictNullChecks &&
71677
71732
  declaration.kind === 164 /* Parameter */ &&
71678
71733
  declaration.initializer &&
71679
- getFalsyFlags(declaredType) & 32768 /* Undefined */ &&
71680
- !(getFalsyFlags(checkExpression(declaration.initializer)) & 32768 /* Undefined */);
71734
+ getTypeFacts(declaredType) & 16777216 /* IsUndefined */ &&
71735
+ !(getTypeFacts(checkExpression(declaration.initializer)) & 16777216 /* IsUndefined */);
71681
71736
  popTypeResolution();
71682
71737
  return annotationIncludesUndefined ? getTypeWithFacts(declaredType, 524288 /* NEUndefined */) : declaredType;
71683
71738
  }
@@ -71698,7 +71753,9 @@ var ts;
71698
71753
  !(someType(type, isGenericTypeWithoutNullableConstraint) && isGenericIndexType(getTypeOfExpression(parent.argumentExpression)));
71699
71754
  }
71700
71755
  function isGenericTypeWithUnionConstraint(type) {
71701
- return !!(type.flags & 465829888 /* Instantiable */ && getBaseConstraintOrType(type).flags & (98304 /* Nullable */ | 1048576 /* Union */));
71756
+ return type.flags & 2097152 /* Intersection */ ?
71757
+ ts.some(type.types, isGenericTypeWithUnionConstraint) :
71758
+ !!(type.flags & 465829888 /* Instantiable */ && getBaseConstraintOrType(type).flags & (98304 /* Nullable */ | 1048576 /* Union */));
71702
71759
  }
71703
71760
  function isGenericTypeWithoutNullableConstraint(type) {
71704
71761
  return !!(type.flags & 465829888 /* Instantiable */ && !maybeTypeOfKind(getBaseConstraintOrType(type), 98304 /* Nullable */));
@@ -71726,7 +71783,7 @@ var ts;
71726
71783
  var substituteConstraints = !(checkMode && checkMode & 2 /* Inferential */) &&
71727
71784
  someType(type, isGenericTypeWithUnionConstraint) &&
71728
71785
  (isConstraintPosition(type, reference) || hasContextualTypeWithNoGenericTypes(reference, checkMode));
71729
- return substituteConstraints ? mapType(type, function (t) { return t.flags & 465829888 /* Instantiable */ ? getBaseConstraintOrType(t) : t; }) : type;
71786
+ return substituteConstraints ? mapType(type, getBaseConstraintOrType) : type;
71730
71787
  }
71731
71788
  function isExportOrExportExpression(location) {
71732
71789
  return !!ts.findAncestor(location, function (n) {
@@ -72003,7 +72060,7 @@ var ts;
72003
72060
  return convertAutoToAny(flowType);
72004
72061
  }
72005
72062
  }
72006
- else if (!assumeInitialized && !(getFalsyFlags(type) & 32768 /* Undefined */) && getFalsyFlags(flowType) & 32768 /* Undefined */) {
72063
+ else if (!assumeInitialized && !(getTypeFacts(type) & 16777216 /* IsUndefined */) && getTypeFacts(flowType) & 16777216 /* IsUndefined */) {
72007
72064
  error(node, ts.Diagnostics.Variable_0_is_used_before_being_assigned, symbolToString(symbol));
72008
72065
  // Return the declared type to reduce follow-on errors
72009
72066
  return type;
@@ -73532,8 +73589,8 @@ var ts;
73532
73589
  }
73533
73590
  var signatureList;
73534
73591
  var types = type.types;
73535
- for (var _i = 0, types_19 = types; _i < types_19.length; _i++) {
73536
- var current = types_19[_i];
73592
+ for (var _i = 0, types_18 = types; _i < types_18.length; _i++) {
73593
+ var current = types_18[_i];
73537
73594
  var signature = getContextualCallSignature(current, node);
73538
73595
  if (signature) {
73539
73596
  if (!signatureList) {
@@ -74695,19 +74752,19 @@ var ts;
74695
74752
  return checkNonNullType(checkExpression(node), node);
74696
74753
  }
74697
74754
  function isNullableType(type) {
74698
- return !!((strictNullChecks ? getFalsyFlags(type) : type.flags) & 98304 /* Nullable */);
74755
+ return !!(getTypeFacts(type) & 50331648 /* IsUndefinedOrNull */);
74699
74756
  }
74700
74757
  function getNonNullableTypeIfNeeded(type) {
74701
74758
  return isNullableType(type) ? getNonNullableType(type) : type;
74702
74759
  }
74703
- function reportObjectPossiblyNullOrUndefinedError(node, flags) {
74704
- error(node, flags & 32768 /* Undefined */ ? flags & 65536 /* Null */ ?
74760
+ function reportObjectPossiblyNullOrUndefinedError(node, facts) {
74761
+ error(node, facts & 16777216 /* IsUndefined */ ? facts & 33554432 /* IsNull */ ?
74705
74762
  ts.Diagnostics.Object_is_possibly_null_or_undefined :
74706
74763
  ts.Diagnostics.Object_is_possibly_undefined :
74707
74764
  ts.Diagnostics.Object_is_possibly_null);
74708
74765
  }
74709
- function reportCannotInvokePossiblyNullOrUndefinedError(node, flags) {
74710
- error(node, flags & 32768 /* Undefined */ ? flags & 65536 /* Null */ ?
74766
+ function reportCannotInvokePossiblyNullOrUndefinedError(node, facts) {
74767
+ error(node, facts & 16777216 /* IsUndefined */ ? facts & 33554432 /* IsNull */ ?
74711
74768
  ts.Diagnostics.Cannot_invoke_an_object_which_is_possibly_null_or_undefined :
74712
74769
  ts.Diagnostics.Cannot_invoke_an_object_which_is_possibly_undefined :
74713
74770
  ts.Diagnostics.Cannot_invoke_an_object_which_is_possibly_null);
@@ -74717,9 +74774,9 @@ var ts;
74717
74774
  error(node, ts.Diagnostics.Object_is_of_type_unknown);
74718
74775
  return errorType;
74719
74776
  }
74720
- var kind = (strictNullChecks ? getFalsyFlags(type) : type.flags) & 98304 /* Nullable */;
74721
- if (kind) {
74722
- reportError(node, kind);
74777
+ var facts = getTypeFacts(type);
74778
+ if (facts & 50331648 /* IsUndefinedOrNull */) {
74779
+ reportError(node, facts);
74723
74780
  var t = getNonNullableType(type);
74724
74781
  return t.flags & (98304 /* Nullable */ | 131072 /* Never */) ? errorType : t;
74725
74782
  }
@@ -75014,7 +75071,7 @@ var ts;
75014
75071
  assumeUninitialized = true;
75015
75072
  }
75016
75073
  var flowType = getFlowTypeOfReference(node, propType, assumeUninitialized ? getOptionalType(propType) : propType);
75017
- if (assumeUninitialized && !(getFalsyFlags(propType) & 32768 /* Undefined */) && getFalsyFlags(flowType) & 32768 /* Undefined */) {
75074
+ if (assumeUninitialized && !(getTypeFacts(propType) & 16777216 /* IsUndefined */) && getTypeFacts(flowType) & 16777216 /* IsUndefined */) {
75018
75075
  error(errorNode, ts.Diagnostics.Property_0_is_used_before_being_assigned, symbolToString(prop)); // TODO: GH#18217
75019
75076
  // Return the declared type to reduce follow-on errors
75020
75077
  return propType;
@@ -76930,8 +76987,8 @@ var ts;
76930
76987
  if (apparentType.flags & 1048576 /* Union */) {
76931
76988
  var types = apparentType.types;
76932
76989
  var hasSignatures = false;
76933
- for (var _i = 0, types_20 = types; _i < types_20.length; _i++) {
76934
- var constituent = types_20[_i];
76990
+ for (var _i = 0, types_19 = types; _i < types_19.length; _i++) {
76991
+ var constituent = types_19[_i];
76935
76992
  var signatures = getSignaturesOfType(constituent, kind);
76936
76993
  if (signatures.length !== 0) {
76937
76994
  hasSignatures = true;
@@ -78622,7 +78679,7 @@ var ts;
78622
78679
  var type = getTypeOfSymbol(symbol);
78623
78680
  if (strictNullChecks &&
78624
78681
  !(type.flags & (3 /* AnyOrUnknown */ | 131072 /* Never */)) &&
78625
- !(exactOptionalPropertyTypes ? symbol.flags & 16777216 /* Optional */ : getFalsyFlags(type) & 32768 /* Undefined */)) {
78682
+ !(exactOptionalPropertyTypes ? symbol.flags & 16777216 /* Optional */ : getTypeFacts(type) & 16777216 /* IsUndefined */)) {
78626
78683
  error(expr, ts.Diagnostics.The_operand_of_a_delete_operator_must_be_optional);
78627
78684
  }
78628
78685
  }
@@ -78790,8 +78847,8 @@ var ts;
78790
78847
  }
78791
78848
  if (type.flags & 3145728 /* UnionOrIntersection */) {
78792
78849
  var types = type.types;
78793
- for (var _i = 0, types_21 = types; _i < types_21.length; _i++) {
78794
- var t = types_21[_i];
78850
+ for (var _i = 0, types_20 = types; _i < types_20.length; _i++) {
78851
+ var t = types_20[_i];
78795
78852
  if (maybeTypeOfKind(t, kind)) {
78796
78853
  return true;
78797
78854
  }
@@ -79018,7 +79075,7 @@ var ts;
79018
79075
  // In strict null checking mode, if a default value of a non-undefined type is specified, remove
79019
79076
  // undefined from the final type.
79020
79077
  if (strictNullChecks &&
79021
- !(getFalsyFlags(checkExpression(prop.objectAssignmentInitializer)) & 32768 /* Undefined */)) {
79078
+ !(getTypeFacts(checkExpression(prop.objectAssignmentInitializer)) & 16777216 /* IsUndefined */)) {
79022
79079
  sourceType = getTypeWithFacts(sourceType, 524288 /* NEUndefined */);
79023
79080
  }
79024
79081
  checkBinaryLikeExpression(prop.name, prop.equalsToken, prop.objectAssignmentInitializer, checkMode);
@@ -79418,7 +79475,7 @@ var ts;
79418
79475
  case 56 /* BarBarToken */:
79419
79476
  case 75 /* BarBarEqualsToken */: {
79420
79477
  var resultType_3 = getTypeFacts(leftType) & 8388608 /* Falsy */ ?
79421
- getUnionType([removeDefinitelyFalsyTypes(leftType), rightType], 2 /* Subtype */) :
79478
+ getUnionType([getNonNullableType(removeDefinitelyFalsyTypes(leftType)), rightType], 2 /* Subtype */) :
79422
79479
  leftType;
79423
79480
  if (operator === 75 /* BarBarEqualsToken */) {
79424
79481
  checkAssignmentOperator(rightType);
@@ -81959,8 +82016,8 @@ var ts;
81959
82016
  }
81960
82017
  function getEntityNameForDecoratorMetadataFromTypeList(types) {
81961
82018
  var commonEntityName;
81962
- for (var _i = 0, types_22 = types; _i < types_22.length; _i++) {
81963
- var typeNode = types_22[_i];
82019
+ for (var _i = 0, types_21 = types; _i < types_21.length; _i++) {
82020
+ var typeNode = types_21[_i];
81964
82021
  while (typeNode.kind === 191 /* ParenthesizedType */ || typeNode.kind === 197 /* NamedTupleMember */) {
81965
82022
  typeNode = typeNode.type; // Skip parens if need be
81966
82023
  }
@@ -82826,7 +82883,7 @@ var ts;
82826
82883
  // For a binding pattern, validate the initializer and exit
82827
82884
  if (ts.isBindingPattern(node.name)) {
82828
82885
  var needCheckInitializer = node.initializer && node.parent.parent.kind !== 243 /* ForInStatement */;
82829
- var needCheckWidenedType = node.name.elements.length === 0;
82886
+ var needCheckWidenedType = !ts.some(node.name.elements, ts.not(ts.isOmittedExpression));
82830
82887
  if (needCheckInitializer || needCheckWidenedType) {
82831
82888
  // Don't validate for-in initializer as it is already an error
82832
82889
  var widenedType = getWidenedTypeForVariableLikeDeclaration(node);
@@ -82979,7 +83036,7 @@ var ts;
82979
83036
  return;
82980
83037
  var type = checkTruthinessExpression(location);
82981
83038
  var isPropertyExpressionCast = ts.isPropertyAccessExpression(location) && isTypeAssertion(location.expression);
82982
- if (getFalsyFlags(type) || isPropertyExpressionCast)
83039
+ if (!(getTypeFacts(type) & 4194304 /* Truthy */) || isPropertyExpressionCast)
82983
83040
  return;
82984
83041
  // While it technically should be invalid for any known-truthy value
82985
83042
  // to be tested, we de-scope to functions and Promises unreferenced in
@@ -84665,18 +84722,17 @@ var ts;
84665
84722
  // but not by other kinds of members.
84666
84723
  // Base class instance member variables and accessors can be overridden by
84667
84724
  // derived class instance member variables and accessors, but not by other kinds of members.
84668
- var _a, _b;
84725
+ var _a, _b, _c, _d;
84669
84726
  // NOTE: assignability is checked in checkClassDeclaration
84670
84727
  var baseProperties = getPropertiesOfType(baseType);
84671
- basePropertyCheck: for (var _i = 0, baseProperties_1 = baseProperties; _i < baseProperties_1.length; _i++) {
84672
- var baseProperty = baseProperties_1[_i];
84728
+ var _loop_33 = function (baseProperty) {
84673
84729
  var base = getTargetSymbol(baseProperty);
84674
84730
  if (base.flags & 4194304 /* Prototype */) {
84675
- continue;
84731
+ return "continue";
84676
84732
  }
84677
84733
  var baseSymbol = getPropertyOfObjectType(type, base.escapedName);
84678
84734
  if (!baseSymbol) {
84679
- continue;
84735
+ return "continue";
84680
84736
  }
84681
84737
  var derived = getTargetSymbol(baseSymbol);
84682
84738
  var baseDeclarationFlags = ts.getDeclarationModifierFlagsFromSymbol(base);
@@ -84694,14 +84750,14 @@ var ts;
84694
84750
  // Searches other base types for a declaration that would satisfy the inherited abstract member.
84695
84751
  // (The class may have more than one base type via declaration merging with an interface with the
84696
84752
  // same name.)
84697
- for (var _c = 0, _d = getBaseTypes(type); _c < _d.length; _c++) {
84698
- var otherBaseType = _d[_c];
84753
+ for (var _e = 0, _f = getBaseTypes(type); _e < _f.length; _e++) {
84754
+ var otherBaseType = _f[_e];
84699
84755
  if (otherBaseType === baseType)
84700
84756
  continue;
84701
84757
  var baseSymbol_1 = getPropertyOfObjectType(otherBaseType, base.escapedName);
84702
84758
  var derivedElsewhere = baseSymbol_1 && getTargetSymbol(baseSymbol_1);
84703
84759
  if (derivedElsewhere && derivedElsewhere !== base) {
84704
- continue basePropertyCheck;
84760
+ return "continue-basePropertyCheck";
84705
84761
  }
84706
84762
  }
84707
84763
  if (derivedClassDecl.kind === 226 /* ClassExpression */) {
@@ -84716,20 +84772,19 @@ var ts;
84716
84772
  // derived overrides base.
84717
84773
  var derivedDeclarationFlags = ts.getDeclarationModifierFlagsFromSymbol(derived);
84718
84774
  if (baseDeclarationFlags & 8 /* Private */ || derivedDeclarationFlags & 8 /* Private */) {
84719
- // either base or derived property is private - not override, skip it
84720
- continue;
84775
+ return "continue";
84721
84776
  }
84722
84777
  var errorMessage = void 0;
84723
84778
  var basePropertyFlags = base.flags & 98308 /* PropertyOrAccessor */;
84724
84779
  var derivedPropertyFlags = derived.flags & 98308 /* PropertyOrAccessor */;
84725
84780
  if (basePropertyFlags && derivedPropertyFlags) {
84726
84781
  // property/accessor is overridden with property/accessor
84727
- if (baseDeclarationFlags & 128 /* Abstract */ && !(base.valueDeclaration && ts.isPropertyDeclaration(base.valueDeclaration) && base.valueDeclaration.initializer)
84728
- || base.valueDeclaration && base.valueDeclaration.parent.kind === 258 /* InterfaceDeclaration */
84782
+ if ((ts.getCheckFlags(base) & 6 /* Synthetic */
84783
+ ? (_a = base.declarations) === null || _a === void 0 ? void 0 : _a.some(function (d) { return isPropertyAbstractOrInterface(d, baseDeclarationFlags); })
84784
+ : (_b = base.declarations) === null || _b === void 0 ? void 0 : _b.every(function (d) { return isPropertyAbstractOrInterface(d, baseDeclarationFlags); }))
84785
+ || ts.getCheckFlags(base) & 262144 /* Mapped */
84729
84786
  || derived.valueDeclaration && ts.isBinaryExpression(derived.valueDeclaration)) {
84730
- // when the base property is abstract or from an interface, base/derived flags don't need to match
84731
- // same when the derived property is from an assignment
84732
- continue;
84787
+ return "continue";
84733
84788
  }
84734
84789
  var overriddenInstanceProperty = basePropertyFlags !== 4 /* Property */ && derivedPropertyFlags === 4 /* Property */;
84735
84790
  var overriddenInstanceAccessor = basePropertyFlags === 4 /* Property */ && derivedPropertyFlags !== 4 /* Property */;
@@ -84740,12 +84795,12 @@ var ts;
84740
84795
  error(ts.getNameOfDeclaration(derived.valueDeclaration) || derived.valueDeclaration, errorMessage_1, symbolToString(base), typeToString(baseType), typeToString(type));
84741
84796
  }
84742
84797
  else if (useDefineForClassFields) {
84743
- var uninitialized = (_a = derived.declarations) === null || _a === void 0 ? void 0 : _a.find(function (d) { return d.kind === 167 /* PropertyDeclaration */ && !d.initializer; });
84798
+ var uninitialized = (_c = derived.declarations) === null || _c === void 0 ? void 0 : _c.find(function (d) { return d.kind === 167 /* PropertyDeclaration */ && !d.initializer; });
84744
84799
  if (uninitialized
84745
84800
  && !(derived.flags & 33554432 /* Transient */)
84746
84801
  && !(baseDeclarationFlags & 128 /* Abstract */)
84747
84802
  && !(derivedDeclarationFlags & 128 /* Abstract */)
84748
- && !((_b = derived.declarations) === null || _b === void 0 ? void 0 : _b.some(function (d) { return !!(d.flags & 16777216 /* Ambient */); }))) {
84803
+ && !((_d = derived.declarations) === null || _d === void 0 ? void 0 : _d.some(function (d) { return !!(d.flags & 16777216 /* Ambient */); }))) {
84749
84804
  var constructor = findConstructorDeclaration(ts.getClassLikeDeclarationOfSymbol(type.symbol));
84750
84805
  var propName = uninitialized.name;
84751
84806
  if (uninitialized.exclamationToken
@@ -84758,13 +84813,11 @@ var ts;
84758
84813
  }
84759
84814
  }
84760
84815
  }
84761
- // correct case
84762
- continue;
84816
+ return "continue";
84763
84817
  }
84764
84818
  else if (isPrototypeProperty(base)) {
84765
84819
  if (isPrototypeProperty(derived) || derived.flags & 4 /* Property */) {
84766
- // method is overridden with method or property -- correct case
84767
- continue;
84820
+ return "continue";
84768
84821
  }
84769
84822
  else {
84770
84823
  ts.Debug.assert(!!(derived.flags & 98304 /* Accessor */));
@@ -84779,9 +84832,20 @@ var ts;
84779
84832
  }
84780
84833
  error(ts.getNameOfDeclaration(derived.valueDeclaration) || derived.valueDeclaration, errorMessage, typeToString(baseType), symbolToString(base), typeToString(type));
84781
84834
  }
84835
+ };
84836
+ basePropertyCheck: for (var _i = 0, baseProperties_1 = baseProperties; _i < baseProperties_1.length; _i++) {
84837
+ var baseProperty = baseProperties_1[_i];
84838
+ var state_10 = _loop_33(baseProperty);
84839
+ switch (state_10) {
84840
+ case "continue-basePropertyCheck": continue basePropertyCheck;
84841
+ }
84782
84842
  }
84783
84843
  }
84784
- function getNonInterhitedProperties(type, baseTypes, properties) {
84844
+ function isPropertyAbstractOrInterface(declaration, baseDeclarationFlags) {
84845
+ return baseDeclarationFlags & 128 /* Abstract */ && (!ts.isPropertyDeclaration(declaration) || !declaration.initializer)
84846
+ || ts.isInterfaceDeclaration(declaration.parent);
84847
+ }
84848
+ function getNonInheritedProperties(type, baseTypes, properties) {
84785
84849
  if (!ts.length(baseTypes)) {
84786
84850
  return properties;
84787
84851
  }
@@ -84850,7 +84914,7 @@ var ts;
84850
84914
  var propName = member.name;
84851
84915
  if (ts.isIdentifier(propName) || ts.isPrivateIdentifier(propName) || ts.isComputedPropertyName(propName)) {
84852
84916
  var type = getTypeOfSymbol(getSymbolOfNode(member));
84853
- if (!(type.flags & 3 /* AnyOrUnknown */ || getFalsyFlags(type) & 32768 /* Undefined */)) {
84917
+ if (!(type.flags & 3 /* AnyOrUnknown */ || getTypeFacts(type) & 16777216 /* IsUndefined */)) {
84854
84918
  if (!constructor || !isPropertyInitializedInConstructor(propName, type, constructor)) {
84855
84919
  error(member.name, ts.Diagnostics.Property_0_has_no_initializer_and_is_not_definitely_assigned_in_the_constructor, ts.declarationNameToString(propName));
84856
84920
  }
@@ -84875,7 +84939,7 @@ var ts;
84875
84939
  ts.setParent(reference, staticBlock);
84876
84940
  reference.flowNode = staticBlock.returnFlowNode;
84877
84941
  var flowType = getFlowTypeOfReference(reference, propType, getOptionalType(propType));
84878
- if (!(getFalsyFlags(flowType) & 32768 /* Undefined */)) {
84942
+ if (!(getTypeFacts(flowType) & 16777216 /* IsUndefined */)) {
84879
84943
  return true;
84880
84944
  }
84881
84945
  }
@@ -84890,7 +84954,7 @@ var ts;
84890
84954
  ts.setParent(reference, constructor);
84891
84955
  reference.flowNode = constructor.returnFlowNode;
84892
84956
  var flowType = getFlowTypeOfReference(reference, propType, getOptionalType(propType));
84893
- return !(getFalsyFlags(flowType) & 32768 /* Undefined */);
84957
+ return !(getTypeFacts(flowType) & 16777216 /* IsUndefined */);
84894
84958
  }
84895
84959
  function checkInterfaceDeclaration(node) {
84896
84960
  // Grammar checking
@@ -93178,8 +93242,8 @@ var ts;
93178
93242
  // Note when updating logic here also update getEntityNameForDecoratorMetadata
93179
93243
  // so that aliases can be marked as referenced
93180
93244
  var serializedUnion;
93181
- for (var _i = 0, types_23 = types; _i < types_23.length; _i++) {
93182
- var typeNode = types_23[_i];
93245
+ for (var _i = 0, types_22 = types; _i < types_22.length; _i++) {
93246
+ var typeNode = types_22[_i];
93183
93247
  while (typeNode.kind === 191 /* ParenthesizedType */) {
93184
93248
  typeNode = typeNode.type; // Skip parens if need be
93185
93249
  }
@@ -113828,8 +113892,8 @@ var ts;
113828
113892
  bundleFileInfo.sections.push({ pos: pos, end: writer.getTextPos(), kind: "reference" /* Reference */, data: directive.fileName });
113829
113893
  writeLine();
113830
113894
  }
113831
- for (var _d = 0, types_24 = types; _d < types_24.length; _d++) {
113832
- var directive = types_24[_d];
113895
+ for (var _d = 0, types_23 = types; _d < types_23.length; _d++) {
113896
+ var directive = types_23[_d];
113833
113897
  var pos = writer.getTextPos();
113834
113898
  var resolutionMode = directive.resolutionMode && directive.resolutionMode !== (currentSourceFile === null || currentSourceFile === void 0 ? void 0 : currentSourceFile.impliedNodeFormat)
113835
113899
  ? "resolution-mode=\"" + (directive.resolutionMode === ts.ModuleKind.ESNext ? "import" : "require") + "\""
@@ -122620,7 +122684,7 @@ var ts;
122620
122684
  });
122621
122685
  // Sort by paths closest to importing file Name directory
122622
122686
  var sortedPaths = [];
122623
- var _loop_33 = function (directory) {
122687
+ var _loop_34 = function (directory) {
122624
122688
  var directoryStart = ts.ensureTrailingDirectorySeparator(directory);
122625
122689
  var pathsInDirectory;
122626
122690
  allFileNames.forEach(function (_a, fileName) {
@@ -122644,9 +122708,9 @@ var ts;
122644
122708
  };
122645
122709
  var out_directory_1;
122646
122710
  for (var directory = ts.getDirectoryPath(importingFileName); allFileNames.size !== 0;) {
122647
- var state_10 = _loop_33(directory);
122711
+ var state_11 = _loop_34(directory);
122648
122712
  directory = out_directory_1;
122649
- if (state_10 === "break")
122713
+ if (state_11 === "break")
122650
122714
  break;
122651
122715
  }
122652
122716
  if (allFileNames.size) {
@@ -145026,7 +145090,7 @@ var ts;
145026
145090
  if (!ts.textSpanIntersectsWith(span, node.pos, node.getFullWidth())) {
145027
145091
  return;
145028
145092
  }
145029
- if (ts.isTypeNode(node)) {
145093
+ if (ts.isTypeNode(node) && !ts.isExpressionWithTypeArguments(node)) {
145030
145094
  return;
145031
145095
  }
145032
145096
  if (preferences.includeInlayVariableTypeHints && ts.isVariableDeclaration(node)) {
@@ -148137,7 +148201,6 @@ var ts;
148137
148201
  case 280 /* JsxOpeningElement */:
148138
148202
  case 281 /* JsxClosingElement */:
148139
148203
  case 279 /* JsxSelfClosingElement */:
148140
- case 228 /* ExpressionWithTypeArguments */:
148141
148204
  return false;
148142
148205
  }
148143
148206
  break;
@@ -148307,7 +148370,7 @@ var ts;
148307
148370
  var listEndToken = getCloseTokenForOpenToken(listStartToken);
148308
148371
  if (listEndToken !== 0 /* Unknown */ && formattingScanner.isOnToken() && formattingScanner.getStartPos() < originalRange.end) {
148309
148372
  var tokenInfo = formattingScanner.readTokenInfo(parent);
148310
- if (tokenInfo.token.kind === 27 /* CommaToken */ && ts.isCallLikeExpression(parent)) {
148373
+ if (tokenInfo.token.kind === 27 /* CommaToken */) {
148311
148374
  // consume the comma
148312
148375
  consumeTokenAndAdvanceScanner(tokenInfo, parent, listDynamicIndentation, parent);
148313
148376
  tokenInfo = formattingScanner.isOnToken() ? formattingScanner.readTokenInfo(parent) : undefined;
@@ -148711,6 +148774,12 @@ var ts;
148711
148774
  case 169 /* MethodDeclaration */:
148712
148775
  case 168 /* MethodSignature */:
148713
148776
  case 214 /* ArrowFunction */:
148777
+ case 174 /* CallSignature */:
148778
+ case 175 /* ConstructSignature */:
148779
+ case 179 /* FunctionType */:
148780
+ case 180 /* ConstructorType */:
148781
+ case 172 /* GetAccessor */:
148782
+ case 173 /* SetAccessor */:
148714
148783
  if (node.typeParameters === list) {
148715
148784
  return 29 /* LessThanToken */;
148716
148785
  }
@@ -148727,7 +148796,19 @@ var ts;
148727
148796
  return 20 /* OpenParenToken */;
148728
148797
  }
148729
148798
  break;
148799
+ case 257 /* ClassDeclaration */:
148800
+ case 226 /* ClassExpression */:
148801
+ case 258 /* InterfaceDeclaration */:
148802
+ case 259 /* TypeAliasDeclaration */:
148803
+ if (node.typeParameters === list) {
148804
+ return 29 /* LessThanToken */;
148805
+ }
148806
+ break;
148730
148807
  case 178 /* TypeReference */:
148808
+ case 210 /* TaggedTemplateExpression */:
148809
+ case 181 /* TypeQuery */:
148810
+ case 228 /* ExpressionWithTypeArguments */:
148811
+ case 200 /* ImportType */:
148731
148812
  if (node.typeArguments === list) {
148732
148813
  return 29 /* LessThanToken */;
148733
148814
  }