@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.
package/lib/tsserver.js CHANGED
@@ -100,7 +100,7 @@ var ts;
100
100
  // The following is baselined as a literal template type without intervention
101
101
  /** The version of the TypeScript compiler release */
102
102
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
103
- ts.version = ts.versionMajorMinor + ".0-insiders.20220527";
103
+ ts.version = ts.versionMajorMinor + ".0-insiders.20220601";
104
104
  /* @internal */
105
105
  var Comparison;
106
106
  (function (Comparison) {
@@ -5104,6 +5104,11 @@ var ts;
5104
5104
  // Flags that require TypeFlags.Union
5105
5105
  /* @internal */
5106
5106
  ObjectFlags[ObjectFlags["ContainsIntersections"] = 16777216] = "ContainsIntersections";
5107
+ /* @internal */
5108
+ ObjectFlags[ObjectFlags["IsUnknownLikeUnionComputed"] = 33554432] = "IsUnknownLikeUnionComputed";
5109
+ /* @internal */
5110
+ ObjectFlags[ObjectFlags["IsUnknownLikeUnion"] = 67108864] = "IsUnknownLikeUnion";
5111
+ /* @internal */
5107
5112
  // Flags that require TypeFlags.Intersection
5108
5113
  /* @internal */
5109
5114
  ObjectFlags[ObjectFlags["IsNeverIntersectionComputed"] = 16777216] = "IsNeverIntersectionComputed";
@@ -8428,6 +8433,7 @@ var ts;
8428
8433
  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),
8429
8434
  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."),
8430
8435
  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."),
8436
+ 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."),
8431
8437
  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."),
8432
8438
  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."),
8433
8439
  Duplicate_identifier_0: diag(2300, ts.DiagnosticCategory.Error, "Duplicate_identifier_0_2300", "Duplicate identifier '{0}'."),
@@ -8913,6 +8919,7 @@ var ts;
8913
8919
  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."),
8914
8920
  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."),
8915
8921
  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."),
8922
+ 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"),
8916
8923
  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}'."),
8917
8924
  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}'."),
8918
8925
  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}'."),
@@ -44276,8 +44283,8 @@ var ts;
44276
44283
  var pathAndExtension = loadModuleFromFile(extensions, candidate, onlyRecordFailures, state) ||
44277
44284
  loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageInfo && packageInfo.packageJsonContent, packageInfo && packageInfo.versionPaths);
44278
44285
  if (!pathAndExtension && packageInfo
44279
- && packageInfo.packageJsonContent.exports === undefined
44280
- && packageInfo.packageJsonContent.main === undefined
44286
+ // eslint-disable-next-line no-null/no-null
44287
+ && (packageInfo.packageJsonContent.exports === undefined || packageInfo.packageJsonContent.exports === null)
44281
44288
  && state.features & NodeResolutionFeatures.EsmMode) {
44282
44289
  // EsmMode disables index lookup in `loadNodeModuleFromDirectoryWorker` generally, however non-relative package resolutions still assume
44283
44290
  // a default `index.js` entrypoint if no `main` or `exports` are present
@@ -47942,7 +47949,10 @@ var ts;
47942
47949
  TypeFacts[TypeFacts["NEUndefinedOrNull"] = 2097152] = "NEUndefinedOrNull";
47943
47950
  TypeFacts[TypeFacts["Truthy"] = 4194304] = "Truthy";
47944
47951
  TypeFacts[TypeFacts["Falsy"] = 8388608] = "Falsy";
47945
- TypeFacts[TypeFacts["All"] = 16777215] = "All";
47952
+ TypeFacts[TypeFacts["IsUndefined"] = 16777216] = "IsUndefined";
47953
+ TypeFacts[TypeFacts["IsNull"] = 33554432] = "IsNull";
47954
+ TypeFacts[TypeFacts["IsUndefinedOrNull"] = 50331648] = "IsUndefinedOrNull";
47955
+ TypeFacts[TypeFacts["All"] = 134217727] = "All";
47946
47956
  // The following members encode facts about particular kinds of types for use in the getTypeFacts function.
47947
47957
  // The presence of a particular fact means that the given test is true for some (and possibly all) values
47948
47958
  // of that kind of type.
@@ -47984,14 +47994,16 @@ var ts;
47984
47994
  TypeFacts[TypeFacts["ObjectFacts"] = 16736160] = "ObjectFacts";
47985
47995
  TypeFacts[TypeFacts["FunctionStrictFacts"] = 7880640] = "FunctionStrictFacts";
47986
47996
  TypeFacts[TypeFacts["FunctionFacts"] = 16728000] = "FunctionFacts";
47987
- TypeFacts[TypeFacts["UndefinedFacts"] = 9830144] = "UndefinedFacts";
47988
- TypeFacts[TypeFacts["NullFacts"] = 9363232] = "NullFacts";
47989
- TypeFacts[TypeFacts["EmptyObjectStrictFacts"] = 16318463] = "EmptyObjectStrictFacts";
47997
+ TypeFacts[TypeFacts["VoidFacts"] = 9830144] = "VoidFacts";
47998
+ TypeFacts[TypeFacts["UndefinedFacts"] = 26607360] = "UndefinedFacts";
47999
+ TypeFacts[TypeFacts["NullFacts"] = 42917664] = "NullFacts";
48000
+ TypeFacts[TypeFacts["EmptyObjectStrictFacts"] = 83427327] = "EmptyObjectStrictFacts";
48001
+ TypeFacts[TypeFacts["EmptyObjectFacts"] = 83886079] = "EmptyObjectFacts";
48002
+ TypeFacts[TypeFacts["UnknownFacts"] = 83886079] = "UnknownFacts";
47990
48003
  TypeFacts[TypeFacts["AllTypeofNE"] = 556800] = "AllTypeofNE";
47991
- TypeFacts[TypeFacts["EmptyObjectFacts"] = 16777215] = "EmptyObjectFacts";
47992
48004
  // Masks
47993
48005
  TypeFacts[TypeFacts["OrFactsMask"] = 8256] = "OrFactsMask";
47994
- TypeFacts[TypeFacts["AndFactsMask"] = 16768959] = "AndFactsMask";
48006
+ TypeFacts[TypeFacts["AndFactsMask"] = 134209471] = "AndFactsMask";
47995
48007
  })(TypeFacts || (TypeFacts = {}));
47996
48008
  var typeofEQFacts = new ts.Map(ts.getEntries({
47997
48009
  string: 1 /* TypeofEQString */,
@@ -48655,6 +48667,7 @@ var ts;
48655
48667
  var emptyTypeLiteralSymbol = createSymbol(2048 /* TypeLiteral */, "__type" /* Type */);
48656
48668
  emptyTypeLiteralSymbol.members = ts.createSymbolTable();
48657
48669
  var emptyTypeLiteralType = createAnonymousType(emptyTypeLiteralSymbol, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
48670
+ var unknownUnionType = strictNullChecks ? getUnionType([undefinedType, nullType, createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray)]) : unknownType;
48658
48671
  var emptyGenericType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
48659
48672
  emptyGenericType.instantiations = new ts.Map();
48660
48673
  var anyFunctionType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
@@ -50154,7 +50167,12 @@ var ts;
50154
50167
  function checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning) {
50155
50168
  if (meaning & (111551 /* Value */ & ~1024 /* NamespaceModule */)) {
50156
50169
  if (isPrimitiveTypeName(name)) {
50157
- error(errorLocation, ts.Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here, ts.unescapeLeadingUnderscores(name));
50170
+ if (isExtendedByInterface(errorLocation)) {
50171
+ 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));
50172
+ }
50173
+ else {
50174
+ error(errorLocation, ts.Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here, ts.unescapeLeadingUnderscores(name));
50175
+ }
50158
50176
  return true;
50159
50177
  }
50160
50178
  var symbol = resolveSymbol(resolveName(errorLocation, name, 788968 /* Type */ & ~111551 /* Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false));
@@ -50174,6 +50192,16 @@ var ts;
50174
50192
  }
50175
50193
  return false;
50176
50194
  }
50195
+ function isExtendedByInterface(node) {
50196
+ var grandparent = node.parent.parent;
50197
+ var parentOfGrandparent = grandparent.parent;
50198
+ if (grandparent && parentOfGrandparent) {
50199
+ var isExtending = ts.isHeritageClause(grandparent) && grandparent.token === 94 /* ExtendsKeyword */;
50200
+ var isInterface = ts.isInterfaceDeclaration(parentOfGrandparent);
50201
+ return isExtending && isInterface;
50202
+ }
50203
+ return false;
50204
+ }
50177
50205
  function maybeMappedType(node, symbol) {
50178
50206
  var container = ts.findAncestor(node.parent, function (n) {
50179
50207
  return ts.isComputedPropertyName(n) || ts.isPropertySignature(n) ? false : ts.isTypeLiteralNode(n) || "quit";
@@ -53014,7 +53042,7 @@ var ts;
53014
53042
  anyType : getNonMissingTypeOfSymbol(propertySymbol);
53015
53043
  var saveEnclosingDeclaration = context.enclosingDeclaration;
53016
53044
  context.enclosingDeclaration = undefined;
53017
- if (context.tracker.trackSymbol && ts.getCheckFlags(propertySymbol) & 4096 /* Late */ && isLateBoundName(propertySymbol.escapedName)) {
53045
+ if (context.tracker.trackSymbol && isLateBoundName(propertySymbol.escapedName)) {
53018
53046
  if (propertySymbol.declarations) {
53019
53047
  var decl = ts.first(propertySymbol.declarations);
53020
53048
  if (hasLateBindableName(decl)) {
@@ -54698,7 +54726,7 @@ var ts;
54698
54726
  ? getBaseConstructorTypeOfClass(staticType)
54699
54727
  : anyType;
54700
54728
  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);
54701
- var symbolProps = getNonInterhitedProperties(classType, baseTypes, getPropertiesOfType(classType));
54729
+ var symbolProps = getNonInheritedProperties(classType, baseTypes, getPropertiesOfType(classType));
54702
54730
  var publicSymbolProps = ts.filter(symbolProps, function (s) {
54703
54731
  // `valueDeclaration` could be undefined if inherited from
54704
54732
  // a union/intersection base type, but inherited properties
@@ -55836,7 +55864,7 @@ var ts;
55836
55864
  if (ts.getEffectiveTypeAnnotationNode(ts.walkUpBindingElementsAndPatterns(declaration))) {
55837
55865
  // In strict null checking mode, if a default value of a non-undefined type is specified, remove
55838
55866
  // undefined from the final type.
55839
- return strictNullChecks && !(getFalsyFlags(checkDeclarationInitializer(declaration, 0 /* Normal */)) & 32768 /* Undefined */) ? getNonUndefinedType(type) : type;
55867
+ return strictNullChecks && !(getTypeFacts(checkDeclarationInitializer(declaration, 0 /* Normal */)) & 16777216 /* IsUndefined */) ? getNonUndefinedType(type) : type;
55840
55868
  }
55841
55869
  return widenTypeInferredFromInitializer(declaration, getUnionType([getNonUndefinedType(type), checkDeclarationInitializer(declaration, 0 /* Normal */)], 2 /* Subtype */));
55842
55870
  }
@@ -58825,7 +58853,7 @@ var ts;
58825
58853
  }
58826
58854
  }
58827
58855
  }
58828
- else if (t.flags & 469892092 /* DisjointDomains */) {
58856
+ else if (t.flags & 469892092 /* DisjointDomains */ || isEmptyAnonymousObjectType(t)) {
58829
58857
  hasDisjointDomainType = true;
58830
58858
  }
58831
58859
  }
@@ -58837,7 +58865,7 @@ var ts;
58837
58865
  // intersection operation to reduce the union constraints.
58838
58866
  for (var _a = 0, types_6 = types; _a < types_6.length; _a++) {
58839
58867
  var t = types_6[_a];
58840
- if (t.flags & 469892092 /* DisjointDomains */) {
58868
+ if (t.flags & 469892092 /* DisjointDomains */ || isEmptyAnonymousObjectType(t)) {
58841
58869
  constraints = ts.append(constraints, t);
58842
58870
  }
58843
58871
  }
@@ -59039,7 +59067,7 @@ var ts;
59039
59067
  var objectType;
59040
59068
  return !!(type.flags & 8388608 /* IndexedAccess */ && ts.getObjectFlags(objectType = type.objectType) & 32 /* Mapped */ &&
59041
59069
  !isGenericMappedType(objectType) && isGenericIndexType(type.indexType) &&
59042
- !objectType.declaration.questionToken && !objectType.declaration.nameType);
59070
+ !(getMappedTypeModifiers(objectType) & 8 /* ExcludeOptional */) && !objectType.declaration.nameType);
59043
59071
  }
59044
59072
  /**
59045
59073
  * For a type parameter, return the base constraint of the type parameter. For the string, number,
@@ -61386,7 +61414,7 @@ var ts;
61386
61414
  }
61387
61415
  return includes;
61388
61416
  }
61389
- function removeRedundantPrimitiveTypes(types, includes) {
61417
+ function removeRedundantSupertypes(types, includes) {
61390
61418
  var i = types.length;
61391
61419
  while (i > 0) {
61392
61420
  i--;
@@ -61394,7 +61422,9 @@ var ts;
61394
61422
  var remove = t.flags & 4 /* String */ && includes & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) ||
61395
61423
  t.flags & 8 /* Number */ && includes & 256 /* NumberLiteral */ ||
61396
61424
  t.flags & 64 /* BigInt */ && includes & 2048 /* BigIntLiteral */ ||
61397
- t.flags & 4096 /* ESSymbol */ && includes & 8192 /* UniqueESSymbol */;
61425
+ t.flags & 4096 /* ESSymbol */ && includes & 8192 /* UniqueESSymbol */ ||
61426
+ t.flags & 16384 /* Void */ && includes & 32768 /* Undefined */ ||
61427
+ isEmptyAnonymousObjectType(t) && includes & 470302716 /* DefinitelyNonNullable */;
61398
61428
  if (remove) {
61399
61429
  ts.orderedRemoveItemAt(types, i);
61400
61430
  }
@@ -61516,7 +61546,7 @@ var ts;
61516
61546
  // a type alias of the form "type List<T> = T & { next: List<T> }" cannot be reduced during its declaration.
61517
61547
  // Also, unlike union types, the order of the constituent types is preserved in order that overload resolution
61518
61548
  // for intersections of types with signatures can be deterministic.
61519
- function getIntersectionType(types, aliasSymbol, aliasTypeArguments) {
61549
+ function getIntersectionType(types, aliasSymbol, aliasTypeArguments, noSupertypeReduction) {
61520
61550
  var typeMembershipMap = new ts.Map();
61521
61551
  var includes = addTypesToIntersection(typeMembershipMap, 0, types);
61522
61552
  var typeSet = ts.arrayFrom(typeMembershipMap.values());
@@ -61553,11 +61583,11 @@ var ts;
61553
61583
  if (includes & 4 /* String */ && includes & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) ||
61554
61584
  includes & 8 /* Number */ && includes & 256 /* NumberLiteral */ ||
61555
61585
  includes & 64 /* BigInt */ && includes & 2048 /* BigIntLiteral */ ||
61556
- includes & 4096 /* ESSymbol */ && includes & 8192 /* UniqueESSymbol */) {
61557
- removeRedundantPrimitiveTypes(typeSet, includes);
61558
- }
61559
- if (includes & 16777216 /* IncludesEmptyObject */ && includes & 524288 /* Object */) {
61560
- ts.orderedRemoveItemAt(typeSet, ts.findIndex(typeSet, isEmptyAnonymousObjectType));
61586
+ includes & 4096 /* ESSymbol */ && includes & 8192 /* UniqueESSymbol */ ||
61587
+ includes & 16384 /* Void */ && includes & 32768 /* Undefined */ ||
61588
+ includes & 16777216 /* IncludesEmptyObject */ && includes & 470302716 /* DefinitelyNonNullable */) {
61589
+ if (!noSupertypeReduction)
61590
+ removeRedundantSupertypes(typeSet, includes);
61561
61591
  }
61562
61592
  if (includes & 262144 /* IncludesMissingType */) {
61563
61593
  typeSet[typeSet.indexOf(undefinedType)] = missingType;
@@ -61596,8 +61626,9 @@ var ts;
61596
61626
  }
61597
61627
  var constituents = getCrossProductIntersections(typeSet);
61598
61628
  // We attach a denormalized origin type when at least one constituent of the cross-product union is an
61599
- // intersection (i.e. when the intersection didn't just reduce one or more unions to smaller unions).
61600
- var origin = ts.some(constituents, function (t) { return !!(t.flags & 2097152 /* Intersection */); }) ? createOriginUnionOrIntersectionType(2097152 /* Intersection */, typeSet) : undefined;
61629
+ // intersection (i.e. when the intersection didn't just reduce one or more unions to smaller unions) and
61630
+ // the denormalized origin has fewer constituents than the union itself.
61631
+ var origin = ts.some(constituents, function (t) { return !!(t.flags & 2097152 /* Intersection */); }) && getConstituentCountOfTypes(constituents) > getConstituentCountOfTypes(typeSet) ? createOriginUnionOrIntersectionType(2097152 /* Intersection */, typeSet) : undefined;
61601
61632
  result = getUnionType(constituents, 1 /* Literal */, aliasSymbol, aliasTypeArguments, origin);
61602
61633
  }
61603
61634
  }
@@ -61640,11 +61671,21 @@ var ts;
61640
61671
  }
61641
61672
  return intersections;
61642
61673
  }
61674
+ function getConstituentCount(type) {
61675
+ return !(type.flags & 3145728 /* UnionOrIntersection */) || type.aliasSymbol ? 1 :
61676
+ type.flags & 1048576 /* Union */ && type.origin ? getConstituentCount(type.origin) :
61677
+ getConstituentCountOfTypes(type.types);
61678
+ }
61679
+ function getConstituentCountOfTypes(types) {
61680
+ return ts.reduceLeft(types, function (n, t) { return n + getConstituentCount(t); }, 0);
61681
+ }
61643
61682
  function getTypeFromIntersectionTypeNode(node) {
61644
61683
  var links = getNodeLinks(node);
61645
61684
  if (!links.resolvedType) {
61646
61685
  var aliasSymbol = getAliasSymbolForTypeNode(node);
61647
- links.resolvedType = getIntersectionType(ts.map(node.types, getTypeFromTypeNode), aliasSymbol, getTypeArgumentsForAliasSymbol(aliasSymbol));
61686
+ var types = ts.map(node.types, getTypeFromTypeNode);
61687
+ var noSupertypeReduction = types.length === 2 && !!(types[0].flags & (4 /* String */ | 8 /* Number */ | 64 /* BigInt */)) && types[1] === emptyTypeLiteralType;
61688
+ links.resolvedType = getIntersectionType(types, aliasSymbol, getTypeArgumentsForAliasSymbol(aliasSymbol), noSupertypeReduction);
61648
61689
  }
61649
61690
  return links.resolvedType;
61650
61691
  }
@@ -64318,7 +64359,7 @@ var ts;
64318
64359
  var sourceSig = checkMode & 3 /* Callback */ ? undefined : getSingleCallSignature(getNonNullableType(sourceType));
64319
64360
  var targetSig = checkMode & 3 /* Callback */ ? undefined : getSingleCallSignature(getNonNullableType(targetType));
64320
64361
  var callbacks = sourceSig && targetSig && !getTypePredicateOfSignature(sourceSig) && !getTypePredicateOfSignature(targetSig) &&
64321
- (getFalsyFlags(sourceType) & 98304 /* Nullable */) === (getFalsyFlags(targetType) & 98304 /* Nullable */);
64362
+ (getTypeFacts(sourceType) & 50331648 /* IsUndefinedOrNull */) === (getTypeFacts(targetType) & 50331648 /* IsUndefinedOrNull */);
64322
64363
  var related = callbacks ?
64323
64364
  compareSignaturesRelated(targetSig, sourceSig, (checkMode & 8 /* StrictArity */) | (strictVariance ? 2 /* StrictCallback */ : 1 /* BivariantCallback */), reportErrors, errorReporter, incompatibleErrorReporter, compareTypes, reportUnreliableMarkers) :
64324
64365
  !(checkMode & 3 /* Callback */) && !strictVariance && compareTypes(sourceType, targetType, /*reportErrors*/ false) || compareTypes(targetType, sourceType, reportErrors);
@@ -64430,6 +64471,17 @@ var ts;
64430
64471
  return !!(ts.getObjectFlags(type) & 16 /* Anonymous */ && (type.members && isEmptyResolvedType(type) ||
64431
64472
  type.symbol && type.symbol.flags & 2048 /* TypeLiteral */ && getMembersOfSymbol(type.symbol).size === 0));
64432
64473
  }
64474
+ function isUnknownLikeUnionType(type) {
64475
+ if (strictNullChecks && type.flags & 1048576 /* Union */) {
64476
+ if (!(type.objectFlags & 33554432 /* IsUnknownLikeUnionComputed */)) {
64477
+ var types = type.types;
64478
+ type.objectFlags |= 33554432 /* IsUnknownLikeUnionComputed */ | (types.length >= 3 && types[0].flags & 32768 /* Undefined */ &&
64479
+ types[1].flags & 65536 /* Null */ && ts.some(types, isEmptyAnonymousObjectType) ? 67108864 /* IsUnknownLikeUnion */ : 0);
64480
+ }
64481
+ return !!(type.objectFlags & 67108864 /* IsUnknownLikeUnion */);
64482
+ }
64483
+ return false;
64484
+ }
64433
64485
  function isStringIndexSignatureOnlyType(type) {
64434
64486
  return type.flags & 524288 /* Object */ && !isGenericMappedType(type) && getPropertiesOfType(type).length === 0 && getIndexInfosOfType(type).length === 1 && !!getIndexInfoOfType(type, stringType) ||
64435
64487
  type.flags & 3145728 /* UnionOrIntersection */ && ts.every(type.types, isStringIndexSignatureOnlyType) ||
@@ -64509,7 +64561,7 @@ var ts;
64509
64561
  return true;
64510
64562
  if (s & 65536 /* Null */ && (!strictNullChecks && !(t & 3145728 /* UnionOrIntersection */) || t & 65536 /* Null */))
64511
64563
  return true;
64512
- if (s & 524288 /* Object */ && t & 67108864 /* NonPrimitive */)
64564
+ if (s & 524288 /* Object */ && t & 67108864 /* NonPrimitive */ && !(relation === strictSubtypeRelation && isEmptyAnonymousObjectType(source)))
64513
64565
  return true;
64514
64566
  if (relation === assignableRelation || relation === comparableRelation) {
64515
64567
  if (s & 1 /* Any */)
@@ -64519,6 +64571,9 @@ var ts;
64519
64571
  // bit-flag enum types sometimes look like literal enum types with numeric literal values.
64520
64572
  if (s & (8 /* Number */ | 256 /* NumberLiteral */) && !(s & 1024 /* EnumLiteral */) && (t & 32 /* Enum */ || relation === assignableRelation && t & 256 /* NumberLiteral */ && t & 1024 /* EnumLiteral */))
64521
64573
  return true;
64574
+ // Anything is assignable to a union containing undefined, null, and {}
64575
+ if (isUnknownLikeUnionType(target))
64576
+ return true;
64522
64577
  }
64523
64578
  return false;
64524
64579
  }
@@ -64561,16 +64616,27 @@ var ts;
64561
64616
  function getNormalizedType(type, writing) {
64562
64617
  while (true) {
64563
64618
  var t = isFreshLiteralType(type) ? type.regularType :
64564
- ts.getObjectFlags(type) & 4 /* Reference */ && type.node ? createTypeReference(type.target, getTypeArguments(type)) :
64565
- type.flags & 3145728 /* UnionOrIntersection */ ? getReducedType(type) :
64619
+ ts.getObjectFlags(type) & 4 /* Reference */ ? type.node ? createTypeReference(type.target, getTypeArguments(type)) : getSingleBaseForNonAugmentingSubtype(type) || type :
64620
+ type.flags & 3145728 /* UnionOrIntersection */ ? getNormalizedUnionOrIntersectionType(type, writing) :
64566
64621
  type.flags & 33554432 /* Substitution */ ? writing ? type.baseType : type.substitute :
64567
64622
  type.flags & 25165824 /* Simplifiable */ ? getSimplifiedType(type, writing) :
64568
64623
  type;
64569
- t = getSingleBaseForNonAugmentingSubtype(t) || t;
64570
64624
  if (t === type)
64571
- break;
64625
+ return t;
64572
64626
  type = t;
64573
64627
  }
64628
+ }
64629
+ function getNormalizedUnionOrIntersectionType(type, writing) {
64630
+ var reduced = getReducedType(type);
64631
+ if (reduced !== type) {
64632
+ return reduced;
64633
+ }
64634
+ if (type.flags & 2097152 /* Intersection */) {
64635
+ var normalizedTypes = ts.sameMap(type.types, function (t) { return getNormalizedType(t, writing); });
64636
+ if (normalizedTypes !== type.types) {
64637
+ return getIntersectionType(normalizedTypes);
64638
+ }
64639
+ }
64574
64640
  return type;
64575
64641
  }
64576
64642
  /**
@@ -65017,6 +65083,7 @@ var ts;
65017
65083
  return 0 /* False */;
65018
65084
  }
65019
65085
  function reportErrorResults(originalSource, originalTarget, source, target, headMessage) {
65086
+ var _a, _b;
65020
65087
  var sourceHasBase = !!getSingleBaseForNonAugmentingSubtype(originalSource);
65021
65088
  var targetHasBase = !!getSingleBaseForNonAugmentingSubtype(originalTarget);
65022
65089
  source = (originalSource.aliasSymbol || sourceHasBase) ? originalSource : source;
@@ -65057,6 +65124,9 @@ var ts;
65057
65124
  return;
65058
65125
  }
65059
65126
  reportRelationError(headMessage, source, target);
65127
+ 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 */))) {
65128
+ associateRelatedInfo(ts.createDiagnosticForNode(source.symbol.declarations[0], ts.Diagnostics.This_type_parameter_probably_needs_an_extends_object_constraint));
65129
+ }
65060
65130
  }
65061
65131
  function traceUnionsOrIntersectionsTooLarge(source, target) {
65062
65132
  if (!ts.tracing) {
@@ -65843,13 +65913,6 @@ var ts;
65843
65913
  // IndexedAccess comparisons are handled above in the `targetFlags & TypeFlage.IndexedAccess` branch
65844
65914
  if (!(sourceFlags & 8388608 /* IndexedAccess */ && targetFlags & 8388608 /* IndexedAccess */)) {
65845
65915
  var constraint = getConstraintOfType(source) || unknownType;
65846
- if (!getConstraintOfType(source) || (sourceFlags & 262144 /* TypeParameter */ && constraint.flags & 1 /* Any */)) {
65847
- // A type variable with no constraint is not related to the non-primitive object type.
65848
- if (result = isRelatedTo(emptyObjectType, extractTypesOfKind(target, ~67108864 /* NonPrimitive */), 3 /* Both */)) {
65849
- resetErrorInfo(saveErrorInfo);
65850
- return result;
65851
- }
65852
- }
65853
65916
  // 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
65854
65917
  if (result = isRelatedTo(constraint, target, 1 /* Source */, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState)) {
65855
65918
  resetErrorInfo(saveErrorInfo);
@@ -67323,9 +67386,11 @@ var ts;
67323
67386
  return getSupertypeOrUnion(types);
67324
67387
  }
67325
67388
  var primaryTypes = ts.filter(types, function (t) { return !(t.flags & 98304 /* Nullable */); });
67326
- return primaryTypes.length ?
67327
- getNullableType(getSupertypeOrUnion(primaryTypes), getFalsyFlagsOfTypes(types) & 98304 /* Nullable */) :
67328
- getUnionType(types, 2 /* Subtype */);
67389
+ if (primaryTypes.length) {
67390
+ var supertypeOrUnion = getSupertypeOrUnion(primaryTypes);
67391
+ return primaryTypes === types ? supertypeOrUnion : getUnionType(__spreadArray([supertypeOrUnion], ts.filter(types, function (t) { return !!(t.flags & 98304 /* Nullable */); }), true));
67392
+ }
67393
+ return getUnionType(types, 2 /* Subtype */);
67329
67394
  }
67330
67395
  // Return the leftmost type for which no type to the right is a subtype.
67331
67396
  function getCommonSubtype(types) {
@@ -67512,29 +67577,8 @@ var ts;
67512
67577
  var value = _a.value;
67513
67578
  return value.base10Value === "0";
67514
67579
  }
67515
- function getFalsyFlagsOfTypes(types) {
67516
- var result = 0;
67517
- for (var _i = 0, types_14 = types; _i < types_14.length; _i++) {
67518
- var t = types_14[_i];
67519
- result |= getFalsyFlags(t);
67520
- }
67521
- return result;
67522
- }
67523
- // Returns the String, Number, Boolean, StringLiteral, NumberLiteral, BooleanLiteral, Void, Undefined, or Null
67524
- // flags for the string, number, boolean, "", 0, false, void, undefined, or null types respectively. Returns
67525
- // no flags for all other types (including non-falsy literal types).
67526
- function getFalsyFlags(type) {
67527
- return type.flags & 1048576 /* Union */ ? getFalsyFlagsOfTypes(type.types) :
67528
- type.flags & 128 /* StringLiteral */ ? type.value === "" ? 128 /* StringLiteral */ : 0 :
67529
- type.flags & 256 /* NumberLiteral */ ? type.value === 0 ? 256 /* NumberLiteral */ : 0 :
67530
- type.flags & 2048 /* BigIntLiteral */ ? isZeroBigInt(type) ? 2048 /* BigIntLiteral */ : 0 :
67531
- type.flags & 512 /* BooleanLiteral */ ? (type === falseType || type === regularFalseType) ? 512 /* BooleanLiteral */ : 0 :
67532
- type.flags & 117724 /* PossiblyFalsy */;
67533
- }
67534
67580
  function removeDefinitelyFalsyTypes(type) {
67535
- return getFalsyFlags(type) & 117632 /* DefinitelyFalsy */ ?
67536
- filterType(type, function (t) { return !(getFalsyFlags(t) & 117632 /* DefinitelyFalsy */); }) :
67537
- type;
67581
+ return filterType(type, function (t) { return !!(getTypeFacts(t) & 4194304 /* Truthy */); });
67538
67582
  }
67539
67583
  function extractDefinitelyFalsyTypes(type) {
67540
67584
  return mapType(type, getDefinitelyFalsyPartOfType);
@@ -67569,20 +67613,15 @@ var ts;
67569
67613
  return type.flags & 32768 /* Undefined */ ? type : getUnionType([type, isProperty ? missingType : undefinedType]);
67570
67614
  }
67571
67615
  function getGlobalNonNullableTypeInstantiation(type) {
67572
- // First reduce away any constituents that are assignable to 'undefined' or 'null'. This not only eliminates
67573
- // 'undefined' and 'null', but also higher-order types such as a type parameter 'U extends undefined | null'
67574
- // that isn't eliminated by a NonNullable<T> instantiation.
67575
- var reducedType = getTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
67576
67616
  if (!deferredGlobalNonNullableTypeAlias) {
67577
67617
  deferredGlobalNonNullableTypeAlias = getGlobalSymbol("NonNullable", 524288 /* TypeAlias */, /*diagnostic*/ undefined) || unknownSymbol;
67578
67618
  }
67579
- // If the NonNullable<T> type is available, return an instantiation. Otherwise just return the reduced type.
67580
67619
  return deferredGlobalNonNullableTypeAlias !== unknownSymbol ?
67581
- getTypeAliasInstantiation(deferredGlobalNonNullableTypeAlias, [reducedType]) :
67582
- reducedType;
67620
+ getTypeAliasInstantiation(deferredGlobalNonNullableTypeAlias, [type]) :
67621
+ getIntersectionType([type, emptyObjectType]);
67583
67622
  }
67584
67623
  function getNonNullableType(type) {
67585
- return strictNullChecks ? getGlobalNonNullableTypeInstantiation(type) : type;
67624
+ return strictNullChecks ? getAdjustedTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */) : type;
67586
67625
  }
67587
67626
  function addOptionalTypeMarker(type) {
67588
67627
  return strictNullChecks ? getUnionType([type, optionalType]) : type;
@@ -68726,8 +68765,8 @@ var ts;
68726
68765
  }
68727
68766
  function getSingleTypeVariableFromIntersectionTypes(types) {
68728
68767
  var typeVariable;
68729
- for (var _i = 0, types_15 = types; _i < types_15.length; _i++) {
68730
- var type = types_15[_i];
68768
+ for (var _i = 0, types_14 = types; _i < types_14.length; _i++) {
68769
+ var type = types_14[_i];
68731
68770
  var t = type.flags & 2097152 /* Intersection */ && ts.find(type.types, function (t) { return !!getInferenceInfoForType(t); });
68732
68771
  if (!t || typeVariable && t !== typeVariable) {
68733
68772
  return undefined;
@@ -69480,8 +69519,8 @@ var ts;
69480
69519
  }
69481
69520
  }
69482
69521
  };
69483
- for (var _i = 0, types_16 = types; _i < types_16.length; _i++) {
69484
- var type = types_16[_i];
69522
+ for (var _i = 0, types_15 = types; _i < types_15.length; _i++) {
69523
+ var type = types_15[_i];
69485
69524
  var state_9 = _loop_24(type);
69486
69525
  if (typeof state_9 === "object")
69487
69526
  return state_9.value;
@@ -69596,14 +69635,16 @@ var ts;
69596
69635
  return !!(resolved.callSignatures.length || resolved.constructSignatures.length ||
69597
69636
  resolved.members.get("bind") && isTypeSubtypeOf(type, globalFunctionType));
69598
69637
  }
69599
- function getTypeFacts(type, ignoreObjects) {
69600
- if (ignoreObjects === void 0) { ignoreObjects = false; }
69638
+ function getTypeFacts(type) {
69639
+ if (type.flags & (2097152 /* Intersection */ | 465829888 /* Instantiable */)) {
69640
+ type = getBaseConstraintOfType(type) || unknownType;
69641
+ }
69601
69642
  var flags = type.flags;
69602
- if (flags & 4 /* String */) {
69643
+ if (flags & (4 /* String */ | 268435456 /* StringMapping */)) {
69603
69644
  return strictNullChecks ? 16317953 /* StringStrictFacts */ : 16776705 /* StringFacts */;
69604
69645
  }
69605
- if (flags & 128 /* StringLiteral */) {
69606
- var isEmpty = type.value === "";
69646
+ if (flags & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */)) {
69647
+ var isEmpty = flags & 128 /* StringLiteral */ && type.value === "";
69607
69648
  return strictNullChecks ?
69608
69649
  isEmpty ? 12123649 /* EmptyStringStrictFacts */ : 7929345 /* NonEmptyStringStrictFacts */ :
69609
69650
  isEmpty ? 12582401 /* EmptyStringFacts */ : 16776705 /* NonEmptyStringFacts */;
@@ -69635,20 +69676,20 @@ var ts;
69635
69676
  (type === falseType || type === regularFalseType) ? 12580616 /* FalseFacts */ : 16774920 /* TrueFacts */;
69636
69677
  }
69637
69678
  if (flags & 524288 /* Object */) {
69638
- if (ignoreObjects) {
69639
- return 16768959 /* AndFactsMask */; // This is the identity element for computing type facts of intersection.
69640
- }
69641
69679
  return ts.getObjectFlags(type) & 16 /* Anonymous */ && isEmptyObjectType(type) ?
69642
- strictNullChecks ? 16318463 /* EmptyObjectStrictFacts */ : 16777215 /* EmptyObjectFacts */ :
69680
+ strictNullChecks ? 83427327 /* EmptyObjectStrictFacts */ : 83886079 /* EmptyObjectFacts */ :
69643
69681
  isFunctionObjectType(type) ?
69644
69682
  strictNullChecks ? 7880640 /* FunctionStrictFacts */ : 16728000 /* FunctionFacts */ :
69645
69683
  strictNullChecks ? 7888800 /* ObjectStrictFacts */ : 16736160 /* ObjectFacts */;
69646
69684
  }
69647
- if (flags & (16384 /* Void */ | 32768 /* Undefined */)) {
69648
- return 9830144 /* UndefinedFacts */;
69685
+ if (flags & 16384 /* Void */) {
69686
+ return 9830144 /* VoidFacts */;
69687
+ }
69688
+ if (flags & 32768 /* Undefined */) {
69689
+ return 26607360 /* UndefinedFacts */;
69649
69690
  }
69650
69691
  if (flags & 65536 /* Null */) {
69651
- return 9363232 /* NullFacts */;
69692
+ return 42917664 /* NullFacts */;
69652
69693
  }
69653
69694
  if (flags & 12288 /* ESSymbolLike */) {
69654
69695
  return strictNullChecks ? 7925520 /* SymbolStrictFacts */ : 16772880 /* SymbolFacts */;
@@ -69659,37 +69700,56 @@ var ts;
69659
69700
  if (flags & 131072 /* Never */) {
69660
69701
  return 0 /* None */;
69661
69702
  }
69662
- if (flags & 465829888 /* Instantiable */) {
69663
- return !isPatternLiteralType(type) ? getTypeFacts(getBaseConstraintOfType(type) || unknownType, ignoreObjects) :
69664
- strictNullChecks ? 7929345 /* NonEmptyStringStrictFacts */ : 16776705 /* NonEmptyStringFacts */;
69665
- }
69666
69703
  if (flags & 1048576 /* Union */) {
69667
- return ts.reduceLeft(type.types, function (facts, t) { return facts | getTypeFacts(t, ignoreObjects); }, 0 /* None */);
69704
+ return ts.reduceLeft(type.types, function (facts, t) { return facts | getTypeFacts(t); }, 0 /* None */);
69668
69705
  }
69669
69706
  if (flags & 2097152 /* Intersection */) {
69670
- // When an intersection contains a primitive type we ignore object type constituents as they are
69671
- // presumably type tags. For example, in string & { __kind__: "name" } we ignore the object type.
69672
- ignoreObjects || (ignoreObjects = maybeTypeOfKind(type, 131068 /* Primitive */));
69673
- return getIntersectionTypeFacts(type, ignoreObjects);
69707
+ return getIntersectionTypeFacts(type);
69674
69708
  }
69675
- return 16777215 /* All */;
69709
+ return 83886079 /* UnknownFacts */;
69676
69710
  }
69677
- function getIntersectionTypeFacts(type, ignoreObjects) {
69711
+ function getIntersectionTypeFacts(type) {
69712
+ // When an intersection contains a primitive type we ignore object type constituents as they are
69713
+ // presumably type tags. For example, in string & { __kind__: "name" } we ignore the object type.
69714
+ var ignoreObjects = maybeTypeOfKind(type, 131068 /* Primitive */);
69678
69715
  // When computing the type facts of an intersection type, certain type facts are computed as `and`
69679
69716
  // and others are computed as `or`.
69680
69717
  var oredFacts = 0 /* None */;
69681
- var andedFacts = 16777215 /* All */;
69718
+ var andedFacts = 134217727 /* All */;
69682
69719
  for (var _i = 0, _a = type.types; _i < _a.length; _i++) {
69683
69720
  var t = _a[_i];
69684
- var f = getTypeFacts(t, ignoreObjects);
69685
- oredFacts |= f;
69686
- andedFacts &= f;
69721
+ if (!(ignoreObjects && t.flags & 524288 /* Object */)) {
69722
+ var f = getTypeFacts(t);
69723
+ oredFacts |= f;
69724
+ andedFacts &= f;
69725
+ }
69687
69726
  }
69688
- return oredFacts & 8256 /* OrFactsMask */ | andedFacts & 16768959 /* AndFactsMask */;
69727
+ return oredFacts & 8256 /* OrFactsMask */ | andedFacts & 134209471 /* AndFactsMask */;
69689
69728
  }
69690
69729
  function getTypeWithFacts(type, include) {
69691
69730
  return filterType(type, function (t) { return (getTypeFacts(t) & include) !== 0; });
69692
69731
  }
69732
+ // This function is similar to getTypeWithFacts, except that in strictNullChecks mode it replaces type
69733
+ // unknown with the union {} | null | undefined (and reduces that accordingly), and it intersects remaining
69734
+ // instantiable types with {}, {} | null, or {} | undefined in order to remove null and/or undefined.
69735
+ function getAdjustedTypeWithFacts(type, facts) {
69736
+ var reduced = recombineUnknownType(getTypeWithFacts(strictNullChecks && type.flags & 2 /* Unknown */ ? unknownUnionType : type, facts));
69737
+ if (strictNullChecks) {
69738
+ switch (facts) {
69739
+ case 524288 /* NEUndefined */:
69740
+ 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; });
69741
+ case 1048576 /* NENull */:
69742
+ 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; });
69743
+ case 2097152 /* NEUndefinedOrNull */:
69744
+ case 4194304 /* Truthy */:
69745
+ return mapType(reduced, function (t) { return getTypeFacts(t) & 262144 /* EQUndefinedOrNull */ ? getGlobalNonNullableTypeInstantiation(t) : t; });
69746
+ }
69747
+ }
69748
+ return reduced;
69749
+ }
69750
+ function recombineUnknownType(type) {
69751
+ return type === unknownUnionType ? unknownType : type;
69752
+ }
69693
69753
  function getTypeWithDefault(type, defaultExpression) {
69694
69754
  return defaultExpression ?
69695
69755
  getUnionType([getNonUndefinedType(type), getTypeOfExpression(defaultExpression)]) :
@@ -69938,8 +69998,8 @@ var ts;
69938
69998
  var types = origin && origin.flags & 1048576 /* Union */ ? origin.types : type.types;
69939
69999
  var mappedTypes;
69940
70000
  var changed = false;
69941
- for (var _i = 0, types_17 = types; _i < types_17.length; _i++) {
69942
- var t = types_17[_i];
70001
+ for (var _i = 0, types_16 = types; _i < types_16.length; _i++) {
70002
+ var t = types_16[_i];
69943
70003
  var mapped = t.flags & 1048576 /* Union */ ? mapType(t, mapper, noReductions) : mapper(t);
69944
70004
  changed || (changed = t !== mapped);
69945
70005
  if (mapped) {
@@ -70025,8 +70085,8 @@ var ts;
70025
70085
  }
70026
70086
  function isEvolvingArrayTypeList(types) {
70027
70087
  var hasEvolvingArrayType = false;
70028
- for (var _i = 0, types_18 = types; _i < types_18.length; _i++) {
70029
- var t = types_18[_i];
70088
+ for (var _i = 0, types_17 = types; _i < types_17.length; _i++) {
70089
+ var t = types_17[_i];
70030
70090
  if (!(t.flags & 131072 /* Never */)) {
70031
70091
  if (!(ts.getObjectFlags(t) & 256 /* EvolvingArray */)) {
70032
70092
  return false;
@@ -70747,7 +70807,7 @@ var ts;
70747
70807
  if (isEvolvingArrayTypeList(types)) {
70748
70808
  return getEvolvingArrayType(getUnionType(ts.map(types, getElementTypeOfEvolvingArrayType)));
70749
70809
  }
70750
- var result = getUnionType(ts.sameMap(types, finalizeEvolvingArrayType), subtypeReduction);
70810
+ var result = recombineUnknownType(getUnionType(ts.sameMap(types, finalizeEvolvingArrayType), subtypeReduction));
70751
70811
  if (result !== declaredType && result.flags & declaredType.flags & 1048576 /* Union */ && ts.arraysEqual(result.types, declaredType.types)) {
70752
70812
  return declaredType;
70753
70813
  }
@@ -70849,11 +70909,10 @@ var ts;
70849
70909
  }
70850
70910
  function narrowTypeByTruthiness(type, expr, assumeTrue) {
70851
70911
  if (isMatchingReference(reference, expr)) {
70852
- return type.flags & 2 /* Unknown */ && assumeTrue ? nonNullUnknownType :
70853
- getTypeWithFacts(type, assumeTrue ? 4194304 /* Truthy */ : 8388608 /* Falsy */);
70912
+ return getAdjustedTypeWithFacts(type, assumeTrue ? 4194304 /* Truthy */ : 8388608 /* Falsy */);
70854
70913
  }
70855
70914
  if (strictNullChecks && assumeTrue && optionalChainContainsReference(expr, reference)) {
70856
- type = getTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
70915
+ type = getAdjustedTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
70857
70916
  }
70858
70917
  var access = getDiscriminantPropertyAccess(expr, type);
70859
70918
  if (access) {
@@ -70993,7 +71052,7 @@ var ts;
70993
71052
  // Note that we include any and unknown in the exclusion test because their domain includes null and undefined.
70994
71053
  var removeNullable = equalsOperator !== assumeTrue && everyType(valueType, function (t) { return !!(t.flags & nullableFlags); }) ||
70995
71054
  equalsOperator === assumeTrue && everyType(valueType, function (t) { return !(t.flags & (3 /* AnyOrUnknown */ | nullableFlags)); });
70996
- return removeNullable ? getTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */) : type;
71055
+ return removeNullable ? getAdjustedTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */) : type;
70997
71056
  }
70998
71057
  function narrowTypeByEquality(type, operator, value, assumeTrue) {
70999
71058
  if (type.flags & 1 /* Any */) {
@@ -71003,9 +71062,6 @@ var ts;
71003
71062
  assumeTrue = !assumeTrue;
71004
71063
  }
71005
71064
  var valueType = getTypeOfExpression(value);
71006
- if (assumeTrue && (type.flags & 2 /* Unknown */) && (operator === 34 /* EqualsEqualsToken */ || operator === 35 /* ExclamationEqualsToken */) && (valueType.flags & 65536 /* Null */)) {
71007
- return getUnionType([nullType, undefinedType]);
71008
- }
71009
71065
  if ((type.flags & 2 /* Unknown */) && assumeTrue && (operator === 36 /* EqualsEqualsEqualsToken */ || operator === 37 /* ExclamationEqualsEqualsToken */)) {
71010
71066
  if (valueType.flags & (131068 /* Primitive */ | 67108864 /* NonPrimitive */)) {
71011
71067
  return valueType;
@@ -71025,7 +71081,7 @@ var ts;
71025
71081
  valueType.flags & 65536 /* Null */ ?
71026
71082
  assumeTrue ? 131072 /* EQNull */ : 1048576 /* NENull */ :
71027
71083
  assumeTrue ? 65536 /* EQUndefined */ : 524288 /* NEUndefined */;
71028
- return type.flags & 2 /* Unknown */ && facts & (1048576 /* NENull */ | 2097152 /* NEUndefinedOrNull */) ? nonNullUnknownType : getTypeWithFacts(type, facts);
71084
+ return getAdjustedTypeWithFacts(type, facts);
71029
71085
  }
71030
71086
  if (assumeTrue) {
71031
71087
  var filterFn = operator === 34 /* EqualsEqualsToken */ ?
@@ -71046,24 +71102,18 @@ var ts;
71046
71102
  var target = getReferenceCandidate(typeOfExpr.expression);
71047
71103
  if (!isMatchingReference(reference, target)) {
71048
71104
  if (strictNullChecks && optionalChainContainsReference(target, reference) && assumeTrue === (literal.text !== "undefined")) {
71049
- return getTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
71105
+ return getAdjustedTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
71050
71106
  }
71051
71107
  return type;
71052
71108
  }
71053
71109
  if (type.flags & 1 /* Any */ && literal.text === "function") {
71054
71110
  return type;
71055
71111
  }
71056
- if (assumeTrue && type.flags & 2 /* Unknown */ && literal.text === "object") {
71057
- // The non-null unknown type is used to track whether a previous narrowing operation has removed the null type
71058
- // from the unknown type. For example, the expression `x && typeof x === 'object'` first narrows x to the non-null
71059
- // unknown type, and then narrows that to the non-primitive type.
71060
- return type === nonNullUnknownType ? nonPrimitiveType : getUnionType([nonPrimitiveType, nullType]);
71061
- }
71062
71112
  var facts = assumeTrue ?
71063
71113
  typeofEQFacts.get(literal.text) || 128 /* TypeofEQHostObject */ :
71064
71114
  typeofNEFacts.get(literal.text) || 32768 /* TypeofNEHostObject */;
71065
71115
  var impliedType = getImpliedTypeFromTypeofGuard(type, literal.text);
71066
- return getTypeWithFacts(assumeTrue && impliedType ? mapType(type, narrowUnionMemberByTypeof(impliedType)) : type, facts);
71116
+ return getTypeWithFacts(assumeTrue && impliedType ? narrowTypeByImpliedType(type, impliedType) : type, facts);
71067
71117
  }
71068
71118
  function narrowTypeBySwitchOptionalChainContainment(type, switchStatement, clauseStart, clauseEnd, clauseCheck) {
71069
71119
  var everyClauseChecks = clauseStart !== clauseEnd && ts.every(getSwitchClauseTypes(switchStatement).slice(clauseStart, clauseEnd), clauseCheck);
@@ -71112,10 +71162,10 @@ var ts;
71112
71162
  }
71113
71163
  function getImpliedTypeFromTypeofGuard(type, text) {
71114
71164
  switch (text) {
71165
+ case "object":
71166
+ return type.flags & 1 /* Any */ ? type : getUnionType([nullType, nonPrimitiveType]);
71115
71167
  case "function":
71116
71168
  return type.flags & 1 /* Any */ ? type : globalFunctionType;
71117
- case "object":
71118
- return type.flags & 2 /* Unknown */ ? getUnionType([nonPrimitiveType, nullType]) : type;
71119
71169
  default:
71120
71170
  return typeofTypesByName.get(text);
71121
71171
  }
@@ -71126,22 +71176,27 @@ var ts;
71126
71176
  // the guard. For example: narrowing `{} | undefined` by `"boolean"` should produce the type `boolean`, not
71127
71177
  // the filtered type `{}`. For this reason we narrow constituents of the union individually, in addition to
71128
71178
  // filtering by type-facts.
71129
- function narrowUnionMemberByTypeof(candidate) {
71130
- return function (type) {
71131
- if (isTypeSubtypeOf(type, candidate)) {
71132
- return type;
71133
- }
71134
- if (isTypeSubtypeOf(candidate, type)) {
71135
- return candidate;
71179
+ function narrowTypeByImpliedType(type, candidate) {
71180
+ if (type.flags & 3 /* AnyOrUnknown */) {
71181
+ return candidate;
71182
+ }
71183
+ return mapType(type, function (t) {
71184
+ if (isTypeRelatedTo(t, candidate, strictSubtypeRelation)) {
71185
+ return t;
71136
71186
  }
71137
- if (type.flags & 465829888 /* Instantiable */) {
71138
- var constraint = getBaseConstraintOfType(type) || anyType;
71139
- if (isTypeSubtypeOf(candidate, constraint)) {
71140
- return getIntersectionType([type, candidate]);
71187
+ return mapType(candidate, function (c) {
71188
+ if (!areTypesComparable(t, c)) {
71189
+ return neverType;
71141
71190
  }
71142
- }
71143
- return type;
71144
- };
71191
+ if (c.flags & 131068 /* Primitive */ && t.flags & 524288 /* Object */ && !isEmptyAnonymousObjectType(t)) {
71192
+ return isTypeSubtypeOf(c, t) ? c : neverType;
71193
+ }
71194
+ if (c === globalFunctionType && isTypeSubtypeOf(c, t)) {
71195
+ return c;
71196
+ }
71197
+ return getIntersectionType([t, c]);
71198
+ });
71199
+ });
71145
71200
  }
71146
71201
  function narrowBySwitchOnTypeOf(type, switchStatement, clauseStart, clauseEnd) {
71147
71202
  var switchWitnesses = getSwitchClauseTypeOfWitnesses(switchStatement, /*retainDefault*/ true);
@@ -71200,7 +71255,7 @@ var ts;
71200
71255
  because it is caught in the first clause.
71201
71256
  */
71202
71257
  var impliedType = getTypeWithFacts(getUnionType(clauseWitnesses.map(function (text) { return getImpliedTypeFromTypeofGuard(type, text) || type; })), switchFacts);
71203
- return getTypeWithFacts(mapType(type, narrowUnionMemberByTypeof(impliedType)), switchFacts);
71258
+ return getTypeWithFacts(narrowTypeByImpliedType(type, impliedType), switchFacts);
71204
71259
  }
71205
71260
  function isMatchingConstructorReference(expr) {
71206
71261
  return (ts.isPropertyAccessExpression(expr) && ts.idText(expr.name) === "constructor" ||
@@ -71251,7 +71306,7 @@ var ts;
71251
71306
  var left = getReferenceCandidate(expr.left);
71252
71307
  if (!isMatchingReference(reference, left)) {
71253
71308
  if (assumeTrue && strictNullChecks && optionalChainContainsReference(left, reference)) {
71254
- return getTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
71309
+ return getAdjustedTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
71255
71310
  }
71256
71311
  return type;
71257
71312
  }
@@ -71339,7 +71394,7 @@ var ts;
71339
71394
  }
71340
71395
  if (strictNullChecks && assumeTrue && optionalChainContainsReference(predicateArgument, reference) &&
71341
71396
  !(getTypeFacts(predicate.type) & 65536 /* EQUndefined */)) {
71342
- type = getTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
71397
+ type = getAdjustedTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
71343
71398
  }
71344
71399
  var access = getDiscriminantPropertyAccess(predicateArgument, type);
71345
71400
  if (access) {
@@ -71396,7 +71451,7 @@ var ts;
71396
71451
  }
71397
71452
  function narrowTypeByOptionality(type, expr, assumePresent) {
71398
71453
  if (isMatchingReference(reference, expr)) {
71399
- return getTypeWithFacts(type, assumePresent ? 2097152 /* NEUndefinedOrNull */ : 262144 /* EQUndefinedOrNull */);
71454
+ return getAdjustedTypeWithFacts(type, assumePresent ? 2097152 /* NEUndefinedOrNull */ : 262144 /* EQUndefinedOrNull */);
71400
71455
  }
71401
71456
  var access = getDiscriminantPropertyAccess(expr, type);
71402
71457
  if (access) {
@@ -71482,8 +71537,8 @@ var ts;
71482
71537
  var annotationIncludesUndefined = strictNullChecks &&
71483
71538
  declaration.kind === 164 /* Parameter */ &&
71484
71539
  declaration.initializer &&
71485
- getFalsyFlags(declaredType) & 32768 /* Undefined */ &&
71486
- !(getFalsyFlags(checkExpression(declaration.initializer)) & 32768 /* Undefined */);
71540
+ getTypeFacts(declaredType) & 16777216 /* IsUndefined */ &&
71541
+ !(getTypeFacts(checkExpression(declaration.initializer)) & 16777216 /* IsUndefined */);
71487
71542
  popTypeResolution();
71488
71543
  return annotationIncludesUndefined ? getTypeWithFacts(declaredType, 524288 /* NEUndefined */) : declaredType;
71489
71544
  }
@@ -71504,7 +71559,9 @@ var ts;
71504
71559
  !(someType(type, isGenericTypeWithoutNullableConstraint) && isGenericIndexType(getTypeOfExpression(parent.argumentExpression)));
71505
71560
  }
71506
71561
  function isGenericTypeWithUnionConstraint(type) {
71507
- return !!(type.flags & 465829888 /* Instantiable */ && getBaseConstraintOrType(type).flags & (98304 /* Nullable */ | 1048576 /* Union */));
71562
+ return type.flags & 2097152 /* Intersection */ ?
71563
+ ts.some(type.types, isGenericTypeWithUnionConstraint) :
71564
+ !!(type.flags & 465829888 /* Instantiable */ && getBaseConstraintOrType(type).flags & (98304 /* Nullable */ | 1048576 /* Union */));
71508
71565
  }
71509
71566
  function isGenericTypeWithoutNullableConstraint(type) {
71510
71567
  return !!(type.flags & 465829888 /* Instantiable */ && !maybeTypeOfKind(getBaseConstraintOrType(type), 98304 /* Nullable */));
@@ -71532,7 +71589,7 @@ var ts;
71532
71589
  var substituteConstraints = !(checkMode && checkMode & 2 /* Inferential */) &&
71533
71590
  someType(type, isGenericTypeWithUnionConstraint) &&
71534
71591
  (isConstraintPosition(type, reference) || hasContextualTypeWithNoGenericTypes(reference, checkMode));
71535
- return substituteConstraints ? mapType(type, function (t) { return t.flags & 465829888 /* Instantiable */ ? getBaseConstraintOrType(t) : t; }) : type;
71592
+ return substituteConstraints ? mapType(type, getBaseConstraintOrType) : type;
71536
71593
  }
71537
71594
  function isExportOrExportExpression(location) {
71538
71595
  return !!ts.findAncestor(location, function (n) {
@@ -71809,7 +71866,7 @@ var ts;
71809
71866
  return convertAutoToAny(flowType);
71810
71867
  }
71811
71868
  }
71812
- else if (!assumeInitialized && !(getFalsyFlags(type) & 32768 /* Undefined */) && getFalsyFlags(flowType) & 32768 /* Undefined */) {
71869
+ else if (!assumeInitialized && !(getTypeFacts(type) & 16777216 /* IsUndefined */) && getTypeFacts(flowType) & 16777216 /* IsUndefined */) {
71813
71870
  error(node, ts.Diagnostics.Variable_0_is_used_before_being_assigned, symbolToString(symbol));
71814
71871
  // Return the declared type to reduce follow-on errors
71815
71872
  return type;
@@ -73338,8 +73395,8 @@ var ts;
73338
73395
  }
73339
73396
  var signatureList;
73340
73397
  var types = type.types;
73341
- for (var _i = 0, types_19 = types; _i < types_19.length; _i++) {
73342
- var current = types_19[_i];
73398
+ for (var _i = 0, types_18 = types; _i < types_18.length; _i++) {
73399
+ var current = types_18[_i];
73343
73400
  var signature = getContextualCallSignature(current, node);
73344
73401
  if (signature) {
73345
73402
  if (!signatureList) {
@@ -74501,19 +74558,19 @@ var ts;
74501
74558
  return checkNonNullType(checkExpression(node), node);
74502
74559
  }
74503
74560
  function isNullableType(type) {
74504
- return !!((strictNullChecks ? getFalsyFlags(type) : type.flags) & 98304 /* Nullable */);
74561
+ return !!(getTypeFacts(type) & 50331648 /* IsUndefinedOrNull */);
74505
74562
  }
74506
74563
  function getNonNullableTypeIfNeeded(type) {
74507
74564
  return isNullableType(type) ? getNonNullableType(type) : type;
74508
74565
  }
74509
- function reportObjectPossiblyNullOrUndefinedError(node, flags) {
74510
- error(node, flags & 32768 /* Undefined */ ? flags & 65536 /* Null */ ?
74566
+ function reportObjectPossiblyNullOrUndefinedError(node, facts) {
74567
+ error(node, facts & 16777216 /* IsUndefined */ ? facts & 33554432 /* IsNull */ ?
74511
74568
  ts.Diagnostics.Object_is_possibly_null_or_undefined :
74512
74569
  ts.Diagnostics.Object_is_possibly_undefined :
74513
74570
  ts.Diagnostics.Object_is_possibly_null);
74514
74571
  }
74515
- function reportCannotInvokePossiblyNullOrUndefinedError(node, flags) {
74516
- error(node, flags & 32768 /* Undefined */ ? flags & 65536 /* Null */ ?
74572
+ function reportCannotInvokePossiblyNullOrUndefinedError(node, facts) {
74573
+ error(node, facts & 16777216 /* IsUndefined */ ? facts & 33554432 /* IsNull */ ?
74517
74574
  ts.Diagnostics.Cannot_invoke_an_object_which_is_possibly_null_or_undefined :
74518
74575
  ts.Diagnostics.Cannot_invoke_an_object_which_is_possibly_undefined :
74519
74576
  ts.Diagnostics.Cannot_invoke_an_object_which_is_possibly_null);
@@ -74523,9 +74580,9 @@ var ts;
74523
74580
  error(node, ts.Diagnostics.Object_is_of_type_unknown);
74524
74581
  return errorType;
74525
74582
  }
74526
- var kind = (strictNullChecks ? getFalsyFlags(type) : type.flags) & 98304 /* Nullable */;
74527
- if (kind) {
74528
- reportError(node, kind);
74583
+ var facts = getTypeFacts(type);
74584
+ if (facts & 50331648 /* IsUndefinedOrNull */) {
74585
+ reportError(node, facts);
74529
74586
  var t = getNonNullableType(type);
74530
74587
  return t.flags & (98304 /* Nullable */ | 131072 /* Never */) ? errorType : t;
74531
74588
  }
@@ -74820,7 +74877,7 @@ var ts;
74820
74877
  assumeUninitialized = true;
74821
74878
  }
74822
74879
  var flowType = getFlowTypeOfReference(node, propType, assumeUninitialized ? getOptionalType(propType) : propType);
74823
- if (assumeUninitialized && !(getFalsyFlags(propType) & 32768 /* Undefined */) && getFalsyFlags(flowType) & 32768 /* Undefined */) {
74880
+ if (assumeUninitialized && !(getTypeFacts(propType) & 16777216 /* IsUndefined */) && getTypeFacts(flowType) & 16777216 /* IsUndefined */) {
74824
74881
  error(errorNode, ts.Diagnostics.Property_0_is_used_before_being_assigned, symbolToString(prop)); // TODO: GH#18217
74825
74882
  // Return the declared type to reduce follow-on errors
74826
74883
  return propType;
@@ -76736,8 +76793,8 @@ var ts;
76736
76793
  if (apparentType.flags & 1048576 /* Union */) {
76737
76794
  var types = apparentType.types;
76738
76795
  var hasSignatures = false;
76739
- for (var _i = 0, types_20 = types; _i < types_20.length; _i++) {
76740
- var constituent = types_20[_i];
76796
+ for (var _i = 0, types_19 = types; _i < types_19.length; _i++) {
76797
+ var constituent = types_19[_i];
76741
76798
  var signatures = getSignaturesOfType(constituent, kind);
76742
76799
  if (signatures.length !== 0) {
76743
76800
  hasSignatures = true;
@@ -78428,7 +78485,7 @@ var ts;
78428
78485
  var type = getTypeOfSymbol(symbol);
78429
78486
  if (strictNullChecks &&
78430
78487
  !(type.flags & (3 /* AnyOrUnknown */ | 131072 /* Never */)) &&
78431
- !(exactOptionalPropertyTypes ? symbol.flags & 16777216 /* Optional */ : getFalsyFlags(type) & 32768 /* Undefined */)) {
78488
+ !(exactOptionalPropertyTypes ? symbol.flags & 16777216 /* Optional */ : getTypeFacts(type) & 16777216 /* IsUndefined */)) {
78432
78489
  error(expr, ts.Diagnostics.The_operand_of_a_delete_operator_must_be_optional);
78433
78490
  }
78434
78491
  }
@@ -78596,8 +78653,8 @@ var ts;
78596
78653
  }
78597
78654
  if (type.flags & 3145728 /* UnionOrIntersection */) {
78598
78655
  var types = type.types;
78599
- for (var _i = 0, types_21 = types; _i < types_21.length; _i++) {
78600
- var t = types_21[_i];
78656
+ for (var _i = 0, types_20 = types; _i < types_20.length; _i++) {
78657
+ var t = types_20[_i];
78601
78658
  if (maybeTypeOfKind(t, kind)) {
78602
78659
  return true;
78603
78660
  }
@@ -78824,7 +78881,7 @@ var ts;
78824
78881
  // In strict null checking mode, if a default value of a non-undefined type is specified, remove
78825
78882
  // undefined from the final type.
78826
78883
  if (strictNullChecks &&
78827
- !(getFalsyFlags(checkExpression(prop.objectAssignmentInitializer)) & 32768 /* Undefined */)) {
78884
+ !(getTypeFacts(checkExpression(prop.objectAssignmentInitializer)) & 16777216 /* IsUndefined */)) {
78828
78885
  sourceType = getTypeWithFacts(sourceType, 524288 /* NEUndefined */);
78829
78886
  }
78830
78887
  checkBinaryLikeExpression(prop.name, prop.equalsToken, prop.objectAssignmentInitializer, checkMode);
@@ -79224,7 +79281,7 @@ var ts;
79224
79281
  case 56 /* BarBarToken */:
79225
79282
  case 75 /* BarBarEqualsToken */: {
79226
79283
  var resultType_3 = getTypeFacts(leftType) & 8388608 /* Falsy */ ?
79227
- getUnionType([removeDefinitelyFalsyTypes(leftType), rightType], 2 /* Subtype */) :
79284
+ getUnionType([getNonNullableType(removeDefinitelyFalsyTypes(leftType)), rightType], 2 /* Subtype */) :
79228
79285
  leftType;
79229
79286
  if (operator === 75 /* BarBarEqualsToken */) {
79230
79287
  checkAssignmentOperator(rightType);
@@ -81765,8 +81822,8 @@ var ts;
81765
81822
  }
81766
81823
  function getEntityNameForDecoratorMetadataFromTypeList(types) {
81767
81824
  var commonEntityName;
81768
- for (var _i = 0, types_22 = types; _i < types_22.length; _i++) {
81769
- var typeNode = types_22[_i];
81825
+ for (var _i = 0, types_21 = types; _i < types_21.length; _i++) {
81826
+ var typeNode = types_21[_i];
81770
81827
  while (typeNode.kind === 191 /* ParenthesizedType */ || typeNode.kind === 197 /* NamedTupleMember */) {
81771
81828
  typeNode = typeNode.type; // Skip parens if need be
81772
81829
  }
@@ -82632,7 +82689,7 @@ var ts;
82632
82689
  // For a binding pattern, validate the initializer and exit
82633
82690
  if (ts.isBindingPattern(node.name)) {
82634
82691
  var needCheckInitializer = node.initializer && node.parent.parent.kind !== 243 /* ForInStatement */;
82635
- var needCheckWidenedType = node.name.elements.length === 0;
82692
+ var needCheckWidenedType = !ts.some(node.name.elements, ts.not(ts.isOmittedExpression));
82636
82693
  if (needCheckInitializer || needCheckWidenedType) {
82637
82694
  // Don't validate for-in initializer as it is already an error
82638
82695
  var widenedType = getWidenedTypeForVariableLikeDeclaration(node);
@@ -82785,7 +82842,7 @@ var ts;
82785
82842
  return;
82786
82843
  var type = checkTruthinessExpression(location);
82787
82844
  var isPropertyExpressionCast = ts.isPropertyAccessExpression(location) && isTypeAssertion(location.expression);
82788
- if (getFalsyFlags(type) || isPropertyExpressionCast)
82845
+ if (!(getTypeFacts(type) & 4194304 /* Truthy */) || isPropertyExpressionCast)
82789
82846
  return;
82790
82847
  // While it technically should be invalid for any known-truthy value
82791
82848
  // to be tested, we de-scope to functions and Promises unreferenced in
@@ -84471,18 +84528,17 @@ var ts;
84471
84528
  // but not by other kinds of members.
84472
84529
  // Base class instance member variables and accessors can be overridden by
84473
84530
  // derived class instance member variables and accessors, but not by other kinds of members.
84474
- var _a, _b;
84531
+ var _a, _b, _c, _d;
84475
84532
  // NOTE: assignability is checked in checkClassDeclaration
84476
84533
  var baseProperties = getPropertiesOfType(baseType);
84477
- basePropertyCheck: for (var _i = 0, baseProperties_1 = baseProperties; _i < baseProperties_1.length; _i++) {
84478
- var baseProperty = baseProperties_1[_i];
84534
+ var _loop_33 = function (baseProperty) {
84479
84535
  var base = getTargetSymbol(baseProperty);
84480
84536
  if (base.flags & 4194304 /* Prototype */) {
84481
- continue;
84537
+ return "continue";
84482
84538
  }
84483
84539
  var baseSymbol = getPropertyOfObjectType(type, base.escapedName);
84484
84540
  if (!baseSymbol) {
84485
- continue;
84541
+ return "continue";
84486
84542
  }
84487
84543
  var derived = getTargetSymbol(baseSymbol);
84488
84544
  var baseDeclarationFlags = ts.getDeclarationModifierFlagsFromSymbol(base);
@@ -84500,14 +84556,14 @@ var ts;
84500
84556
  // Searches other base types for a declaration that would satisfy the inherited abstract member.
84501
84557
  // (The class may have more than one base type via declaration merging with an interface with the
84502
84558
  // same name.)
84503
- for (var _c = 0, _d = getBaseTypes(type); _c < _d.length; _c++) {
84504
- var otherBaseType = _d[_c];
84559
+ for (var _e = 0, _f = getBaseTypes(type); _e < _f.length; _e++) {
84560
+ var otherBaseType = _f[_e];
84505
84561
  if (otherBaseType === baseType)
84506
84562
  continue;
84507
84563
  var baseSymbol_1 = getPropertyOfObjectType(otherBaseType, base.escapedName);
84508
84564
  var derivedElsewhere = baseSymbol_1 && getTargetSymbol(baseSymbol_1);
84509
84565
  if (derivedElsewhere && derivedElsewhere !== base) {
84510
- continue basePropertyCheck;
84566
+ return "continue-basePropertyCheck";
84511
84567
  }
84512
84568
  }
84513
84569
  if (derivedClassDecl.kind === 226 /* ClassExpression */) {
@@ -84522,20 +84578,19 @@ var ts;
84522
84578
  // derived overrides base.
84523
84579
  var derivedDeclarationFlags = ts.getDeclarationModifierFlagsFromSymbol(derived);
84524
84580
  if (baseDeclarationFlags & 8 /* Private */ || derivedDeclarationFlags & 8 /* Private */) {
84525
- // either base or derived property is private - not override, skip it
84526
- continue;
84581
+ return "continue";
84527
84582
  }
84528
84583
  var errorMessage = void 0;
84529
84584
  var basePropertyFlags = base.flags & 98308 /* PropertyOrAccessor */;
84530
84585
  var derivedPropertyFlags = derived.flags & 98308 /* PropertyOrAccessor */;
84531
84586
  if (basePropertyFlags && derivedPropertyFlags) {
84532
84587
  // property/accessor is overridden with property/accessor
84533
- if (baseDeclarationFlags & 128 /* Abstract */ && !(base.valueDeclaration && ts.isPropertyDeclaration(base.valueDeclaration) && base.valueDeclaration.initializer)
84534
- || base.valueDeclaration && base.valueDeclaration.parent.kind === 258 /* InterfaceDeclaration */
84588
+ if ((ts.getCheckFlags(base) & 6 /* Synthetic */
84589
+ ? (_a = base.declarations) === null || _a === void 0 ? void 0 : _a.some(function (d) { return isPropertyAbstractOrInterface(d, baseDeclarationFlags); })
84590
+ : (_b = base.declarations) === null || _b === void 0 ? void 0 : _b.every(function (d) { return isPropertyAbstractOrInterface(d, baseDeclarationFlags); }))
84591
+ || ts.getCheckFlags(base) & 262144 /* Mapped */
84535
84592
  || derived.valueDeclaration && ts.isBinaryExpression(derived.valueDeclaration)) {
84536
- // when the base property is abstract or from an interface, base/derived flags don't need to match
84537
- // same when the derived property is from an assignment
84538
- continue;
84593
+ return "continue";
84539
84594
  }
84540
84595
  var overriddenInstanceProperty = basePropertyFlags !== 4 /* Property */ && derivedPropertyFlags === 4 /* Property */;
84541
84596
  var overriddenInstanceAccessor = basePropertyFlags === 4 /* Property */ && derivedPropertyFlags !== 4 /* Property */;
@@ -84546,12 +84601,12 @@ var ts;
84546
84601
  error(ts.getNameOfDeclaration(derived.valueDeclaration) || derived.valueDeclaration, errorMessage_1, symbolToString(base), typeToString(baseType), typeToString(type));
84547
84602
  }
84548
84603
  else if (useDefineForClassFields) {
84549
- var uninitialized = (_a = derived.declarations) === null || _a === void 0 ? void 0 : _a.find(function (d) { return d.kind === 167 /* PropertyDeclaration */ && !d.initializer; });
84604
+ var uninitialized = (_c = derived.declarations) === null || _c === void 0 ? void 0 : _c.find(function (d) { return d.kind === 167 /* PropertyDeclaration */ && !d.initializer; });
84550
84605
  if (uninitialized
84551
84606
  && !(derived.flags & 33554432 /* Transient */)
84552
84607
  && !(baseDeclarationFlags & 128 /* Abstract */)
84553
84608
  && !(derivedDeclarationFlags & 128 /* Abstract */)
84554
- && !((_b = derived.declarations) === null || _b === void 0 ? void 0 : _b.some(function (d) { return !!(d.flags & 16777216 /* Ambient */); }))) {
84609
+ && !((_d = derived.declarations) === null || _d === void 0 ? void 0 : _d.some(function (d) { return !!(d.flags & 16777216 /* Ambient */); }))) {
84555
84610
  var constructor = findConstructorDeclaration(ts.getClassLikeDeclarationOfSymbol(type.symbol));
84556
84611
  var propName = uninitialized.name;
84557
84612
  if (uninitialized.exclamationToken
@@ -84564,13 +84619,11 @@ var ts;
84564
84619
  }
84565
84620
  }
84566
84621
  }
84567
- // correct case
84568
- continue;
84622
+ return "continue";
84569
84623
  }
84570
84624
  else if (isPrototypeProperty(base)) {
84571
84625
  if (isPrototypeProperty(derived) || derived.flags & 4 /* Property */) {
84572
- // method is overridden with method or property -- correct case
84573
- continue;
84626
+ return "continue";
84574
84627
  }
84575
84628
  else {
84576
84629
  ts.Debug.assert(!!(derived.flags & 98304 /* Accessor */));
@@ -84585,9 +84638,20 @@ var ts;
84585
84638
  }
84586
84639
  error(ts.getNameOfDeclaration(derived.valueDeclaration) || derived.valueDeclaration, errorMessage, typeToString(baseType), symbolToString(base), typeToString(type));
84587
84640
  }
84641
+ };
84642
+ basePropertyCheck: for (var _i = 0, baseProperties_1 = baseProperties; _i < baseProperties_1.length; _i++) {
84643
+ var baseProperty = baseProperties_1[_i];
84644
+ var state_10 = _loop_33(baseProperty);
84645
+ switch (state_10) {
84646
+ case "continue-basePropertyCheck": continue basePropertyCheck;
84647
+ }
84588
84648
  }
84589
84649
  }
84590
- function getNonInterhitedProperties(type, baseTypes, properties) {
84650
+ function isPropertyAbstractOrInterface(declaration, baseDeclarationFlags) {
84651
+ return baseDeclarationFlags & 128 /* Abstract */ && (!ts.isPropertyDeclaration(declaration) || !declaration.initializer)
84652
+ || ts.isInterfaceDeclaration(declaration.parent);
84653
+ }
84654
+ function getNonInheritedProperties(type, baseTypes, properties) {
84591
84655
  if (!ts.length(baseTypes)) {
84592
84656
  return properties;
84593
84657
  }
@@ -84656,7 +84720,7 @@ var ts;
84656
84720
  var propName = member.name;
84657
84721
  if (ts.isIdentifier(propName) || ts.isPrivateIdentifier(propName) || ts.isComputedPropertyName(propName)) {
84658
84722
  var type = getTypeOfSymbol(getSymbolOfNode(member));
84659
- if (!(type.flags & 3 /* AnyOrUnknown */ || getFalsyFlags(type) & 32768 /* Undefined */)) {
84723
+ if (!(type.flags & 3 /* AnyOrUnknown */ || getTypeFacts(type) & 16777216 /* IsUndefined */)) {
84660
84724
  if (!constructor || !isPropertyInitializedInConstructor(propName, type, constructor)) {
84661
84725
  error(member.name, ts.Diagnostics.Property_0_has_no_initializer_and_is_not_definitely_assigned_in_the_constructor, ts.declarationNameToString(propName));
84662
84726
  }
@@ -84681,7 +84745,7 @@ var ts;
84681
84745
  ts.setParent(reference, staticBlock);
84682
84746
  reference.flowNode = staticBlock.returnFlowNode;
84683
84747
  var flowType = getFlowTypeOfReference(reference, propType, getOptionalType(propType));
84684
- if (!(getFalsyFlags(flowType) & 32768 /* Undefined */)) {
84748
+ if (!(getTypeFacts(flowType) & 16777216 /* IsUndefined */)) {
84685
84749
  return true;
84686
84750
  }
84687
84751
  }
@@ -84696,7 +84760,7 @@ var ts;
84696
84760
  ts.setParent(reference, constructor);
84697
84761
  reference.flowNode = constructor.returnFlowNode;
84698
84762
  var flowType = getFlowTypeOfReference(reference, propType, getOptionalType(propType));
84699
- return !(getFalsyFlags(flowType) & 32768 /* Undefined */);
84763
+ return !(getTypeFacts(flowType) & 16777216 /* IsUndefined */);
84700
84764
  }
84701
84765
  function checkInterfaceDeclaration(node) {
84702
84766
  // Grammar checking
@@ -92984,8 +93048,8 @@ var ts;
92984
93048
  // Note when updating logic here also update getEntityNameForDecoratorMetadata
92985
93049
  // so that aliases can be marked as referenced
92986
93050
  var serializedUnion;
92987
- for (var _i = 0, types_23 = types; _i < types_23.length; _i++) {
92988
- var typeNode = types_23[_i];
93051
+ for (var _i = 0, types_22 = types; _i < types_22.length; _i++) {
93052
+ var typeNode = types_22[_i];
92989
93053
  while (typeNode.kind === 191 /* ParenthesizedType */) {
92990
93054
  typeNode = typeNode.type; // Skip parens if need be
92991
93055
  }
@@ -113634,8 +113698,8 @@ var ts;
113634
113698
  bundleFileInfo.sections.push({ pos: pos, end: writer.getTextPos(), kind: "reference" /* Reference */, data: directive.fileName });
113635
113699
  writeLine();
113636
113700
  }
113637
- for (var _d = 0, types_24 = types; _d < types_24.length; _d++) {
113638
- var directive = types_24[_d];
113701
+ for (var _d = 0, types_23 = types; _d < types_23.length; _d++) {
113702
+ var directive = types_23[_d];
113639
113703
  var pos = writer.getTextPos();
113640
113704
  var resolutionMode = directive.resolutionMode && directive.resolutionMode !== (currentSourceFile === null || currentSourceFile === void 0 ? void 0 : currentSourceFile.impliedNodeFormat)
113641
113705
  ? "resolution-mode=\"" + (directive.resolutionMode === ts.ModuleKind.ESNext ? "import" : "require") + "\""
@@ -122426,7 +122490,7 @@ var ts;
122426
122490
  });
122427
122491
  // Sort by paths closest to importing file Name directory
122428
122492
  var sortedPaths = [];
122429
- var _loop_33 = function (directory) {
122493
+ var _loop_34 = function (directory) {
122430
122494
  var directoryStart = ts.ensureTrailingDirectorySeparator(directory);
122431
122495
  var pathsInDirectory;
122432
122496
  allFileNames.forEach(function (_a, fileName) {
@@ -122450,9 +122514,9 @@ var ts;
122450
122514
  };
122451
122515
  var out_directory_1;
122452
122516
  for (var directory = ts.getDirectoryPath(importingFileName); allFileNames.size !== 0;) {
122453
- var state_10 = _loop_33(directory);
122517
+ var state_11 = _loop_34(directory);
122454
122518
  directory = out_directory_1;
122455
- if (state_10 === "break")
122519
+ if (state_11 === "break")
122456
122520
  break;
122457
122521
  }
122458
122522
  if (allFileNames.size) {
@@ -144415,7 +144479,7 @@ var ts;
144415
144479
  if (!ts.textSpanIntersectsWith(span, node.pos, node.getFullWidth())) {
144416
144480
  return;
144417
144481
  }
144418
- if (ts.isTypeNode(node)) {
144482
+ if (ts.isTypeNode(node) && !ts.isExpressionWithTypeArguments(node)) {
144419
144483
  return;
144420
144484
  }
144421
144485
  if (preferences.includeInlayVariableTypeHints && ts.isVariableDeclaration(node)) {
@@ -147526,7 +147590,6 @@ var ts;
147526
147590
  case 280 /* JsxOpeningElement */:
147527
147591
  case 281 /* JsxClosingElement */:
147528
147592
  case 279 /* JsxSelfClosingElement */:
147529
- case 228 /* ExpressionWithTypeArguments */:
147530
147593
  return false;
147531
147594
  }
147532
147595
  break;
@@ -147696,7 +147759,7 @@ var ts;
147696
147759
  var listEndToken = getCloseTokenForOpenToken(listStartToken);
147697
147760
  if (listEndToken !== 0 /* Unknown */ && formattingScanner.isOnToken() && formattingScanner.getStartPos() < originalRange.end) {
147698
147761
  var tokenInfo = formattingScanner.readTokenInfo(parent);
147699
- if (tokenInfo.token.kind === 27 /* CommaToken */ && ts.isCallLikeExpression(parent)) {
147762
+ if (tokenInfo.token.kind === 27 /* CommaToken */) {
147700
147763
  // consume the comma
147701
147764
  consumeTokenAndAdvanceScanner(tokenInfo, parent, listDynamicIndentation, parent);
147702
147765
  tokenInfo = formattingScanner.isOnToken() ? formattingScanner.readTokenInfo(parent) : undefined;
@@ -148100,6 +148163,12 @@ var ts;
148100
148163
  case 169 /* MethodDeclaration */:
148101
148164
  case 168 /* MethodSignature */:
148102
148165
  case 214 /* ArrowFunction */:
148166
+ case 174 /* CallSignature */:
148167
+ case 175 /* ConstructSignature */:
148168
+ case 179 /* FunctionType */:
148169
+ case 180 /* ConstructorType */:
148170
+ case 172 /* GetAccessor */:
148171
+ case 173 /* SetAccessor */:
148103
148172
  if (node.typeParameters === list) {
148104
148173
  return 29 /* LessThanToken */;
148105
148174
  }
@@ -148116,7 +148185,19 @@ var ts;
148116
148185
  return 20 /* OpenParenToken */;
148117
148186
  }
148118
148187
  break;
148188
+ case 257 /* ClassDeclaration */:
148189
+ case 226 /* ClassExpression */:
148190
+ case 258 /* InterfaceDeclaration */:
148191
+ case 259 /* TypeAliasDeclaration */:
148192
+ if (node.typeParameters === list) {
148193
+ return 29 /* LessThanToken */;
148194
+ }
148195
+ break;
148119
148196
  case 178 /* TypeReference */:
148197
+ case 210 /* TaggedTemplateExpression */:
148198
+ case 181 /* TypeQuery */:
148199
+ case 228 /* ExpressionWithTypeArguments */:
148200
+ case 200 /* ImportType */:
148120
148201
  if (node.typeArguments === list) {
148121
148202
  return 29 /* LessThanToken */;
148122
148203
  }