From 5a0490b4711b84c4f17ded787eb88ee8ccb648a4 Mon Sep 17 00:00:00 2001 From: Jake Bailey <5341706+jakebailey@users.noreply.github.com> Date: Fri, 7 Mar 2025 22:45:31 -0800 Subject: [PATCH 1/2] Sort unions without using type IDs --- src/compiler/checker.ts | 392 +++++++++++++++++++++++++++++++++++++++- src/compiler/core.ts | 10 +- src/compiler/types.ts | 40 ++-- 3 files changed, 413 insertions(+), 29 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 843b5b2f94d66..071ad5912a26e 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -81,9 +81,9 @@ import { classOrConstructorParameterIsDecorated, ClassStaticBlockDeclaration, clear, + compareComparableValues, compareDiagnostics, comparePaths, - compareValues, Comparison, CompilerOptions, ComputedPropertyName, @@ -424,6 +424,7 @@ import { Identifier, identifierToKeywordKind, IdentifierTypePredicate, + identity, idText, IfStatement, ImportAttribute, @@ -1492,6 +1493,8 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { var scanner: Scanner | undefined; + var fileIndexMap = new Map(host.getSourceFiles().map((file, i) => [file, i])); + var Symbol = objectAllocator.getSymbolConstructor(); var Type = objectAllocator.getTypeConstructor(); var Signature = objectAllocator.getSignatureConstructor(); @@ -5441,7 +5444,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { } function createTypeofType() { - return getUnionType(arrayFrom(typeofNEFacts.keys(), getStringLiteralType)); + return getUnionType(map([...typeofNEFacts.keys()].sort(), getStringLiteralType)); } function createTypeParameter(symbol?: Symbol) { @@ -17400,11 +17403,11 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { } function containsType(types: readonly Type[], type: Type): boolean { - return binarySearch(types, type, getTypeId, compareValues) >= 0; + return binarySearch(types, type, identity, compareTypes) >= 0; } function insertType(types: Type[], type: Type): boolean { - const index = binarySearch(types, type, getTypeId, compareValues); + const index = binarySearch(types, type, identity, compareTypes); if (index < 0) { types.splice(~index, 0, type); return true; @@ -17425,8 +17428,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { if (!(getObjectFlags(type) & ObjectFlags.ContainsWideningType)) includes |= TypeFlags.IncludesNonWideningType; } else { - const len = typeSet.length; - const index = len && type.id > typeSet[len - 1].id ? ~len : binarySearch(typeSet, type, getTypeId, compareValues); + const index = binarySearch(typeSet, type, identity, compareTypes); if (index < 0) { typeSet.splice(~index, 0, type); } @@ -52817,6 +52819,384 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { Debug.assert(specifier && nodeIsSynthesized(specifier) && specifier.text === "tslib", `Expected sourceFile.imports[0] to be the synthesized tslib import`); return specifier; } + + function compareSymbols(s1: Symbol | undefined, s2: Symbol | undefined): number { + if (s1 === s2) return 0; + if (s1 === undefined) return 1; + if (s2 === undefined) return -1; + if (length(s1.declarations) !== 0 && length(s2.declarations) !== 0) { + const r = compareNodes(s1.declarations![0], s2.declarations![0]); + if (r !== 0) return r; + } + else if (length(s1.declarations) !== 0) { + return -1; + } + else if (length(s2.declarations) !== 0) { + return 1; + } + const r = compareComparableValues(s1.escapedName as string, s2.escapedName as string); + if (r !== 0) return r; + return getSymbolId(s1) - getSymbolId(s2); + } + + function compareNodes(n1: Node | undefined, n2: Node | undefined): number { + if (n1 === n2) return 0; + if (n1 === undefined) return 1; + if (n2 === undefined) return -1; + const f1 = fileIndexMap.get(getSourceFileOfNode(n1))!; + const f2 = fileIndexMap.get(getSourceFileOfNode(n2))!; + if (f1 !== f2) { + // Order by index of file in the containing program + return f1 - f2; + } + // In the same file, order by source position + return n1.pos - n2.pos; + } + + function compareTypes(t1: Type | undefined, t2: Type | undefined): number { + if (t1 === t2) return 0; + if (t1 === undefined) return 1; + if (t2 === undefined) return -1; + + // First sort in order of increasing type flags values. + let c = getSortOrderFlags(t1) - getSortOrderFlags(t2); + if (c !== 0) return c; + + // Order named types by name and, in the case of aliased types, by alias type arguments. + c = compareTypeNames(t1, t2); + if (c !== 0) return c; + + // We have unnamed types or types with identical names. Now sort by data specific to the type. + if (t1.flags & (TypeFlags.Any | TypeFlags.Unknown | TypeFlags.String | TypeFlags.Number | TypeFlags.Boolean | TypeFlags.BigInt | TypeFlags.ESSymbol | TypeFlags.Void | TypeFlags.Undefined | TypeFlags.Null | TypeFlags.Never | TypeFlags.NonPrimitive)) { + // Only distinguished by type IDs, handled below. + } + else if (t1.flags & TypeFlags.Object) { + // Order unnamed or identically named object types by symbol. + const c = compareSymbols(t1.symbol, t2.symbol); + if (c !== 0) return c; + + // When object types have the same or no symbol, order by kind. We order type references before other kinds. + if (getObjectFlags(t1) & ObjectFlags.Reference && getObjectFlags(t2) & ObjectFlags.Reference) { + const r1 = t1 as TypeReference; + const r2 = t2 as TypeReference; + if (getObjectFlags(r1.target) & ObjectFlags.Tuple && getObjectFlags(r2.target) & ObjectFlags.Tuple) { + // Tuple types have no associated symbol, instead we order by tuple element information. + const c = compareTupleTypes(r1.target as TupleType, r2.target as TupleType); + if (c !== 0) { + return c; + } + } + // Here we know we have references to instantiations of the same type because we have matching targets. + if (r1.node === undefined && r2.node === undefined) { + // Non-deferred type references with the same target are sorted by their type argument lists. + const c = compareTypeLists((t1 as TypeReference).resolvedTypeArguments, (t2 as TypeReference).resolvedTypeArguments); + if (c !== 0) { + return c; + } + } + else { + // Deferred type references with the same target are ordered by the source location of the reference. + let c = compareNodes(r1.node, r2.node); + if (c !== 0) { + return c; + } + // Instantiations of the same deferred type reference are ordered by their associated type mappers + // (which reflect the mapping of in-scope type parameters to type arguments). + c = compareTypeMappers((t1 as AnonymousType).mapper, (t2 as AnonymousType).mapper); + if (c !== 0) { + return c; + } + } + } + else if (getObjectFlags(t1) & ObjectFlags.Reference) { + return -1; + } + else if (getObjectFlags(t2) & ObjectFlags.Reference) { + return 1; + } + else { + // Order unnamed non-reference object types by kind associated type mappers. Reverse mapped types have + // neither symbols nor mappers so they're ultimately ordered by unstable type IDs, but given their rarity + // this should be fine. + let c = getObjectFlags(t1) & ObjectFlags.ObjectTypeKindMask - getObjectFlags(t2) & ObjectFlags.ObjectTypeKindMask; + if (c !== 0) { + return c; + } + c = compareTypeMappers((t1 as AnonymousType).mapper, (t2 as AnonymousType).mapper); + if (c !== 0) { + return c; + } + } + } + else if (t1.flags & TypeFlags.Union) { + // Unions are ordered by origin and then constituent type lists. + const o1 = (t1 as UnionType).origin; + const o2 = (t2 as UnionType).origin; + if (o1 === undefined && o2 === undefined) { + const c = compareTypeLists((t1 as UnionType).types, (t2 as UnionType).types); + if (c !== 0) { + return c; + } + } + else if (o1 === undefined) { + return 1; + } + else if (o2 === undefined) { + return -1; + } + else { + const c = compareTypes(o1, o2); + if (c !== 0) { + return c; + } + } + } + else if (t1.flags & TypeFlags.Intersection) { + // Intersections are ordered by their constituent type lists. + const c = compareTypeLists((t1 as IntersectionType).types, (t2 as IntersectionType).types); + if (c !== 0) { + return c; + } + } + else if (t1.flags & (TypeFlags.Enum | TypeFlags.EnumLiteral | TypeFlags.UniqueESSymbol)) { + // Enum members are ordered by their symbol (and thus their declaration order). + const c = compareSymbols(t1.symbol, t2.symbol); + if (c !== 0) { + return c; + } + } + else if (t1.flags & TypeFlags.StringLiteral) { + // String literal types are ordered by their values. + const c = compareComparableValues((t1 as LiteralType).value as string, (t2 as LiteralType).value as string); + if (c !== 0) { + return c; + } + } + else if (t1.flags & TypeFlags.NumberLiteral) { + // Numeric literal types are ordered by their values. + const c = compareComparableValues((t1 as LiteralType).value as number, (t2 as LiteralType).value as number); + if (c !== 0) { + return c; + } + } + else if (t1.flags & TypeFlags.BooleanLiteral) { + const b1 = (t1 as IntrinsicType).intrinsicName === "true"; + const b2 = (t2 as IntrinsicType).intrinsicName === "true"; + if (b1 !== b2) { + if (b1) { + return 1; + } + return -1; + } + } + else if (t1.flags & TypeFlags.TypeParameter) { + const c = compareSymbols(t1.symbol, t2.symbol); + if (c !== 0) { + return c; + } + } + else if (t1.flags & TypeFlags.Index) { + let c = compareTypes((t1 as IndexType).type, (t2 as IndexType).type); + if (c !== 0) { + return c; + } + c = (t1 as IndexType).flags - (t2 as IndexType).flags; + if (c !== 0) { + return c; + } + } + else if (t1.flags & TypeFlags.IndexedAccess) { + let c = compareTypes((t1 as IndexedAccessType).objectType, (t2 as IndexedAccessType).objectType); + if (c !== 0) { + return c; + } + c = compareTypes((t1 as IndexedAccessType).indexType, (t2 as IndexedAccessType).indexType); + if (c !== 0) { + return c; + } + } + else if (t1.flags & TypeFlags.Conditional) { + let c = compareNodes((t1 as ConditionalType).root.node, (t2 as ConditionalType).root.node); + if (c !== 0) { + return c; + } + c = compareTypeMappers((t1 as ConditionalType).mapper, (t2 as ConditionalType).mapper); + if (c !== 0) { + return c; + } + } + else if (t1.flags & TypeFlags.Substitution) { + let c = compareTypes((t1 as SubstitutionType).baseType, (t2 as SubstitutionType).baseType); + if (c !== 0) { + return c; + } + c = compareTypes((t1 as SubstitutionType).constraint, (t2 as SubstitutionType).constraint); + if (c !== 0) { + return c; + } + } + else if (t1.flags & TypeFlags.TemplateLiteral) { + let c = slicesCompareString((t1 as TemplateLiteralType).texts, (t2 as TemplateLiteralType).texts); + if (c !== 0) { + return c; + } + c = compareTypeLists((t1 as TemplateLiteralType).types, (t2 as TemplateLiteralType).types); + if (c !== 0) { + return c; + } + } + else if (t1.flags & TypeFlags.StringMapping) { + const c = compareTypes((t1 as StringMappingType).type, (t2 as StringMappingType).type); + if (c !== 0) { + return c; + } + } + + // Fall back to type IDs. This results in type creation order for built-in types. + return t1.id - t2.id; + + function slicesCompareString(s1: readonly string[], s2: readonly string[]): number { + for (let i = 0; i < s1.length; i++) { + if (i > s2.length) { + return 1; + } + const v1 = s1[i]; + const v2 = s2[i]; + const c = compareComparableValues(v1, v2); + if (c !== 0) return c; + } + if (s1.length < s2.length) { + return -1; + } + return 0; + } + } + + function getSortOrderFlags(t: Type): number { + // Return TypeFlagsEnum for all enum-like unit types (they'll be sorted by their symbols) + if (t.flags & (TypeFlags.EnumLiteral | TypeFlags.Enum) && !(t.flags & TypeFlags.Union)) { + return TypeFlags.Enum; + } + return t.flags; + } + + function compareTypeNames(t1: Type, t2: Type): number { + const s1 = getTypeNameSymbol(t1); + const s2 = getTypeNameSymbol(t2); + if (s1 === s2) { + if (t1.aliasTypeArguments !== undefined) { + return compareTypeLists(t1.aliasTypeArguments, t2.aliasTypeArguments); + } + return 0; + } + if (s1 === undefined) { + return 1; + } + if (s2 === undefined) { + return -1; + } + return compareComparableValues(s1.escapedName as string, s2.escapedName as string); + } + + function getTypeNameSymbol(t: Type): Symbol | undefined { + if (t.aliasSymbol !== undefined) { + return t.aliasSymbol; + } + if (t.flags & (TypeFlags.TypeParameter | TypeFlags.StringMapping) || getObjectFlags(t) & (ObjectFlags.ClassOrInterface | ObjectFlags.Reference)) { + return t.symbol; + } + return undefined; + } + + function compareTupleTypes(t1: TupleType, t2: TupleType): number { + if (t1 === t2) { + return 0; + } + if (t1.readonly === t2.readonly) { + return t1.readonly ? 1 : -1; + } + if (t1.elementFlags.length !== t2.elementFlags.length) { + return t1.elementFlags.length - t2.elementFlags.length; + } + for (let i = 0; i < t1.elementFlags.length; i++) { + const c = t1.elementFlags[i] - t2.elementFlags[i]; + if (c !== 0) { + return c; + } + } + for (let i = 0; i < (t1.labeledElementDeclarations?.length ?? 0); i++) { + const c = compareElementLabels(t1.labeledElementDeclarations![i], t2.labeledElementDeclarations![i]); + if (c !== 0) { + return c; + } + } + return 0; + } + + function compareElementLabels(n1: NamedTupleMember | ParameterDeclaration | undefined, n2: NamedTupleMember | ParameterDeclaration | undefined): number { + if (n1 === n2) { + return 0; + } + if (n1 === undefined) { + return -1; + } + if (n2 === undefined) { + return 1; + } + return compareComparableValues((n1.name as Identifier).escapedText as string, (n2.name as Identifier).escapedText as string); + } + + function compareTypeLists(s1: readonly Type[] | undefined, s2: readonly Type[] | undefined): number { + if (length(s1) !== length(s2)) { + return length(s1) - length(s2); + } + for (let i = 0; i < length(s1); i++) { + const c = compareTypes(s1![i], s2?.[i]); + if (c !== 0) return c; + } + return 0; + } + + function compareTypeMappers(m1: TypeMapper | undefined, m2: TypeMapper | undefined): number { + if (m1 === m2) { + return 0; + } + if (m1 === undefined) { + return 1; + } + if (m2 === undefined) { + return -1; + } + const kind1 = m1.kind; + const kind2 = m2.kind; + if (kind1 !== kind2) { + return kind1 - kind2; + } + switch (kind1) { + case TypeMapKind.Simple: { + const c = compareTypes(m1.source, (m2 as typeof m1).source); + if (c !== 0) { + return c; + } + return compareTypes(m1.target, (m2 as typeof m1).target); + } + case TypeMapKind.Array: { + const c = compareTypeLists(m1.sources, (m2 as typeof m1).sources); + if (c !== 0) { + return c; + } + return compareTypeLists(m1.targets, (m2 as typeof m1).targets); + } + case TypeMapKind.Merged: { + const c = compareTypeMappers(m1.mapper1, (m2 as typeof m1).mapper1); + if (c !== 0) { + return c; + } + return compareTypeMappers(m1.mapper2, (m2 as typeof m1).mapper2); + } + } + return 0; + } } function isNotAccessor(declaration: Declaration): boolean { diff --git a/src/compiler/core.ts b/src/compiler/core.ts index ef83fefd533e0..89c468344fcb3 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -1209,7 +1209,7 @@ export function binarySearchKey(array: readonly T[], key: U, keySelector: while (low <= high) { const middle = low + ((high - low) >> 1); const midKey = keySelector(array[middle], middle); - switch (keyComparer(midKey, key)) { + switch (Math.sign(keyComparer(midKey, key))) { case Comparison.LessThan: low = middle + 1; break; @@ -1967,9 +1967,11 @@ export function equateStringsCaseSensitive(a: string, b: string): boolean { return equateValues(a, b); } -function compareComparableValues(a: string | undefined, b: string | undefined): Comparison; -function compareComparableValues(a: number | undefined, b: number | undefined): Comparison; -function compareComparableValues(a: string | number | undefined, b: string | number | undefined) { +/** @internal */ +export function compareComparableValues(a: string | undefined, b: string | undefined): Comparison; +/** @internal */ +export function compareComparableValues(a: number | undefined, b: number | undefined): Comparison; +export function compareComparableValues(a: string | number | undefined, b: string | number | undefined) { return a === b ? Comparison.EqualTo : a === undefined ? Comparison.LessThan : b === undefined ? Comparison.GreaterThan : diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 342c0f2af7146..8f6190812b140 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -6269,21 +6269,21 @@ export interface SerializedTypeEntry { export const enum TypeFlags { Any = 1 << 0, Unknown = 1 << 1, - String = 1 << 2, - Number = 1 << 3, - Boolean = 1 << 4, - Enum = 1 << 5, // Numeric computed enum member value - BigInt = 1 << 6, - StringLiteral = 1 << 7, - NumberLiteral = 1 << 8, - BooleanLiteral = 1 << 9, - EnumLiteral = 1 << 10, // Always combined with StringLiteral, NumberLiteral, or Union - BigIntLiteral = 1 << 11, - ESSymbol = 1 << 12, // Type of symbol primitive introduced in ES6 - UniqueESSymbol = 1 << 13, // unique symbol - Void = 1 << 14, - Undefined = 1 << 15, - Null = 1 << 16, + Undefined = 1 << 2, + Null = 1 << 3, + Void = 1 << 4, + String = 1 << 5, + Number = 1 << 6, + BigInt = 1 << 7, + Boolean = 1 << 8, + ESSymbol = 1 << 9, // Type of symbol primitive introduced in ES6 + StringLiteral = 1 << 10, + NumberLiteral = 1 << 11, + BooleanLiteral = 1 << 12, + BigIntLiteral = 1 << 13, + UniqueESSymbol = 1 << 14, // unique symbol + EnumLiteral = 1 << 15, // Always combined with StringLiteral, NumberLiteral, or Union + Enum = 1 << 16, // Numeric computed enum member value Never = 1 << 17, // Never type TypeParameter = 1 << 18, // Type parameter Object = 1 << 19, // Object type @@ -6484,15 +6484,17 @@ export const enum ObjectFlags { PropagatingFlags = ContainsWideningType | ContainsObjectOrArrayLiteral | NonInferrableType, /** @internal */ InstantiatedMapped = Mapped | Instantiated, - // Object flags that uniquely identify the kind of ObjectType - /** @internal */ - ObjectTypeKindMask = ClassOrInterface | Reference | Tuple | Anonymous | Mapped | ReverseMapped | EvolvingArray, - + // Flags that require TypeFlags.Object ContainsSpread = 1 << 21, // Object literal contains spread operation ObjectRestType = 1 << 22, // Originates in object rest declaration InstantiationExpressionType = 1 << 23, // Originates in instantiation expression SingleSignatureType = 1 << 27, // A single signature type extracted from a potentially broader type + + // Object flags that uniquely identify the kind of ObjectType + /** @internal */ + ObjectTypeKindMask = ClassOrInterface | Reference | Tuple | Anonymous | Mapped | ReverseMapped | EvolvingArray | InstantiationExpressionType | SingleSignatureType, + /** @internal */ IsClassInstanceClone = 1 << 24, // Type is a clone of a class instance type // Flags that require TypeFlags.Object and ObjectFlags.Reference From 4c28ce8a35b5efaf90c950125f22b9dbb0125dbd Mon Sep 17 00:00:00 2001 From: Jake Bailey <5341706+jakebailey@users.noreply.github.com> Date: Wed, 19 Mar 2025 21:20:12 -0700 Subject: [PATCH 2/2] Update tests --- .../reference/TypeGuardWithArrayUnion.types | 4 +- .../reference/TypeGuardWithEnumUnion.types | 22 +- .../ambientExportDefaultErrors.types | 4 +- .../reference/anonymousClassExpression1.types | 2 +- tests/baselines/reference/api/typescript.d.ts | 56 ++--- .../reference/arrayBestCommonTypes.types | 32 +-- tests/baselines/reference/arrayConcat3.types | 4 +- .../arrayDestructuringInSwitch1.types | 2 +- tests/baselines/reference/arrayEvery.types | 2 +- tests/baselines/reference/arrayFind.types | 2 +- .../reference/arrayFlatNoCrashInference.types | 4 +- .../arrayFlatNoCrashInferenceDeclarations.js | 2 +- ...rrayFlatNoCrashInferenceDeclarations.types | 4 +- .../reference/arrayLiteralComments.types | 4 +- .../arrayLiteralContextualType.types | 12 +- .../reference/arrayLiteralInference.types | 4 +- tests/baselines/reference/arrayLiterals.types | 8 +- .../baselines/reference/arrayLiterals3.types | 6 +- .../arrayLiteralsWithRecursiveGenerics.types | 4 +- tests/baselines/reference/arrayconcat.types | 2 +- ...nfuseParenthesizedObjectForArrowHead.types | 12 +- .../reference/assertionTypePredicates1.types | 28 +-- .../assertionsAndNonReturningFunctions.types | 8 +- ...entCompatWithDiscriminatedUnion.errors.txt | 12 +- ...gnmentCompatWithDiscriminatedUnion.symbols | 4 +- ...signmentCompatWithDiscriminatedUnion.types | 16 +- .../assignmentToAnyArrayRestParameters.types | 4 +- ...syncFunctionContextuallyTypedReturns.types | 14 +- .../reference/awaitUnionPromise.types | 6 +- .../baselines/reference/awaitUnion_es5.types | 4 +- .../baselines/reference/awaitUnion_es6.types | 4 +- .../reference/awaitedTypeNoLib.errors.txt | 8 +- .../reference/awaitedTypeNoLib.types | 6 +- .../baselines/reference/bestChoiceType.types | 6 +- .../reference/bivariantInferences.types | 8 +- .../reference/booleanLiteralTypes1.types | 4 +- .../reference/booleanLiteralTypes2.types | 4 +- .../reference/builtinIterator.errors.txt | 8 +- .../baselines/reference/builtinIterator.types | 20 +- ...WithoutReturnTypeAnnotationInference.types | 10 +- .../reference/callWithMissingVoid.types | 42 ++-- .../baselines/reference/callWithSpread4.types | 6 +- .../reference/callsOnComplexSignatures.types | 14 +- .../reference/castExpressionParentheses.types | 2 +- tests/baselines/reference/castOfAwait.types | 4 +- .../reference/checkJsdocReturnTag2.types | 2 +- .../reference/checkJsdocTypeTag5.types | 4 +- .../checkJsxChildrenProperty14.types | 2 +- .../reference/checkJsxChildrenProperty6.types | 2 +- .../checkJsxChildrenProperty7.errors.txt | 12 +- .../reference/checkJsxChildrenProperty7.types | 2 +- .../reference/checkJsxChildrenProperty8.types | 2 +- ...onSFXContextualTypeInferredCorrectly.types | 2 +- .../checkSuperCallBeforeThisAccess.types | 6 +- ...nalNoInfiniteInstantiationDepth.errors.txt | 12 +- .../classDoesNotDependOnBaseTypes.types | 2 +- .../classStaticBlockUseBeforeDef3.types | 6 +- .../coAndContraVariantInferences2.types | 4 +- .../coAndContraVariantInferences3.types | 30 +-- .../coAndContraVariantInferences5.errors.txt | 34 +++ .../coAndContraVariantInferences6.types | 2 +- .../commaOperatorLeftSideUnused.types | 4 +- .../completionsClassMembers4.baseline | 2 +- ...completionsCommitCharactersGlobal.baseline | 220 ++++-------------- .../complexRecursiveCollections.types | 28 +-- ...yofReliesOnKeyofNeverUpperBound.errors.txt | 92 ++++---- ...essKeyofReliesOnKeyofNeverUpperBound.types | 2 +- ...ndexesOfIntersectionsAreInferencable.types | 2 +- ...utedPropertyNamesContextualType6_ES5.types | 4 +- ...utedPropertyNamesContextualType6_ES6.types | 4 +- ...utedPropertyNamesContextualType7_ES5.types | 4 +- ...utedPropertyNamesContextualType7_ES6.types | 4 +- ...mputedTypesKeyofNoIndexSignatureType.types | 2 +- tests/baselines/reference/concatTuples.types | 4 +- .../conditionalExpression1.errors.txt | 4 +- .../reference/conditionalExpressions2.types | 2 +- ...tionalOperatorConditionIsBooleanType.types | 6 +- ...itionalOperatorConditoinIsStringType.types | 6 +- ...asedContextualTypeReturnTypeWidening.types | 16 +- .../reference/conditionalTypes1.types | 14 +- .../reference/conditionalTypes2.errors.txt | 16 +- .../reference/conditionalTypes2.types | 4 +- tests/baselines/reference/constAssertions.js | 10 +- .../baselines/reference/constAssertions.types | 38 +-- tests/baselines/reference/constEnum3.types | 4 +- .../constLocalsInFunctionExpressions.types | 10 +- ...xpressionTypecheckingDoesntBlowStack.types | 4 +- ...contextualOverloadListFromArrayUnion.types | 12 +- .../contextualReturnTypeOfIIFE.types | 6 +- ...tualSignatureInArrayElementLibEs2015.types | 4 +- ...textualSignatureInArrayElementLibEs5.types | 4 +- .../contextualSignatureInstantiation.types | 22 +- ...eBasedOnIntersectionWithAnyInTheMix1.types | 2 +- ...eBasedOnIntersectionWithAnyInTheMix3.types | 2 +- .../reference/contextualTypeCaching.types | 2 +- ...peFunctionObjectPropertyIntersection.types | 4 +- .../contextualTypeIterableUnions.types | 2 +- .../contextualTypeShouldBeLiteral.types | 8 +- ...xtualTypeWithUnionTypeCallSignatures.types | 2 +- .../reference/contextualTyping36.types | 2 +- ...urnStatementWithReturnTypeAnnotation.types | 6 +- .../contextuallyTypedBindingInitializer.types | 4 +- ...TypedBindingInitializerNegative.errors.txt | 4 +- ...uallyTypedBindingInitializerNegative.types | 4 +- ...TypedStringLiteralsInJsxAttributes02.types | 6 +- .../controlFlowAliasedDiscriminants.types | 28 +-- .../reference/controlFlowAliasing.types | 100 ++++---- ...es(useunknownincatchvariables=false).types | 8 +- ...les(useunknownincatchvariables=true).types | 8 +- ...controlFlowAnalysisOnBareThisKeyword.types | 2 +- .../controlFlowAssignmentPatternOrder.types | 48 ++-- .../controlFlowBinaryOrExpression.symbols | 12 +- .../controlFlowBinaryOrExpression.types | 10 +- .../reference/controlFlowBindingElement.types | 2 +- .../controlFlowBindingPatternOrder.errors.txt | 4 +- .../controlFlowBindingPatternOrder.types | 4 +- .../reference/controlFlowCaching.types | 2 +- .../reference/controlFlowCommaOperator.types | 4 +- .../controlFlowComputedPropertyNames.types | 6 +- .../controlFlowDestructuringLoop.types | 2 +- .../controlFlowDoWhileStatement.types | 2 +- .../reference/controlFlowElementAccess2.types | 4 +- .../controlFlowForIndexSignatures.types | 2 +- .../reference/controlFlowForStatement.types | 8 +- .../reference/controlFlowGenericTypes.types | 2 +- .../baselines/reference/controlFlowIIFE.types | 6 +- .../reference/controlFlowIfStatement.types | 4 +- ...controlFlowInstanceOfGuardPrimitives.types | 2 +- ...controlFlowInstanceofExtendsFunction.types | 2 +- .../controlFlowNullishCoalesce.types | 4 +- .../reference/controlFlowOptionalChain.types | 36 +-- .../reference/controlFlowOptionalChain3.types | 2 +- .../reference/controlFlowTypeofObject.types | 14 +- .../reference/controlFlowWhileStatement.types | 2 +- .../controlFlowWithIncompleteTypes.types | 4 +- .../controlFlowWithTemplateLiterals.types | 10 +- .../reference/correlatedUnions.types | 16 +- ...crashInGetTextOfComputedPropertyName.types | 6 +- .../declFileTypeAnnotationUnionType.js | 18 +- .../declFileTypeAnnotationUnionType.types | 12 +- ...ationEmitHigherOrderRetainedGenerics.types | 2 +- ...eclarationEmitIdentifierPredicates01.types | 2 +- ...dentifierPredicatesWithPrivateName01.types | 2 +- .../declarationEmitInferredTypeAlias1.types | 2 +- .../declarationEmitInferredTypeAlias2.types | 2 +- .../declarationEmitInferredTypeAlias5.types | 2 +- .../declarationEmitInferredTypeAlias6.types | 2 +- .../declarationEmitInferredTypeAlias7.types | 2 +- ...eWithNonEntityNameExpressionHeritage.types | 4 +- .../baselines/reference/deepComparisons.types | 2 +- .../deeplyNestedConditionalTypes.types | 2 +- .../deeplyNestedMappedTypes.errors.txt | 24 +- .../reference/deeplyNestedMappedTypes.types | 10 +- .../reference/deferredLookupTypeResolution.js | 19 +- .../deferredLookupTypeResolution.types | 6 +- .../definiteAssignmentAssertions.types | 2 +- .../dependentDestructuredVariables.types | 42 ++-- ...tructuredVariablesFromNestedPatterns.types | 8 +- ...ivedUninitializedPropertyDeclaration.types | 2 +- .../destructuringAssignmentWithDefault.types | 14 +- .../reference/destructuringControlFlow.types | 30 +-- ...ParameterDeclaration10(strict=false).types | 4 +- ...gParameterDeclaration10(strict=true).types | 4 +- ...ngParameterDeclaration9(strict=true).types | 2 +- ...structuringUnspreadableIntoRest.errors.txt | 88 +++---- .../destructuringUnspreadableIntoRest.types | 56 ++--- .../didYouMeanStringLiteral.errors.txt | 8 +- .../reference/didYouMeanStringLiteral.types | 8 +- .../discriminantPropertyCheck.symbols | 4 +- .../discriminantPropertyInference.types | 2 +- ...ntUsingEvaluatableTemplateExpression.types | 2 +- .../discriminantsAndPrimitives.symbols | 16 +- .../discriminantsAndPrimitives.types | 56 ++--- ...y2(exactoptionalpropertytypes=false).types | 6 +- ...ty2(exactoptionalpropertytypes=true).types | 6 +- .../discriminatedUnionTypes1.symbols | 20 +- .../reference/discriminatedUnionTypes1.types | 22 +- .../discriminatedUnionTypes2.symbols | 4 +- .../reference/discriminatedUnionTypes2.types | 4 +- ...discriminatedUnionWithIndexSignature.types | 2 +- ...stributiveConditionalTypeConstraints.types | 12 +- .../reference/divergentAccessorsTypes5.types | 2 +- .../reference/divergentAccessorsTypes8.types | 2 +- .../divideAndConquerIntersections.types | 6 +- .../reference/duplicateLocalVariable1.types | 2 +- .../baselines/reference/elidedJSImport1.types | 2 +- ...onentiationOperatorInTempalteString4.types | 8 +- ...ntiationOperatorInTempalteString4ES6.types | 8 +- ...onentiationOperatorInTemplateString1.types | 12 +- ...ntiationOperatorInTemplateString1ES6.types | 12 +- ...onentiationOperatorInTemplateString2.types | 12 +- ...ntiationOperatorInTemplateString2ES6.types | 12 +- ...onentiationOperatorInTemplateString3.types | 12 +- ...ntiationOperatorInTemplateString3ES6.types | 12 +- ...ectNarrowing(strictnullchecks=false).types | 8 +- ...jectNarrowing(strictnullchecks=true).types | 8 +- tests/baselines/reference/enumBasics.types | 8 +- .../reference/enumLiteralTypes1.types | 4 +- .../reference/enumLiteralTypes2.types | 4 +- ...sForCallAndAssignmentAreSimilar.errors.txt | 8 +- ...errorsOnUnionsOfOverlappingObjects01.types | 2 +- .../baselines/reference/es2022IntlAPIs.types | 8 +- .../reference/es2024SharedMemory.types | 4 +- ...yCheckWithMultipleDiscriminants.errors.txt | 8 +- .../exhaustiveSwitchStatements1.symbols | 24 +- .../exhaustiveSwitchStatements1.types | 24 +- .../expandoFunctionContextualTypes.types | 2 +- ...atorInTemplateStringWithSyntaxError1.types | 20 +- ...atorInTemplateStringWithSyntaxError2.types | 20 +- ...atorInTemplateStringWithSyntaxError3.types | 20 +- .../exponentiationOperatorSyntaxError2.types | 20 +- ...InvalidSimpleUnaryExpressionOperands.types | 40 ++-- .../reference/exportAssignNonIdentifier.types | 2 +- .../expressionTypeNodeShouldError.types | 12 +- .../reference/fixSignatureCaching.types | 8 +- .../flatArrayNoExcessiveStackDepth.types | 6 +- tests/baselines/reference/for-of39.errors.txt | 40 ++-- tests/baselines/reference/for-of39.types | 28 +-- tests/baselines/reference/for-of44.types | 10 +- .../reference/forAwaitForUnion.types | 4 +- .../functionImplementationErrors.types | 10 +- .../reference/functionImplementations.types | 4 +- .../reference/functionOverloads44.types | 4 +- ...functionWithMultipleReturnStatements.types | 10 +- ...unctionWithMultipleReturnStatements2.types | 2 +- .../functionWithNoBestCommonType1.types | 2 +- .../functionWithNoBestCommonType2.types | 4 +- .../reference/generatorTypeCheck23.types | 2 +- .../reference/generatorTypeCheck24.types | 2 +- .../reference/generatorTypeCheck52.types | 2 +- .../reference/generatorTypeCheck53.types | 2 +- .../reference/generatorTypeCheck54.types | 2 +- .../reference/generatorTypeCheck63.errors.txt | 12 +- .../generatorYieldContextualType.types | 8 +- .../reference/genericConstraint2.types | 2 +- .../baselines/reference/genericDefaults.types | 92 ++++---- .../reference/genericRestParameters1.types | 2 +- .../reference/genericRestParameters3.types | 12 +- .../genericsManyTypeParameters.types | 4 +- .../getterSetterSubtypeAssignment.types | 4 +- .../reference/gettersAndSetters.types | 2 +- .../globalThisBlockscopedProperties.types | 2 +- ...efinitionUnionTypeProperty2.baseline.jsonc | 4 +- ...efinitionUnionTypeProperty4.baseline.jsonc | 4 +- .../heterogeneousArrayLiterals.types | 16 +- .../reference/implicitConstParameters.types | 2 +- .../reference/importAliasFromNamespace.types | 2 +- ...sionSpecifierNotStringTypeError.errors.txt | 4 +- ...xpressionSpecifierNotStringTypeError.types | 2 +- ...dAliasedConditionalTypeInstantiation.types | 4 +- ...nDoesNotOperateOnPrimitiveTypes.errors.txt | 4 +- .../inDoesNotOperateOnPrimitiveTypes.types | 8 +- .../inKeywordTypeguard(strict=false).types | 10 +- .../inKeywordTypeguard(strict=true).types | 12 +- .../inOperatorWithValidOperands.errors.txt | 4 +- .../inOperatorWithValidOperands.types | 4 +- tests/baselines/reference/indexSignatures1.js | 20 +- .../reference/indexSignatures1.types | 4 +- .../reference/indexedAccessConstraints.types | 2 +- .../reference/indexedAccessRelation.types | 4 +- .../reference/indexerConstraints2.types | 2 +- ...ctDiscriminantAndExcessProperty.errors.txt | 12 +- ...inferFromGenericFunctionReturnTypes3.types | 4 +- .../inferTypeParameterConstraints.types | 2 +- .../reference/inferTypePredicates.types | 46 ++-- ...nferredFunctionReturnTypeIsEmptyType.types | 2 +- .../reference/instanceOfAssignability.types | 16 +- ...fOperatorWithRHSHasSymbolHasInstance.types | 166 ++++++------- .../instantiateContextualTypes.types | 8 +- .../instantiationExpressionErrors.types | 8 +- .../reference/instantiationExpressions.types | 8 +- .../interfaceDoesNotDependOnBaseTypes.types | 2 +- .../reference/intersectionNarrowing.types | 10 +- .../intersectionTypeInference3.types | 4 +- .../intersectionTypeNormalization.types | 4 +- .../reference/intlNumberFormatES2020.types | 8 +- .../reference/intlNumberFormatES2023.types | 4 +- .../reference/intraExpressionInferences.types | 26 +-- .../baselines/reference/intrinsicTypes.types | 12 +- .../isomorphicMappedTypeInference.js | 4 +- .../isomorphicMappedTypeInference.types | 26 +-- ...onsImportAliasExposedWithinNamespace.types | 2 +- ...ImportAliasExposedWithinNamespaceCjs.types | 2 +- .../reference/jsFileFunctionOverloads.types | 2 +- .../reference/jsFileFunctionOverloads2.types | 2 +- .../reference/jsFileMethodOverloads.types | 2 +- .../reference/jsFileMethodOverloads2.types | 2 +- .../jsdocBracelessTypeTag1.errors.txt | 4 +- tests/baselines/reference/jsdocLiteral.types | 4 +- .../reference/jsdocOverrideTag1.types | 2 +- .../baselines/reference/jsdocReturnTag1.types | 2 +- .../reference/jsdocTemplateTag3.types | 4 +- .../reference/jsxChildrenArrayWrongType.types | 5 +- ...drenIndividualErrorElaborations.errors.txt | 8 +- ...xChildrenIndividualErrorElaborations.types | 2 +- .../reference/jsxChildrenWrongType.types | 2 +- ...omplexSignatureHasApplicabilityError.types | 8 +- .../reference/keyofAndIndexedAccess.types | 24 +- .../reference/keyofAndIndexedAccess2.types | 10 +- .../keyofAndIndexedAccessErrors.types | 6 +- .../reference/keyofDoesntContainSymbols.types | 2 +- .../reference/keyofIntersection.types | 4 +- .../keywordExpressionInternalComments.types | 2 +- ...teralFreshnessPropagationOnNarrowing.types | 18 +- .../reference/literalTypeWidening.types | 76 +++--- tests/baselines/reference/literalTypes1.types | 4 +- tests/baselines/reference/literalTypes2.types | 66 +++--- tests/baselines/reference/literalTypes3.types | 22 +- .../literalTypesAndDestructuring.types | 6 +- .../literalTypesAndTypeAssertions.types | 4 +- ...lWideningWithCompoundLikeAssignments.types | 8 +- .../logicalOrOperatorWithEveryType.types | 40 ++-- tests/baselines/reference/mapGroupBy.types | 8 +- .../reference/mappedTypeAsClauses.types | 4 +- .../reference/mappedTypeErrors.errors.txt | 4 +- .../mappedTypeGenericWithKnownKeys.errors.txt | 8 +- .../mappedTypeGenericWithKnownKeys.types | 14 +- .../mappedTypeIndexedAccess.errors.txt | 4 +- .../reference/mappedTypeIndexedAccess.types | 2 +- .../mappedTypeNotMistakenlyHomomorphic.types | 2 +- .../reference/mappedTypeProperties.types | 10 +- tests/baselines/reference/mappedTypes2.types | 8 +- tests/baselines/reference/mappedTypes4.types | 4 +- .../reference/metadataOfStringLiteral.types | 2 +- .../baselines/reference/metadataOfUnion.types | 4 +- .../reference/moduleExportDuplicateAlias3.js | 2 +- .../moduleExportDuplicateAlias3.types | 20 +- ...oduleExportsElementAccessAssignment2.types | 2 +- .../reference/narrowByBooleanComparison.types | 4 +- ...arrowByClauseExpressionInSwitchTrue1.types | 4 +- .../reference/narrowByInstanceof.symbols | 4 +- .../reference/narrowByInstanceof.types | 10 +- ...rowByParenthesizedSwitchExpression.symbols | 4 +- ...arrowByParenthesizedSwitchExpression.types | 14 +- .../narrowCommaOperatorNestedWithinLHS.types | 2 +- .../narrowUnknownByTypeofObject.types | 2 +- .../narrowingByDiscriminantInLoop.symbols | 12 +- .../narrowingByDiscriminantInLoop.types | 12 +- .../reference/narrowingByTypeofInSwitch.types | 54 ++--- .../narrowingConstrainedTypeParameter.types | 2 +- .../reference/narrowingDestructuring.types | 8 +- ...nCaseClauseAfterCaseClauseWithReturn.types | 2 +- .../reference/narrowingMutualSubtypes.types | 8 +- .../narrowingOfQualifiedNames.symbols | 8 +- .../reference/narrowingOfQualifiedNames.types | 8 +- .../reference/narrowingOrderIndependent.types | 2 +- .../reference/narrowingTruthyObject.types | 16 +- .../narrowingTypeofDiscriminant.types | 10 +- .../reference/narrowingTypeofFunction.types | 10 +- .../reference/narrowingTypeofObject.types | 4 +- .../narrowingTypeofParenthesized1.types | 6 +- .../reference/narrowingTypeofUndefined1.types | 4 +- .../reference/narrowingTypeofUndefined2.types | 2 +- .../reference/narrowingUnionToUnion.types | 10 +- .../reference/narrowingUnionWithBang.types | 12 +- .../reference/nestedLoopTypeGuards.types | 8 +- .../nestedTypeVariableInfersLiteral.types | 20 +- ...everAsDiscriminantType(strict=false).types | 4 +- ...neverAsDiscriminantType(strict=true).types | 4 +- .../reference/neverReturningFunctions1.types | 4 +- tests/baselines/reference/neverType.js | 4 +- tests/baselines/reference/neverType.types | 18 +- .../reference/noImplicitAnyForIn.types | 2 +- ...icitAnyUnionNormalizedObjectLiteral1.types | 2 +- ...oInferUnionExcessPropertyCheck1.errors.txt | 12 +- .../noInferUnionExcessPropertyCheck1.types | 4 +- .../noIterationTypeErrorsInCFA.types | 6 +- .../reference/noUncheckedIndexedAccess.types | 2 +- .../reference/nonNullReferenceMatching.types | 36 +-- .../reference/nonNullableTypes1.types | 2 +- .../nonPrimitiveAndTypeVariables.errors.txt | 6 +- .../nonPrimitiveAndTypeVariables.types | 2 +- .../reference/nonPrimitiveNarrow.types | 4 +- .../reference/nonPrimitiveStrictNull.types | 8 +- .../normalizedIntersectionTooComplex.types | 72 +++--- .../nullishCoalescingOperator2.types | 16 +- .../nullishCoalescingOperator3.types | 10 +- .../nullishCoalescingOperator_es2020.types | 16 +- ...nullishCoalescingOperator_not_strict.types | 16 +- .../reference/numberVsBigIntOperations.types | 26 +-- .../reference/numericLiteralTypes1.types | 40 ++-- .../reference/numericLiteralTypes2.types | 40 ++-- tests/baselines/reference/objectGroupBy.types | 8 +- .../objectInstantiationFromUnionSpread.types | 72 +++--- .../objectLiteralExcessProperties.errors.txt | 8 +- .../objectLiteralExcessProperties.types | 14 +- ...bjectLiteralsAgainstUnionsOfArrays01.types | 2 +- tests/baselines/reference/objectSpread.types | 8 +- .../observableInferenceCanBeMade.types | 2 +- .../reference/optionalTupleElements1.types | 6 +- .../reference/overloadAssignmentCompat.types | 4 +- .../overloadResolutionOverNonCTLambdas.types | 2 +- .../reference/overloadReturnTypes.types | 2 +- tests/baselines/reference/overloadTag1.types | 8 +- tests/baselines/reference/overloadTag2.types | 2 +- .../overloadsWithComputedNames.types | 10 +- ...nthesizedJSDocCastDoesNotNarrow.errors.txt | 4 +- .../parenthesizedJSDocCastDoesNotNarrow.types | 2 +- .../reference/parserArgumentList1.types | 2 +- tests/baselines/reference/parserharness.types | 26 +-- .../partiallyDiscriminantedUnions.symbols | 4 +- .../partiallyDiscriminantedUnions.types | 4 +- .../reference/partiallyNamedTuples2.types | 4 +- .../reference/predicateSemantics.types | 18 +- ...fixUnaryOperatorsOnExportedVariables.types | 2 +- ...ateNameInInExpression(target=es2022).types | 10 +- ...ateNameInInExpression(target=esnext).types | 10 +- .../reference/privateNameMethodAsync.types | 8 +- .../privateNameStaticMethodAsync.types | 8 +- ...privateNamesAssertion(target=es2022).types | 4 +- ...privateNamesAssertion(target=esnext).types | 4 +- tests/baselines/reference/promiseType.types | 30 +-- .../reference/promiseTypeStrictNull.types | 30 +-- .../reference/promiseWithResolvers.types | 2 +- .../propTypeValidatorInference.types | 8 +- .../reference/propertyAccessWidening.types | 6 +- ...kinfoTypeAtReturnPositionsInaccurate.types | 6 +- .../reference/ramdaToolsNoInfinite2.types | 12 +- ...ferredInferenceAllowsAssignment.errors.txt | 12 +- .../reactSFCAndFunctionResolvable.types | 24 +- .../reference/recursiveMappedTypes.types | 6 +- .../recursiveTupleTypeInference.types | 6 +- .../reference/recursiveTypeRelations.types | 4 +- ...eferencesForUnionProperties.baseline.jsonc | 21 +- .../baselines/reference/reservedWords2.types | 2 +- ...rfaceNameWithSameLetDeclarationName2.types | 4 +- .../reference/returnTagTypeGuard.types | 4 +- ...appedTypeIntersectionConstraint.errors.txt | 16 +- tests/baselines/reference/sharedMemory.types | 4 +- .../spreadBooleanRespectsFreshness.types | 4 +- .../reference/spreadObjectNoCircular1.types | 6 +- .../reference/spreadObjectOrFalsy.types | 4 +- ...ectLiteralAssignableToIndexSignature.types | 12 +- .../reference/spreadUnion2.errors.txt | 24 +- tests/baselines/reference/spreadUnion2.types | 44 ++-- .../spreadsAndContextualTupleTypes.types | 8 +- .../reference/strictFunctionTypes1.types | 4 +- .../reference/strictSubtypeAndNarrowing.types | 16 +- .../strictTypeofUnionNarrowing.types | 8 +- .../reference/stringEnumLiteralTypes1.types | 4 +- .../reference/stringEnumLiteralTypes2.types | 4 +- ...lTypesAndLogicalOrExpressions01.errors.txt | 4 +- ...iteralTypesAndLogicalOrExpressions01.types | 4 +- ...alTypesAndParenthesizedExpressions01.types | 8 +- ...LiteralTypesAsTypeParameterConstraint01.js | 4 +- ...eralTypesAsTypeParameterConstraint01.types | 24 +- ...eralTypesAsTypeParameterConstraint02.types | 4 +- .../stringLiteralTypesInUnionTypes01.types | 10 +- .../stringLiteralTypesInUnionTypes03.types | 10 +- .../stringLiteralTypesOverloads01.js | 8 +- .../stringLiteralTypesOverloads01.types | 36 +-- .../stringLiteralTypesOverloads02.types | 34 +-- .../stringLiteralTypesOverloads04.types | 8 +- .../stringLiteralsWithEqualityChecks01.types | 22 +- .../stringLiteralsWithEqualityChecks02.types | 22 +- ...ingLiteralsWithEqualityChecks03.errors.txt | 16 +- .../stringLiteralsWithEqualityChecks03.types | 22 +- ...ingLiteralsWithEqualityChecks04.errors.txt | 16 +- .../stringLiteralsWithEqualityChecks04.types | 22 +- ...stringLiteralsWithSwitchStatements01.types | 6 +- ...stringLiteralsWithSwitchStatements02.types | 14 +- ...stringLiteralsWithSwitchStatements03.types | 16 +- ...gLiteralsWithSwitchStatements04.errors.txt | 4 +- ...stringLiteralsWithSwitchStatements04.types | 10 +- .../stringLiteralsWithTypeAssertions01.types | 14 +- ...omponentsInstantiaionLimitNotReached.types | 2 +- .../subtypeReductionUnionConstraints.symbols | 4 +- .../subtypeReductionUnionConstraints.types | 8 +- .../reference/subtypesOfTypeParameter.types | 40 ++-- ...typesOfTypeParameterWithConstraints2.types | 8 +- ...typesOfTypeParameterWithConstraints4.types | 8 +- ...ypeParameterWithRecursiveConstraints.types | 24 +- .../switchComparableCompatForBrands.types | 2 +- .../reference/switchStatements.types | 4 +- tests/baselines/reference/symbolType17.types | 2 +- tests/baselines/reference/symbolType18.types | 2 +- tests/baselines/reference/symbolType19.types | 2 +- tests/baselines/reference/symbolType3.types | 2 +- .../reference/taggedPrimitiveNarrowing.types | 4 +- .../tailRecursiveConditionalTypes.types | 2 +- .../reference/templateLiteralTypes1.types | 12 +- .../templateLiteralTypes2.errors.txt | 8 +- .../reference/templateLiteralTypes2.types | 32 +-- .../reference/templateLiteralTypes3.types | 6 +- .../reference/templateLiteralTypes4.types | 2 +- .../templateLiteralTypesPatterns.errors.txt | 28 +-- .../templateLiteralTypesPatterns.types | 14 +- .../reference/templateStringInTypeOf.types | 4 +- .../reference/templateStringInTypeOfES6.types | 4 +- ...emplateStringWithEmbeddedConditional.types | 2 +- ...lateStringWithEmbeddedConditionalES6.types | 2 +- ...lateStringWithEmbeddedTypeOfOperator.types | 2 +- ...eStringWithEmbeddedTypeOfOperatorES6.types | 2 +- .../thisTypeInAccessorsNegative.types | 6 +- .../reference/thisTypeInFunctions4.types | 4 +- .../reference/thisTypeInTypePredicate.types | 2 +- .../baselines/reference/throwStatements.types | 2 +- .../reference/trackedSymbolsNoCrash.symbols | 4 +- .../truthinessCallExpressionCoercion2.types | 6 +- .../truthinessCallExpressionCoercion4.types | 2 +- .../tryCatchFinallyControlFlow.types | 12 +- ...s-errors-when-noErrorTruncation-changes.js | 4 +- .../fourslashServer/quickinfoWrongComment.js | 2 +- .../tsxDiscriminantPropertyInference.types | 2 +- ...xStatelessFunctionComponentOverload5.types | 8 +- ...xStatelessFunctionComponentOverload6.types | 8 +- .../reference/tsxUnionTypeComponent1.types | 6 +- ...ypeArgumentsWithStringLiteralTypes01.types | 2 +- ...terStringCompletionsInNestedCall2.baseline | 2 +- .../typeGuardConstructorClassAndNumber.types | 6 +- ...rdConstructorNarrowPrimitivesInUnion.types | 12 +- .../typeGuardConstructorPrimitiveTypes.types | 26 +-- .../baselines/reference/typeGuardEnums.types | 4 +- .../typeGuardFunctionErrors.errors.txt | 4 +- .../reference/typeGuardInClass.types | 2 +- .../typeGuardIntersectionTypes.types | 2 +- ...rrowsIndexedAccessOfKnownProperty1.symbols | 4 +- ...NarrowsIndexedAccessOfKnownProperty1.types | 4 +- .../typeGuardNarrowsToLiteralTypeUnion.types | 4 +- .../reference/typeGuardNesting.types | 24 +- .../typeGuardOfFormExpr1AndExpr2.types | 18 +- .../typeGuardOfFormExpr1OrExpr2.types | 18 +- .../reference/typeGuardOfFormNotExpr.types | 20 +- .../typeGuardOfFormTypeOfBoolean.types | 20 +- ...FormTypeOfEqualEqualHasNoEffect.errors.txt | 4 +- ...ardOfFormTypeOfEqualEqualHasNoEffect.types | 8 +- .../typeGuardOfFormTypeOfFunction.types | 24 +- ...eGuardOfFormTypeOfIsOrderIndependent.types | 8 +- ...OfFormTypeOfNotEqualHasNoEffect.errors.txt | 4 +- ...GuardOfFormTypeOfNotEqualHasNoEffect.types | 8 +- .../typeGuardOfFormTypeOfNumber.types | 20 +- .../typeGuardOfFormTypeOfOther.errors.txt | 32 +-- .../typeGuardOfFormTypeOfOther.types | 18 +- ...ypeGuardOfFormTypeOfPrimitiveSubtype.types | 12 +- .../typeGuardOfFormTypeOfString.types | 20 +- .../typeGuardOnContainerTypeNoHang.types | 2 +- .../reference/typeGuardRedundancy.types | 16 +- .../typeGuardTautologicalConsistiency.types | 8 +- .../reference/typeGuardTypeOfUndefined.types | 96 ++++---- .../reference/typeGuardsAsAssertions.types | 12 +- .../reference/typeGuardsDefeat.types | 6 +- .../typeGuardsInClassAccessors.types | 40 ++-- .../reference/typeGuardsInClassMethods.types | 30 +-- .../typeGuardsInConditionalExpression.types | 34 +-- .../reference/typeGuardsInDoStatement.types | 6 +- .../typeGuardsInExternalModule.types | 4 +- .../reference/typeGuardsInForStatement.types | 6 +- .../reference/typeGuardsInFunction.types | 38 +-- .../typeGuardsInFunctionAndModuleBlock.types | 26 +-- .../reference/typeGuardsInGlobal.types | 2 +- .../reference/typeGuardsInIfStatement.types | 34 +-- .../reference/typeGuardsInModule.types | 22 +- .../reference/typeGuardsInProperties.types | 12 +- ...GuardsInRightOperandOfAndAndOperator.types | 22 +- ...peGuardsInRightOperandOfOrOrOperator.types | 22 +- .../typeGuardsInWhileStatement.types | 6 +- .../typeGuardsNestedAssignments.types | 2 +- .../reference/typeGuardsObjectMethods.types | 20 +- .../reference/typeGuardsOnClassProperty.types | 8 +- .../reference/typeGuardsTypeParameters.types | 4 +- .../reference/typeGuardsWithAny.types | 8 +- .../reference/typeInferenceLiteralUnion.types | 10 +- .../baselines/reference/typeOfOperator1.types | 4 +- .../typeParameterDiamond3.errors.txt | 4 +- .../typeParameterDiamond4.errors.txt | 8 +- .../reference/typeParameterDiamond4.types | 8 +- .../reference/typeParameterLeak.types | 4 +- .../typePredicateWithThisParameter.types | 6 +- .../reference/typePredicatesInUnion3.types | 12 +- .../typePredicatesOptionalChaining2.types | 4 +- .../typeSatisfaction_errorLocations1.types | 4 +- ...vacuousIntersectionOfContextualTypes.types | 2 +- .../reference/typeVariableTypeGuards.types | 2 +- .../typeofOperatorInvalidOperations.types | 6 +- .../typeofOperatorWithAnyOtherType.types | 120 +++++----- .../typeofOperatorWithBooleanType.types | 58 ++--- .../typeofOperatorWithEnumType.types | 42 ++-- .../typeofOperatorWithNumberType.types | 86 +++---- .../typeofOperatorWithStringType.types | 86 +++---- .../reference/typeofUnknownSymbol.types | 4 +- ...uncalledFunctionChecksInConditional2.types | 2 +- .../unionAndIntersectionInference1.types | 8 +- .../unionAndIntersectionInference3.types | 10 +- ...heckNoApparentPropTypeMismatchErrors.types | 2 +- .../reference/unionOfArraysFilterCall.symbols | 16 +- .../reference/unionOfArraysFilterCall.types | 110 ++++----- .../reference/unionOfClassCalls.types | 24 +- .../reference/unionOfEnumInference.types | 4 +- ...nionOfFunctionAndSignatureIsCallable.types | 10 +- .../unionPropertyExistence.errors.txt | 16 +- .../reference/unionPropertyExistence.types | 12 +- ...rotectedAndIntersectionProperty.errors.txt | 4 +- .../unionThisTypeInFunctions.errors.txt | 24 +- .../unionThisTypeInFunctions.symbols | 4 +- .../reference/unionThisTypeInFunctions.types | 4 +- .../reference/unionTypeCallSignatures6.types | 4 +- .../reference/unionTypeInference.types | 12 +- .../unionTypePropertyAccessibility.errors.txt | 32 +-- .../unionTypePropertyAccessibility.types | 32 +-- .../reference/unionTypeReduction2.types | 16 +- ...onTypeWithRecursiveSubtypeReduction1.types | 6 +- ...eWithRecursiveSubtypeReduction2.errors.txt | 12 +- ...onTypeWithRecursiveSubtypeReduction2.types | 2 +- tests/baselines/reference/uniqueSymbols.types | 6 +- .../reference/uniqueSymbolsDeclarations.types | 6 +- .../reference/unknownControlFlow.types | 32 +-- tests/baselines/reference/unknownType1.types | 4 +- .../reference/unknownType2.errors.txt | 4 +- tests/baselines/reference/unknownType2.types | 12 +- .../unreachableSwitchTypeofAny.types | 2 +- .../unreachableSwitchTypeofUnknown.types | 2 +- ...unusedLocalsAndParametersTypeAliases.types | 2 +- .../useUnknownInCatchVariables01.types | 4 +- tests/baselines/reference/variadicTuples1.js | 20 +- .../baselines/reference/variadicTuples1.types | 4 +- .../reference/voidIsInitialized.types | 4 +- .../vueLikeDataAndPropsInference2.types | 4 +- .../weakTypeAndPrimitiveNarrowing.types | 8 +- .../reference/weakTypesAndLiterals01.js | 19 +- .../reference/weakTypesAndLiterals01.types | 14 +- .../fourslash/bestCommonTypeObjectLiterals.ts | 2 +- .../fourslash/codeFixAddMissingAttributes8.ts | 2 +- .../fourslash/codeFixAddMissingAttributes9.ts | 2 +- .../codeFixAddMissingProperties16.ts | 152 ++++++------ .../codeFixClassExtendAbstractMethod.ts | 2 +- ...eFixClassImplementInterfaceNoTruncation.ts | 47 ---- .../codeFixInferFromFunctionUsage.ts | 2 +- ...codeFixMissingTypeAnnotationOnExports15.ts | 2 +- .../fourslash/completionForStringLiteral10.ts | 2 +- .../fourslash/completionForStringLiteral11.ts | 2 +- .../fourslash/completionForStringLiteral5.ts | 2 +- .../fourslash/completionForStringLiteral7.ts | 2 +- .../fourslash/completionForStringLiteral8.ts | 2 +- .../fourslash/completionListAtThisType.ts | 2 +- ...LiteralFromInferenceWithinInferredType1.ts | 2 +- ...LiteralFromInferenceWithinInferredType3.ts | 2 +- ...letionsStringLiteral_fromTypeConstraint.ts | 2 +- .../completionsWithStringReplacementMode.ts | 4 +- .../fourslash/exhaustiveCaseCompletions1.ts | 10 +- .../fourslash/exhaustiveCaseCompletions2.ts | 10 +- .../fourslash/exhaustiveCaseCompletions3.ts | 2 +- .../fourslash/exhaustiveCaseCompletions7.ts | 8 +- .../fourslash/quickInfoCanBeTruncated.ts | 53 ++--- .../fourslash/server/quickinfoWrongComment.ts | 2 +- ...nditionalTypesUsingTemplateLiteralTypes.ts | 4 +- ...pletionsForOpenEndedTemplateLiteralType.ts | 2 +- ...ErrorAfterStringCompletionsInNestedCall.ts | 2 +- ...rrorAfterStringCompletionsInNestedCall2.ts | 4 +- 648 files changed, 3683 insertions(+), 3915 deletions(-) create mode 100644 tests/baselines/reference/coAndContraVariantInferences5.errors.txt delete mode 100644 tests/cases/fourslash/codeFixClassImplementInterfaceNoTruncation.ts diff --git a/tests/baselines/reference/TypeGuardWithArrayUnion.types b/tests/baselines/reference/TypeGuardWithArrayUnion.types index 383b3398340b9..ef44ed2880f52 100644 --- a/tests/baselines/reference/TypeGuardWithArrayUnion.types +++ b/tests/baselines/reference/TypeGuardWithArrayUnion.types @@ -13,13 +13,13 @@ class Message { function saySize(message: Message | Message[]) { >saySize : (message: Message | Message[]) => number > : ^ ^^ ^^^^^^^^^^^ ->message : Message | Message[] +>message : Message[] | Message > : ^^^^^^^^^^^^^^^^^^^ if (message instanceof Array) { >message instanceof Array : boolean > : ^^^^^^^ ->message : Message | Message[] +>message : Message[] | Message > : ^^^^^^^^^^^^^^^^^^^ >Array : ArrayConstructor > : ^^^^^^^^^^^^^^^^ diff --git a/tests/baselines/reference/TypeGuardWithEnumUnion.types b/tests/baselines/reference/TypeGuardWithEnumUnion.types index 69bf80d6428a9..28dd5f988691b 100644 --- a/tests/baselines/reference/TypeGuardWithEnumUnion.types +++ b/tests/baselines/reference/TypeGuardWithEnumUnion.types @@ -20,7 +20,7 @@ function f1(x: Color | string) { if (typeof x === "number") { >typeof x === "number" : boolean > : ^^^^^^^ ->typeof x : "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function" +>typeof x : "bigint" | "boolean" | "function" | "number" | "object" | "string" | "symbol" | "undefined" > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >x : string | Color > : ^^^^^^^^^^^^^^ @@ -53,15 +53,15 @@ function f1(x: Color | string) { function f2(x: Color | string | string[]) { >f2 : (x: Color | string | string[]) => void > : ^ ^^ ^^^^^^^^^ ->x : string | Color | string[] +>x : string | string[] | Color > : ^^^^^^^^^^^^^^^^^^^^^^^^^ if (typeof x === "object") { >typeof x === "object" : boolean > : ^^^^^^^ ->typeof x : "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function" +>typeof x : "bigint" | "boolean" | "function" | "number" | "object" | "string" | "symbol" | "undefined" > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->x : string | Color | string[] +>x : string | string[] | Color > : ^^^^^^^^^^^^^^^^^^^^^^^^^ >"object" : "object" > : ^^^^^^^^ @@ -79,9 +79,9 @@ function f2(x: Color | string | string[]) { if (typeof x === "number") { >typeof x === "number" : boolean > : ^^^^^^^ ->typeof x : "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function" +>typeof x : "bigint" | "boolean" | "function" | "number" | "object" | "string" | "symbol" | "undefined" > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->x : string | Color | string[] +>x : string | string[] | Color > : ^^^^^^^^^^^^^^^^^^^^^^^^^ >"number" : "number" > : ^^^^^^^^ @@ -110,9 +110,9 @@ function f2(x: Color | string | string[]) { if (typeof x === "string") { >typeof x === "string" : boolean > : ^^^^^^^ ->typeof x : "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function" +>typeof x : "bigint" | "boolean" | "function" | "number" | "object" | "string" | "symbol" | "undefined" > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->x : string | Color | string[] +>x : string | string[] | Color > : ^^^^^^^^^^^^^^^^^^^^^^^^^ >"string" : "string" > : ^^^^^^^^ @@ -129,13 +129,13 @@ function f2(x: Color | string | string[]) { } else { var b = x; ->b : Color | string[] +>b : string[] | Color > : ^^^^^^^^^^^^^^^^ ->x : Color | string[] +>x : string[] | Color > : ^^^^^^^^^^^^^^^^ var b: Color | string[]; ->b : Color | string[] +>b : string[] | Color > : ^^^^^^^^^^^^^^^^ } } diff --git a/tests/baselines/reference/ambientExportDefaultErrors.types b/tests/baselines/reference/ambientExportDefaultErrors.types index 8a94feba8dff7..fae5c247b1475 100644 --- a/tests/baselines/reference/ambientExportDefaultErrors.types +++ b/tests/baselines/reference/ambientExportDefaultErrors.types @@ -41,7 +41,7 @@ declare module "indirect" { > : ^^^^^^^^^^^^^^^^^^^^^^^^^ export default typeof Foo.default; ->typeof Foo.default : "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function" +>typeof Foo.default : "bigint" | "boolean" | "function" | "number" | "object" | "string" | "symbol" | "undefined" > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >Foo.default : number > : ^^^^^^ @@ -58,7 +58,7 @@ declare module "indirect2" { > : ^^^^^^^^^^^^^^^^^^^^^^^^^^ export = typeof Foo2; ->typeof Foo2 : "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function" +>typeof Foo2 : "bigint" | "boolean" | "function" | "number" | "object" | "string" | "symbol" | "undefined" > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >Foo2 : number > : ^^^^^^ diff --git a/tests/baselines/reference/anonymousClassExpression1.types b/tests/baselines/reference/anonymousClassExpression1.types index 246a0a1ae1bbc..0b4f4c413c76c 100644 --- a/tests/baselines/reference/anonymousClassExpression1.types +++ b/tests/baselines/reference/anonymousClassExpression1.types @@ -8,7 +8,7 @@ function f() { return typeof class {} === "function"; >typeof class {} === "function" : boolean > : ^^^^^^^ ->typeof class {} : "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function" +>typeof class {} : "bigint" | "boolean" | "function" | "number" | "object" | "string" | "symbol" | "undefined" > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >class {} : typeof (Anonymous class) > : ^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index 2531c9ea0413d..2798e60d3d316 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -6570,21 +6570,21 @@ declare namespace ts { enum TypeFlags { Any = 1, Unknown = 2, - String = 4, - Number = 8, - Boolean = 16, - Enum = 32, - BigInt = 64, - StringLiteral = 128, - NumberLiteral = 256, - BooleanLiteral = 512, - EnumLiteral = 1024, - BigIntLiteral = 2048, - ESSymbol = 4096, - UniqueESSymbol = 8192, - Void = 16384, - Undefined = 32768, - Null = 65536, + Undefined = 4, + Null = 8, + Void = 16, + String = 32, + Number = 64, + BigInt = 128, + Boolean = 256, + ESSymbol = 512, + StringLiteral = 1024, + NumberLiteral = 2048, + BooleanLiteral = 4096, + BigIntLiteral = 8192, + UniqueESSymbol = 16384, + EnumLiteral = 32768, + Enum = 65536, Never = 131072, TypeParameter = 262144, Object = 524288, @@ -6597,18 +6597,18 @@ declare namespace ts { NonPrimitive = 67108864, TemplateLiteral = 134217728, StringMapping = 268435456, - Literal = 2944, - Unit = 109472, - Freshable = 2976, - StringOrNumberLiteral = 384, - PossiblyFalsy = 117724, - StringLike = 402653316, - NumberLike = 296, - BigIntLike = 2112, - BooleanLike = 528, - EnumLike = 1056, - ESSymbolLike = 12288, - VoidLike = 49152, + Literal = 15360, + Unit = 97292, + Freshable = 80896, + StringOrNumberLiteral = 3072, + PossiblyFalsy = 15868, + StringLike = 402654240, + NumberLike = 67648, + BigIntLike = 8320, + BooleanLike = 4352, + EnumLike = 98304, + ESSymbolLike = 16896, + VoidLike = 20, UnionOrIntersection = 3145728, StructuredType = 3670016, TypeVariable = 8650752, @@ -6616,7 +6616,7 @@ declare namespace ts { InstantiablePrimitive = 406847488, Instantiable = 465829888, StructuredOrInstantiable = 469499904, - Narrowable = 536624127, + Narrowable = 536707043, } type DestructuringPattern = BindingPattern | ObjectLiteralExpression | ArrayLiteralExpression; interface Type { diff --git a/tests/baselines/reference/arrayBestCommonTypes.types b/tests/baselines/reference/arrayBestCommonTypes.types index 2ed7f2c9d8fa3..35627721ca563 100644 --- a/tests/baselines/reference/arrayBestCommonTypes.types +++ b/tests/baselines/reference/arrayBestCommonTypes.types @@ -620,10 +620,10 @@ module EmptyTypes { > : ^^^^^^^^^^^^ var b1 = [baseObj, base2Obj, ifaceObj]; ->b1 : iface[] -> : ^^^^^^^ ->[baseObj, base2Obj, ifaceObj] : iface[] -> : ^^^^^^^ +>b1 : (base | base2)[] +> : ^^^^^^^^^^^^^^^^ +>[baseObj, base2Obj, ifaceObj] : (base | base2)[] +> : ^^^^^^^^^^^^^^^^ >baseObj : base > : ^^^^ >base2Obj : base2 @@ -632,10 +632,10 @@ module EmptyTypes { > : ^^^^^ var b2 = [base2Obj, baseObj, ifaceObj]; ->b2 : iface[] -> : ^^^^^^^ ->[base2Obj, baseObj, ifaceObj] : iface[] -> : ^^^^^^^ +>b2 : (base | base2)[] +> : ^^^^^^^^^^^^^^^^ +>[base2Obj, baseObj, ifaceObj] : (base | base2)[] +> : ^^^^^^^^^^^^^^^^ >base2Obj : base2 > : ^^^^^ >baseObj : base @@ -644,10 +644,10 @@ module EmptyTypes { > : ^^^^^ var b3 = [baseObj, ifaceObj, base2Obj]; ->b3 : iface[] -> : ^^^^^^^ ->[baseObj, ifaceObj, base2Obj] : iface[] -> : ^^^^^^^ +>b3 : (base | base2)[] +> : ^^^^^^^^^^^^^^^^ +>[baseObj, ifaceObj, base2Obj] : (base | base2)[] +> : ^^^^^^^^^^^^^^^^ >baseObj : base > : ^^^^ >ifaceObj : iface @@ -656,10 +656,10 @@ module EmptyTypes { > : ^^^^^ var b4 = [ifaceObj, baseObj, base2Obj]; ->b4 : iface[] -> : ^^^^^^^ ->[ifaceObj, baseObj, base2Obj] : iface[] -> : ^^^^^^^ +>b4 : (base | base2)[] +> : ^^^^^^^^^^^^^^^^ +>[ifaceObj, baseObj, base2Obj] : (base | base2)[] +> : ^^^^^^^^^^^^^^^^ >ifaceObj : iface > : ^^^^^ >baseObj : base diff --git a/tests/baselines/reference/arrayConcat3.types b/tests/baselines/reference/arrayConcat3.types index 7903cd79dcbc9..5b065df162661 100644 --- a/tests/baselines/reference/arrayConcat3.types +++ b/tests/baselines/reference/arrayConcat3.types @@ -19,11 +19,11 @@ function doStuff(a: Array>, b: Arrayb.concat(a) : Fn[] > : ^^^^^^^^ ->b.concat : { (...items: ConcatArray>[]): Fn[]; (...items: (Fn | ConcatArray>)[]): Fn[]; } +>b.concat : { (...items: ConcatArray>[]): Fn[]; (...items: (ConcatArray> | Fn)[]): Fn[]; } > : ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >b : Fn[] > : ^^^^^^^^ ->concat : { (...items: ConcatArray>[]): Fn[]; (...items: (Fn | ConcatArray>)[]): Fn[]; } +>concat : { (...items: ConcatArray>[]): Fn[]; (...items: (ConcatArray> | Fn)[]): Fn[]; } > : ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >a : Fn[] > : ^^^^^^^ diff --git a/tests/baselines/reference/arrayDestructuringInSwitch1.types b/tests/baselines/reference/arrayDestructuringInSwitch1.types index ec8ad2209e0b2..dc9e0a9041e6f 100644 --- a/tests/baselines/reference/arrayDestructuringInSwitch1.types +++ b/tests/baselines/reference/arrayDestructuringInSwitch1.types @@ -97,7 +97,7 @@ export function evaluate(expression: Expression): boolean { return expression === 'true'; >expression === 'true' : boolean > : ^^^^^^^ ->expression : "true" | "false" +>expression : "false" | "true" > : ^^^^^^^^^^^^^^^^ >'true' : "true" > : ^^^^^^ diff --git a/tests/baselines/reference/arrayEvery.types b/tests/baselines/reference/arrayEvery.types index 6210757b88e8a..7e05640404244 100644 --- a/tests/baselines/reference/arrayEvery.types +++ b/tests/baselines/reference/arrayEvery.types @@ -18,7 +18,7 @@ const isString = (x: unknown): x is string => typeof x === 'string'; > : ^^^^^^^ >typeof x === 'string' : boolean > : ^^^^^^^ ->typeof x : "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function" +>typeof x : "bigint" | "boolean" | "function" | "number" | "object" | "string" | "symbol" | "undefined" > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >x : unknown > : ^^^^^^^ diff --git a/tests/baselines/reference/arrayFind.types b/tests/baselines/reference/arrayFind.types index b1f9aff8e6429..9d8792e1259a6 100644 --- a/tests/baselines/reference/arrayFind.types +++ b/tests/baselines/reference/arrayFind.types @@ -10,7 +10,7 @@ function isNumber(x: any): x is number { return typeof x === "number"; >typeof x === "number" : boolean > : ^^^^^^^ ->typeof x : "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function" +>typeof x : "bigint" | "boolean" | "function" | "number" | "object" | "string" | "symbol" | "undefined" > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >x : any >"number" : "number" diff --git a/tests/baselines/reference/arrayFlatNoCrashInference.types b/tests/baselines/reference/arrayFlatNoCrashInference.types index 8bbd51bbd00f1..dbdac3d883728 100644 --- a/tests/baselines/reference/arrayFlatNoCrashInference.types +++ b/tests/baselines/reference/arrayFlatNoCrashInference.types @@ -2,7 +2,7 @@ === arrayFlatNoCrashInference.ts === function foo(arr: T[], depth: number) { ->foo : (arr: T[], depth: number) => FlatArray[] +>foo : (arr: T[], depth: number) => FlatArray[] > : ^ ^^ ^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >arr : T[] > : ^^^ @@ -10,7 +10,7 @@ function foo(arr: T[], depth: number) { > : ^^^^^^ return arr.flat(depth); ->arr.flat(depth) : FlatArray[] +>arr.flat(depth) : FlatArray[] > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >arr.flat : (this: A, depth?: D | undefined) => FlatArray[] > : ^ ^^ ^^^^^^^^^ ^^^^^^ ^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/baselines/reference/arrayFlatNoCrashInferenceDeclarations.js b/tests/baselines/reference/arrayFlatNoCrashInferenceDeclarations.js index 1ff74edb7d62d..b5aaeaed996aa 100644 --- a/tests/baselines/reference/arrayFlatNoCrashInferenceDeclarations.js +++ b/tests/baselines/reference/arrayFlatNoCrashInferenceDeclarations.js @@ -13,4 +13,4 @@ function foo(arr, depth) { //// [arrayFlatNoCrashInferenceDeclarations.d.ts] -declare function foo(arr: T[], depth: number): FlatArray[]; +declare function foo(arr: T[], depth: number): FlatArray[]; diff --git a/tests/baselines/reference/arrayFlatNoCrashInferenceDeclarations.types b/tests/baselines/reference/arrayFlatNoCrashInferenceDeclarations.types index 05081a3f9f0cc..25e6945200d2b 100644 --- a/tests/baselines/reference/arrayFlatNoCrashInferenceDeclarations.types +++ b/tests/baselines/reference/arrayFlatNoCrashInferenceDeclarations.types @@ -2,7 +2,7 @@ === arrayFlatNoCrashInferenceDeclarations.ts === function foo(arr: T[], depth: number) { ->foo : (arr: T[], depth: number) => FlatArray[] +>foo : (arr: T[], depth: number) => FlatArray[] > : ^ ^^ ^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >arr : T[] > : ^^^ @@ -10,7 +10,7 @@ function foo(arr: T[], depth: number) { > : ^^^^^^ return arr.flat(depth); ->arr.flat(depth) : FlatArray[] +>arr.flat(depth) : FlatArray[] > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >arr.flat : (this: A, depth?: D | undefined) => FlatArray[] > : ^ ^^ ^^^^^^^^^ ^^^^^^ ^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/baselines/reference/arrayLiteralComments.types b/tests/baselines/reference/arrayLiteralComments.types index 66fb48f01742f..f1f2576fbb239 100644 --- a/tests/baselines/reference/arrayLiteralComments.types +++ b/tests/baselines/reference/arrayLiteralComments.types @@ -2,9 +2,9 @@ === arrayLiteralComments.ts === var testArrayWithFunc = [ ->testArrayWithFunc : (string | number | (() => void) | number[] | { a: number; })[] +>testArrayWithFunc : (string | number | number[] | (() => void) | { a: number; })[] > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->[ // Function comment function() { let x = 1; }, // String comment '1', // Numeric comment 2, // Object comment { a: 1 }, // Array comment [1, 2, 3]] : (string | number | (() => void) | number[] | { a: number; })[] +>[ // Function comment function() { let x = 1; }, // String comment '1', // Numeric comment 2, // Object comment { a: 1 }, // Array comment [1, 2, 3]] : (string | number | number[] | (() => void) | { a: number; })[] > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // Function comment diff --git a/tests/baselines/reference/arrayLiteralContextualType.types b/tests/baselines/reference/arrayLiteralContextualType.types index 584ba43dd83e1..c3b433fdfc4e7 100644 --- a/tests/baselines/reference/arrayLiteralContextualType.types +++ b/tests/baselines/reference/arrayLiteralContextualType.types @@ -60,7 +60,7 @@ foo([ > : ^^^^ >foo : (animals: IAnimal[]) => void > : ^ ^^ ^^^^^^^^^ ->[ new Giraffe(), new Elephant()] : (Giraffe | Elephant)[] +>[ new Giraffe(), new Elephant()] : (Elephant | Giraffe)[] > : ^^^^^^^^^^^^^^^^^^^^^^ new Giraffe(), @@ -81,7 +81,7 @@ bar([ > : ^^^^ >bar : (animals: { [n: number]: IAnimal; }) => void > : ^ ^^ ^^^^^^^^^ ->[ new Giraffe(), new Elephant()] : (Giraffe | Elephant)[] +>[ new Giraffe(), new Elephant()] : (Elephant | Giraffe)[] > : ^^^^^^^^^^^^^^^^^^^^^^ new Giraffe(), @@ -99,9 +99,9 @@ bar([ ]); // Legal because of the contextual type IAnimal provided by the parameter var arr = [new Giraffe(), new Elephant()]; ->arr : (Giraffe | Elephant)[] +>arr : (Elephant | Giraffe)[] > : ^^^^^^^^^^^^^^^^^^^^^^ ->[new Giraffe(), new Elephant()] : (Giraffe | Elephant)[] +>[new Giraffe(), new Elephant()] : (Elephant | Giraffe)[] > : ^^^^^^^^^^^^^^^^^^^^^^ >new Giraffe() : Giraffe > : ^^^^^^^ @@ -117,7 +117,7 @@ foo(arr); // ok because arr is Array not {}[] > : ^^^^ >foo : (animals: IAnimal[]) => void > : ^ ^^ ^^^^^^^^^ ->arr : (Giraffe | Elephant)[] +>arr : (Elephant | Giraffe)[] > : ^^^^^^^^^^^^^^^^^^^^^^ bar(arr); // ok because arr is Array not {}[] @@ -125,6 +125,6 @@ bar(arr); // ok because arr is Array not {}[] > : ^^^^ >bar : (animals: { [n: number]: IAnimal; }) => void > : ^ ^^ ^^^^^^^^^ ->arr : (Giraffe | Elephant)[] +>arr : (Elephant | Giraffe)[] > : ^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/baselines/reference/arrayLiteralInference.types b/tests/baselines/reference/arrayLiteralInference.types index 6520794bbf907..6464795a1ea43 100644 --- a/tests/baselines/reference/arrayLiteralInference.types +++ b/tests/baselines/reference/arrayLiteralInference.types @@ -94,7 +94,7 @@ const appTypeStylesWithError: Map> = new Map([ > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >Map : MapConstructor > : ^^^^^^^^^^^^^^ ->[ [AppType.Standard, [AppStyle.Standard, AppStyle.MiniApp]], [AppType.Relationship, [AppStyle.Standard, AppStyle.Tree, AppStyle.TreeEntity]], [AppType.AdvancedList, [AppStyle.Standard, AppStyle.MiniApp]]] : ([AppType.Standard, (AppStyle.Standard | AppStyle.MiniApp)[]] | [AppType.Relationship, (AppStyle.Tree | AppStyle.TreeEntity | AppStyle.Standard)[]] | [AppType.AdvancedList, (AppStyle.Standard | AppStyle.MiniApp)[]])[] +>[ [AppType.Standard, [AppStyle.Standard, AppStyle.MiniApp]], [AppType.Relationship, [AppStyle.Standard, AppStyle.Tree, AppStyle.TreeEntity]], [AppType.AdvancedList, [AppStyle.Standard, AppStyle.MiniApp]]] : ([AppType.AdvancedList, (AppStyle.Standard | AppStyle.MiniApp)[]] | [AppType.Standard, (AppStyle.Standard | AppStyle.MiniApp)[]] | [AppType.Relationship, (AppStyle.Tree | AppStyle.TreeEntity | AppStyle.Standard)[]])[] > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [AppType.Standard, [AppStyle.Standard, AppStyle.MiniApp]], @@ -210,7 +210,7 @@ let b1: { x: boolean }[] = foo({ x: true }, { x: false }); let b2: boolean[][] = foo([true], [false]); >b2 : boolean[][] > : ^^^^^^^^^^^ ->foo([true], [false]) : (true[] | false[])[] +>foo([true], [false]) : (false[] | true[])[] > : ^^^^^^^^^^^^^^^^^^^^ >foo : (...args: T[]) => T[] > : ^ ^^^^^ ^^ ^^^^^ diff --git a/tests/baselines/reference/arrayLiterals.types b/tests/baselines/reference/arrayLiterals.types index 5b4d21f2acf5b..7198be6ca0aae 100644 --- a/tests/baselines/reference/arrayLiterals.types +++ b/tests/baselines/reference/arrayLiterals.types @@ -4,9 +4,9 @@ // Empty array literal with no contextual type has type Undefined[] var arr1= [[], [1], ['']]; ->arr1 : (number[] | string[])[] +>arr1 : (string[] | number[])[] > : ^^^^^^^^^^^^^^^^^^^^^^^ ->[[], [1], ['']] : (number[] | string[])[] +>[[], [1], ['']] : (string[] | number[])[] > : ^^^^^^^^^^^^^^^^^^^^^^^ >[] : undefined[] > : ^^^^^^^^^^^ @@ -20,9 +20,9 @@ var arr1= [[], [1], ['']]; > : ^^ var arr2 = [[null], [1], ['']]; ->arr2 : (number[] | string[])[] +>arr2 : (string[] | number[])[] > : ^^^^^^^^^^^^^^^^^^^^^^^ ->[[null], [1], ['']] : (number[] | string[])[] +>[[null], [1], ['']] : (string[] | number[])[] > : ^^^^^^^^^^^^^^^^^^^^^^^ >[null] : null[] > : ^^^^^^ diff --git a/tests/baselines/reference/arrayLiterals3.types b/tests/baselines/reference/arrayLiterals3.types index a1ea1c432147b..e497a1e9d8936 100644 --- a/tests/baselines/reference/arrayLiterals3.types +++ b/tests/baselines/reference/arrayLiterals3.types @@ -97,11 +97,11 @@ var temp2: [number[], string[]] = [[1, 2, 3], ["hello", "string"]]; interface tup { 0: number[]|string[]; ->0 : number[] | string[] +>0 : string[] | number[] > : ^^^^^^^^^^^^^^^^^^^ 1: number[]|string[]; ->1 : number[] | string[] +>1 : string[] | number[] > : ^^^^^^^^^^^^^^^^^^^ } interface myArray extends Array { } @@ -111,7 +111,7 @@ var c0: tup = [...temp2]; // Error > : ^^^ >[...temp2] : [number[], string[]] > : ^^^^^^^^^^^^^^^^^^^^ ->...temp2 : number[] | string[] +>...temp2 : string[] | number[] > : ^^^^^^^^^^^^^^^^^^^ >temp2 : [number[], string[]] > : ^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/baselines/reference/arrayLiteralsWithRecursiveGenerics.types b/tests/baselines/reference/arrayLiteralsWithRecursiveGenerics.types index 5714861176f3f..167ac8d002a9f 100644 --- a/tests/baselines/reference/arrayLiteralsWithRecursiveGenerics.types +++ b/tests/baselines/reference/arrayLiteralsWithRecursiveGenerics.types @@ -63,9 +63,9 @@ var xs = [list, myList]; // {}[] > : ^^^^^^^^^^^^^^ var ys = [list, list2]; // {}[] ->ys : (List | List)[] +>ys : (List | List)[] > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->[list, list2] : (List | List)[] +>[list, list2] : (List | List)[] > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >list : List > : ^^^^^^^^^^^^ diff --git a/tests/baselines/reference/arrayconcat.types b/tests/baselines/reference/arrayconcat.types index 6cdcb06d06a7f..99de888cfc398 100644 --- a/tests/baselines/reference/arrayconcat.types +++ b/tests/baselines/reference/arrayconcat.types @@ -66,7 +66,7 @@ class parser { > : ^^^^^^^^^^ >sort : (compareFn?: (a: IOptions, b: IOptions) => number) => IOptions[] > : ^ ^^^^ ^^^^^^^^^^^^ ^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^ ->function(a, b) { var aName = a.name.toLowerCase(); var bName = b.name.toLowerCase(); if (aName > bName) { return 1; } else if (aName < bName) { return -1; } else { return 0; } } : (a: IOptions, b: IOptions) => 1 | -1 | 0 +>function(a, b) { var aName = a.name.toLowerCase(); var bName = b.name.toLowerCase(); if (aName > bName) { return 1; } else if (aName < bName) { return -1; } else { return 0; } } : (a: IOptions, b: IOptions) => -1 | 0 | 1 > : ^ ^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^ >a : IOptions > : ^^^^^^^^ diff --git a/tests/baselines/reference/arrowFunctionParsingDoesNotConfuseParenthesizedObjectForArrowHead.types b/tests/baselines/reference/arrowFunctionParsingDoesNotConfuseParenthesizedObjectForArrowHead.types index e7999a9ef5b9c..17412ef75b596 100644 --- a/tests/baselines/reference/arrowFunctionParsingDoesNotConfuseParenthesizedObjectForArrowHead.types +++ b/tests/baselines/reference/arrowFunctionParsingDoesNotConfuseParenthesizedObjectForArrowHead.types @@ -10,13 +10,13 @@ declare var a: any; >a : any const test = () => ({ ->test : () => { prop: boolean; run: () => "special" | "default"; } +>test : () => { prop: boolean; run: () => "default" | "special"; } > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->() => ({ // "Identifier expected." error on "!" and two "Duplicate identifier '(Missing)'." errors on space. prop: !value, // remove ! to see that errors will be gone run: () => { //replace arrow function with regular function to see that errors will be gone // comment next line or remove "()" to see that errors will be gone if(!a.b()) { return 'special'; } return 'default'; }}) : () => { prop: boolean; run: () => "special" | "default"; } +>() => ({ // "Identifier expected." error on "!" and two "Duplicate identifier '(Missing)'." errors on space. prop: !value, // remove ! to see that errors will be gone run: () => { //replace arrow function with regular function to see that errors will be gone // comment next line or remove "()" to see that errors will be gone if(!a.b()) { return 'special'; } return 'default'; }}) : () => { prop: boolean; run: () => "default" | "special"; } > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->({ // "Identifier expected." error on "!" and two "Duplicate identifier '(Missing)'." errors on space. prop: !value, // remove ! to see that errors will be gone run: () => { //replace arrow function with regular function to see that errors will be gone // comment next line or remove "()" to see that errors will be gone if(!a.b()) { return 'special'; } return 'default'; }}) : { prop: boolean; run: () => "special" | "default"; } +>({ // "Identifier expected." error on "!" and two "Duplicate identifier '(Missing)'." errors on space. prop: !value, // remove ! to see that errors will be gone run: () => { //replace arrow function with regular function to see that errors will be gone // comment next line or remove "()" to see that errors will be gone if(!a.b()) { return 'special'; } return 'default'; }}) : { prop: boolean; run: () => "default" | "special"; } > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->{ // "Identifier expected." error on "!" and two "Duplicate identifier '(Missing)'." errors on space. prop: !value, // remove ! to see that errors will be gone run: () => { //replace arrow function with regular function to see that errors will be gone // comment next line or remove "()" to see that errors will be gone if(!a.b()) { return 'special'; } return 'default'; }} : { prop: boolean; run: () => "special" | "default"; } +>{ // "Identifier expected." error on "!" and two "Duplicate identifier '(Missing)'." errors on space. prop: !value, // remove ! to see that errors will be gone run: () => { //replace arrow function with regular function to see that errors will be gone // comment next line or remove "()" to see that errors will be gone if(!a.b()) { return 'special'; } return 'default'; }} : { prop: boolean; run: () => "default" | "special"; } > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // "Identifier expected." error on "!" and two "Duplicate identifier '(Missing)'." errors on space. @@ -29,9 +29,9 @@ const test = () => ({ > : ^^^^^^^ run: () => { //replace arrow function with regular function to see that errors will be gone ->run : () => "special" | "default" +>run : () => "default" | "special" > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->() => { //replace arrow function with regular function to see that errors will be gone // comment next line or remove "()" to see that errors will be gone if(!a.b()) { return 'special'; } return 'default'; } : () => "special" | "default" +>() => { //replace arrow function with regular function to see that errors will be gone // comment next line or remove "()" to see that errors will be gone if(!a.b()) { return 'special'; } return 'default'; } : () => "default" | "special" > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^ // comment next line or remove "()" to see that errors will be gone diff --git a/tests/baselines/reference/assertionTypePredicates1.types b/tests/baselines/reference/assertionTypePredicates1.types index fe938414d516e..85c17e8586c08 100644 --- a/tests/baselines/reference/assertionTypePredicates1.types +++ b/tests/baselines/reference/assertionTypePredicates1.types @@ -62,7 +62,7 @@ function f01(x: unknown) { > : ^ ^^ ^^^^^ >typeof x === "string" : boolean > : ^^^^^^^ ->typeof x : "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function" +>typeof x : "bigint" | "boolean" | "function" | "number" | "object" | "string" | "symbol" | "undefined" > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >x : unknown > : ^^^^^^^ @@ -122,7 +122,7 @@ function f01(x: unknown) { > : ^^^^^^^ >typeof x === "boolean" : boolean > : ^^^^^^^ ->typeof x : "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function" +>typeof x : "bigint" | "boolean" | "function" | "number" | "object" | "string" | "symbol" | "undefined" > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >x : unknown > : ^^^^^^^ @@ -130,7 +130,7 @@ function f01(x: unknown) { > : ^^^^^^^^^ >typeof x === "number" : boolean > : ^^^^^^^ ->typeof x : "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function" +>typeof x : "bigint" | "boolean" | "function" | "number" | "object" | "string" | "symbol" | "undefined" > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >x : unknown > : ^^^^^^^ @@ -138,12 +138,12 @@ function f01(x: unknown) { > : ^^^^^^^^ x.toLocaleString; ->x.toLocaleString : ((locales?: string | string[], options?: Intl.NumberFormatOptions) => string) | (() => string) -> : ^^ ^^^ ^^ ^^^ ^^^^^ ^^^^^^^^^^^ ^ +>x.toLocaleString : (() => string) | ((locales?: string | string[], options?: Intl.NumberFormatOptions) => string) +> : ^^^^^^^ ^^^^^^ ^^^ ^^ ^^^ ^^^^^ ^ >x : number | boolean > : ^^^^^^^^^^^^^^^^ ->toLocaleString : ((locales?: string | string[], options?: Intl.NumberFormatOptions) => string) | (() => string) -> : ^^ ^^^ ^^ ^^^ ^^^^^ ^^^^^^^^^^^ ^ +>toLocaleString : (() => string) | ((locales?: string | string[], options?: Intl.NumberFormatOptions) => string) +> : ^^^^^^^ ^^^^^^ ^^^ ^^ ^^^ ^^^^^ ^ } if (!!true) { >!!true : true @@ -248,7 +248,7 @@ function f01(x: unknown) { > : ^^^^^^^^^ >typeof x === "string" : boolean > : ^^^^^^^ ->typeof x : "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function" +>typeof x : "bigint" | "boolean" | "function" | "number" | "object" | "string" | "symbol" | "undefined" > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >x : {} | null > : ^^^^^^^^^ @@ -672,7 +672,7 @@ class Test { > : ^ ^^ ^^^^^ >typeof x === "string" : boolean > : ^^^^^^^ ->typeof x : "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function" +>typeof x : "bigint" | "boolean" | "function" | "number" | "object" | "string" | "symbol" | "undefined" > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >x : unknown > : ^^^^^^^ @@ -783,7 +783,7 @@ class Derived extends Test { > : ^ ^^ ^^^^^ >typeof x === "string" : boolean > : ^^^^^^^ ->typeof x : "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function" +>typeof x : "bigint" | "boolean" | "function" | "number" | "object" | "string" | "symbol" | "undefined" > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >x : unknown > : ^^^^^^^ @@ -938,7 +938,7 @@ function f20(x: unknown) { > : ^ ^^ ^^^^^ >typeof x === "string" : boolean > : ^^^^^^^ ->typeof x : "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function" +>typeof x : "bigint" | "boolean" | "function" | "number" | "object" | "string" | "symbol" | "undefined" > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >x : unknown > : ^^^^^^^ @@ -964,7 +964,7 @@ function f20(x: unknown) { > : ^ >typeof x === "string" : boolean > : ^^^^^^^ ->typeof x : "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function" +>typeof x : "bigint" | "boolean" | "function" | "number" | "object" | "string" | "symbol" | "undefined" > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >x : unknown > : ^^^^^^^ @@ -990,7 +990,7 @@ function f20(x: unknown) { > : ^ ^^ ^^^^^ >typeof x === "string" : boolean > : ^^^^^^^ ->typeof x : "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function" +>typeof x : "bigint" | "boolean" | "function" | "number" | "object" | "string" | "symbol" | "undefined" > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >x : unknown > : ^^^^^^^ @@ -1016,7 +1016,7 @@ function f20(x: unknown) { > : ^ ^^ ^^^^^ >typeof x === "string" : boolean > : ^^^^^^^ ->typeof x : "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function" +>typeof x : "bigint" | "boolean" | "function" | "number" | "object" | "string" | "symbol" | "undefined" > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >x : unknown > : ^^^^^^^ diff --git a/tests/baselines/reference/assertionsAndNonReturningFunctions.types b/tests/baselines/reference/assertionsAndNonReturningFunctions.types index f93528300f054..33b7c02337684 100644 --- a/tests/baselines/reference/assertionsAndNonReturningFunctions.types +++ b/tests/baselines/reference/assertionsAndNonReturningFunctions.types @@ -37,7 +37,7 @@ function assertIsString(x) { > : ^^^^^^^ >typeof x === "string" : boolean > : ^^^^^^^ ->typeof x : "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function" +>typeof x : "bigint" | "boolean" | "function" | "number" | "object" | "string" | "symbol" | "undefined" > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >x : unknown > : ^^^^^^^ @@ -108,7 +108,7 @@ function f1(x) { > : ^^^^^^^^^^ >typeof x === "string" : boolean > : ^^^^^^^ ->typeof x : "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function" +>typeof x : "bigint" | "boolean" | "function" | "number" | "object" | "string" | "symbol" | "undefined" > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >x : any > : ^^^ @@ -138,7 +138,7 @@ function f1(x) { > : ^ ^^ ^^^^^ >typeof x === "string" : boolean > : ^^^^^^^ ->typeof x : "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function" +>typeof x : "bigint" | "boolean" | "function" | "number" | "object" | "string" | "symbol" | "undefined" > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >x : any > : ^^^ @@ -201,7 +201,7 @@ function f1(x) { * @param {boolean} b */ function f2(b) { ->f2 : (b: boolean) => 1 | 0 +>f2 : (b: boolean) => 0 | 1 > : ^ ^^ ^^^^^^^^^^ >b : boolean > : ^^^^^^^ diff --git a/tests/baselines/reference/assignmentCompatWithDiscriminatedUnion.errors.txt b/tests/baselines/reference/assignmentCompatWithDiscriminatedUnion.errors.txt index 91f79a95e46a5..0fa09776f5924 100644 --- a/tests/baselines/reference/assignmentCompatWithDiscriminatedUnion.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithDiscriminatedUnion.errors.txt @@ -1,11 +1,11 @@ assignmentCompatWithDiscriminatedUnion.ts(44,5): error TS2322: Type 'S' is not assignable to type 'T'. - Type 'S' is not assignable to type '{ a: 0; b: 4 | 1; }'. + Type 'S' is not assignable to type '{ a: 0; b: 1 | 4; }'. Types of property 'a' are incompatible. Type '0 | 2' is not assignable to type '0'. Type '2' is not assignable to type '0'. assignmentCompatWithDiscriminatedUnion.ts(58,5): error TS2322: Type 'S' is not assignable to type 'T'. - Type 'S' is not assignable to type '{ a: 0; b: 4 | 1; } | { a: 2; b: 4 | 3; c: string; }'. - Property 'c' is missing in type 'S' but required in type '{ a: 2; b: 4 | 3; c: string; }'. + Type 'S' is not assignable to type '{ a: 0; b: 1 | 4; } | { a: 2; b: 3 | 4; c: string; }'. + Property 'c' is missing in type 'S' but required in type '{ a: 2; b: 3 | 4; c: string; }'. assignmentCompatWithDiscriminatedUnion.ts(82,5): error TS2322: Type 'S' is not assignable to type 'T'. Type 'S' is not assignable to type '{ a: N; b: N; c: 2; }'. Types of property 'c' are incompatible. @@ -60,7 +60,7 @@ assignmentCompatWithDiscriminatedUnion.ts(82,5): error TS2322: Type 'S' is not a t = s; ~ !!! error TS2322: Type 'S' is not assignable to type 'T'. -!!! error TS2322: Type 'S' is not assignable to type '{ a: 0; b: 4 | 1; }'. +!!! error TS2322: Type 'S' is not assignable to type '{ a: 0; b: 1 | 4; }'. !!! error TS2322: Types of property 'a' are incompatible. !!! error TS2322: Type '0 | 2' is not assignable to type '0'. !!! error TS2322: Type '2' is not assignable to type '0'. @@ -80,8 +80,8 @@ assignmentCompatWithDiscriminatedUnion.ts(82,5): error TS2322: Type 'S' is not a t = s; ~ !!! error TS2322: Type 'S' is not assignable to type 'T'. -!!! error TS2322: Type 'S' is not assignable to type '{ a: 0; b: 4 | 1; } | { a: 2; b: 4 | 3; c: string; }'. -!!! error TS2322: Property 'c' is missing in type 'S' but required in type '{ a: 2; b: 4 | 3; c: string; }'. +!!! error TS2322: Type 'S' is not assignable to type '{ a: 0; b: 1 | 4; } | { a: 2; b: 3 | 4; c: string; }'. +!!! error TS2322: Property 'c' is missing in type 'S' but required in type '{ a: 2; b: 3 | 4; c: string; }'. !!! related TS2728 assignmentCompatWithDiscriminatedUnion.ts:52:36: 'c' is declared here. } diff --git a/tests/baselines/reference/assignmentCompatWithDiscriminatedUnion.symbols b/tests/baselines/reference/assignmentCompatWithDiscriminatedUnion.symbols index e52ea8f834394..ea3204ddb477c 100644 --- a/tests/baselines/reference/assignmentCompatWithDiscriminatedUnion.symbols +++ b/tests/baselines/reference/assignmentCompatWithDiscriminatedUnion.symbols @@ -383,9 +383,9 @@ namespace GH12052 { >undefined : Symbol(undefined) good.type = getAxisType(); ->good.type : Symbol(type, Decl(assignmentCompatWithDiscriminatedUnion.ts, 123, 27), Decl(assignmentCompatWithDiscriminatedUnion.ts, 125, 32)) +>good.type : Symbol(type, Decl(assignmentCompatWithDiscriminatedUnion.ts, 125, 32), Decl(assignmentCompatWithDiscriminatedUnion.ts, 123, 27)) >good : Symbol(good, Decl(assignmentCompatWithDiscriminatedUnion.ts, 139, 9)) ->type : Symbol(type, Decl(assignmentCompatWithDiscriminatedUnion.ts, 123, 27), Decl(assignmentCompatWithDiscriminatedUnion.ts, 125, 32)) +>type : Symbol(type, Decl(assignmentCompatWithDiscriminatedUnion.ts, 125, 32), Decl(assignmentCompatWithDiscriminatedUnion.ts, 123, 27)) >getAxisType : Symbol(getAxisType, Decl(assignmentCompatWithDiscriminatedUnion.ts, 128, 46)) } diff --git a/tests/baselines/reference/assignmentCompatWithDiscriminatedUnion.types b/tests/baselines/reference/assignmentCompatWithDiscriminatedUnion.types index be6617683be64..128a7b8948bba 100644 --- a/tests/baselines/reference/assignmentCompatWithDiscriminatedUnion.types +++ b/tests/baselines/reference/assignmentCompatWithDiscriminatedUnion.types @@ -73,7 +73,7 @@ namespace Example2 { > : ^ >a : 0 > : ^ ->b : 4 | 1 +>b : 1 | 4 > : ^^^^^ | { a: 1, b: 2 } // T1 @@ -85,7 +85,7 @@ namespace Example2 { | { a: 2, b: 3 | 4 }; // T2 >a : 2 > : ^ ->b : 4 | 3 +>b : 3 | 4 > : ^^^^^ declare let s: S; @@ -125,7 +125,7 @@ namespace Example3 { > : ^ >a : 0 > : ^ ->b : 4 | 1 +>b : 1 | 4 > : ^^^^^ | { a: 1, b: 2 | 4 } // T1 @@ -178,7 +178,7 @@ namespace Example4 { > : ^ >a : 0 > : ^ ->b : 4 | 1 +>b : 1 | 4 > : ^^^^^ | { a: 1, b: 2 } // T1 @@ -190,7 +190,7 @@ namespace Example4 { | { a: 2, b: 3 | 4, c: string }; // T2 >a : 2 > : ^ ->b : 4 | 3 +>b : 3 | 4 > : ^^^^^ >c : string > : ^^^^^^ @@ -523,11 +523,11 @@ namespace GH12052 { good.type = getAxisType(); >good.type = getAxisType() : IAxisType > : ^^^^^^^^^ ->good.type : "linear" | "categorical" +>good.type : "categorical" | "linear" > : ^^^^^^^^^^^^^^^^^^^^^^^^ >good : IAxis > : ^^^^^ ->type : "linear" | "categorical" +>type : "categorical" | "linear" > : ^^^^^^^^^^^^^^^^^^^^^^^^ >getAxisType() : IAxisType > : ^^^^^^^^^ @@ -693,7 +693,7 @@ namespace GH39357 { const a: A = b === "a" || b === "b" ? [b, 1] : ["c", ""]; >a : A > : ^ ->b === "a" || b === "b" ? [b, 1] : ["c", ""] : ["a" | "b", number] | ["c", string] +>b === "a" || b === "b" ? [b, 1] : ["c", ""] : ["c", string] | ["a" | "b", number] > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >b === "a" || b === "b" : boolean > : ^^^^^^^ diff --git a/tests/baselines/reference/assignmentToAnyArrayRestParameters.types b/tests/baselines/reference/assignmentToAnyArrayRestParameters.types index 7d26e0601b2d1..90cc5b3cd3b76 100644 --- a/tests/baselines/reference/assignmentToAnyArrayRestParameters.types +++ b/tests/baselines/reference/assignmentToAnyArrayRestParameters.types @@ -70,7 +70,7 @@ function bar() { > : ^^^ type T02 = string[][K | "0"]; ->T02 : string[][K | "0"] +>T02 : string[]["0" | K] > : ^^^^^^^^^^^^^^^^^ type T10 = T["0"]; @@ -82,7 +82,7 @@ function bar() { > : ^^^^^^^^ type T12 = T[K | "0"]; ->T12 : T[K | "0"] +>T12 : T["0" | K] > : ^^^^^^^^^^ } diff --git a/tests/baselines/reference/asyncFunctionContextuallyTypedReturns.types b/tests/baselines/reference/asyncFunctionContextuallyTypedReturns.types index 19a78cded49dc..30bac02927d64 100644 --- a/tests/baselines/reference/asyncFunctionContextuallyTypedReturns.types +++ b/tests/baselines/reference/asyncFunctionContextuallyTypedReturns.types @@ -14,11 +14,11 @@ f(v => v ? [0] : Promise.reject()); > : ^^^^ >f : (cb: (v: boolean) => [0] | PromiseLike<[0]>) => void > : ^ ^^ ^^^^^ ->v => v ? [0] : Promise.reject() : (v: boolean) => [0] | Promise<[0]> +>v => v ? [0] : Promise.reject() : (v: boolean) => Promise<[0]> | [0] > : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >v : boolean > : ^^^^^^^ ->v ? [0] : Promise.reject() : [0] | Promise<[0]> +>v ? [0] : Promise.reject() : Promise<[0]> | [0] > : ^^^^^^^^^^^^^^^^^^ >v : boolean > : ^^^^^^^ @@ -44,7 +44,7 @@ f(async v => v ? [0] : Promise.reject()); > : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^ >v : boolean > : ^^^^^^^ ->v ? [0] : Promise.reject() : [0] | Promise<[0]> +>v ? [0] : Promise.reject() : Promise<[0]> | [0] > : ^^^^^^^^^^^^^^^^^^ >v : boolean > : ^^^^^^^ @@ -136,12 +136,12 @@ h(v => v ? (abc) => { } : Promise.reject()); > : ^^^^ >h : (cb: (v: boolean) => MyCallback | PromiseLike) => void > : ^ ^^ ^^^^^ ->v => v ? (abc) => { } : Promise.reject() : (v: boolean) => ((abc: string) => void) | Promise -> : ^ ^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>v => v ? (abc) => { } : Promise.reject() : (v: boolean) => Promise | ((abc: string) => void) +> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^ >v : boolean > : ^^^^^^^ ->v ? (abc) => { } : Promise.reject() : ((abc: string) => void) | Promise -> : ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>v ? (abc) => { } : Promise.reject() : Promise | ((abc: string) => void) +> : ^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^ >v : boolean > : ^^^^^^^ >(abc) => { } : (abc: string) => void diff --git a/tests/baselines/reference/awaitUnionPromise.types b/tests/baselines/reference/awaitUnionPromise.types index 661a2c3999cd4..efe2278ae503d 100644 --- a/tests/baselines/reference/awaitUnionPromise.types +++ b/tests/baselines/reference/awaitUnionPromise.types @@ -54,13 +54,13 @@ async function main() { > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >await x.next2() : number | AsyncEnumeratorDone > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->x.next2() : Promise | Promise +>x.next2() : Promise | Promise > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->x.next2 : () => Promise | Promise +>x.next2 : () => Promise | Promise > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >x : IAsyncEnumerator > : ^^^^^^^^^^^^^^^^^^^^^^^^ ->next2 : () => Promise | Promise +>next2 : () => Promise | Promise > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ let c = await x.next3(); diff --git a/tests/baselines/reference/awaitUnion_es5.types b/tests/baselines/reference/awaitUnion_es5.types index 3a2e25736983f..3be4d98e83d29 100644 --- a/tests/baselines/reference/awaitUnion_es5.types +++ b/tests/baselines/reference/awaitUnion_es5.types @@ -6,7 +6,7 @@ declare let a: number | string; > : ^^^^^^^^^^^^^^^ declare let b: PromiseLike | PromiseLike; ->b : PromiseLike | PromiseLike +>b : PromiseLike | PromiseLike > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ declare let c: PromiseLike; @@ -38,7 +38,7 @@ async function f() { > : ^^^^^^^^^^^^^^^ >await b : string | number > : ^^^^^^^^^^^^^^^ ->b : PromiseLike | PromiseLike +>b : PromiseLike | PromiseLike > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ let await_c = await c; diff --git a/tests/baselines/reference/awaitUnion_es6.types b/tests/baselines/reference/awaitUnion_es6.types index 63302416c5210..a497a07b36a7f 100644 --- a/tests/baselines/reference/awaitUnion_es6.types +++ b/tests/baselines/reference/awaitUnion_es6.types @@ -6,7 +6,7 @@ declare let a: number | string; > : ^^^^^^^^^^^^^^^ declare let b: PromiseLike | PromiseLike; ->b : PromiseLike | PromiseLike +>b : PromiseLike | PromiseLike > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ declare let c: PromiseLike; @@ -38,7 +38,7 @@ async function f() { > : ^^^^^^^^^^^^^^^ >await b : string | number > : ^^^^^^^^^^^^^^^ ->b : PromiseLike | PromiseLike +>b : PromiseLike | PromiseLike > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ let await_c = await c; diff --git a/tests/baselines/reference/awaitedTypeNoLib.errors.txt b/tests/baselines/reference/awaitedTypeNoLib.errors.txt index f19971eed35b7..58e0eb02b7206 100644 --- a/tests/baselines/reference/awaitedTypeNoLib.errors.txt +++ b/tests/baselines/reference/awaitedTypeNoLib.errors.txt @@ -8,9 +8,9 @@ error TS2318: Cannot find global type 'Object'. error TS2318: Cannot find global type 'RegExp'. error TS2318: Cannot find global type 'String'. awaitedTypeNoLib.ts(3,15): error TS2304: Cannot find name 'PromiseLike'. -awaitedTypeNoLib.ts(18,27): error TS2345: Argument of type 'NotPromise | Thenable>' is not assignable to parameter of type 'Thenable'. +awaitedTypeNoLib.ts(18,27): error TS2345: Argument of type 'Thenable> | NotPromise' is not assignable to parameter of type 'Thenable'. Type 'NotPromise' is not assignable to type 'Thenable'. - Type 'TResult | (TResult extends PromiseLike ? never : TResult)' is not assignable to type 'Thenable'. + Type '(TResult extends PromiseLike ? never : TResult) | TResult' is not assignable to type 'Thenable'. Type 'Thenable & TResult' is not assignable to type 'Thenable'. Type 'unknown' is not assignable to type 'TResult'. 'TResult' could be instantiated with an arbitrary type which could be unrelated to 'unknown'. @@ -47,9 +47,9 @@ awaitedTypeNoLib.ts(18,27): error TS2345: Argument of type 'NotPromise // #58547 This previously was a Debug Failure. False expression: type provided should not be a non-generic 'promise'-like. this.resolvePromise(result, resolve); ~~~~~~ -!!! error TS2345: Argument of type 'NotPromise | Thenable>' is not assignable to parameter of type 'Thenable'. +!!! error TS2345: Argument of type 'Thenable> | NotPromise' is not assignable to parameter of type 'Thenable'. !!! error TS2345: Type 'NotPromise' is not assignable to type 'Thenable'. -!!! error TS2345: Type 'TResult | (TResult extends PromiseLike ? never : TResult)' is not assignable to type 'Thenable'. +!!! error TS2345: Type '(TResult extends PromiseLike ? never : TResult) | TResult' is not assignable to type 'Thenable'. !!! error TS2345: Type 'Thenable & TResult' is not assignable to type 'Thenable'. !!! error TS2345: Type 'unknown' is not assignable to type 'TResult'. !!! error TS2345: 'TResult' could be instantiated with an arbitrary type which could be unrelated to 'unknown'. diff --git a/tests/baselines/reference/awaitedTypeNoLib.types b/tests/baselines/reference/awaitedTypeNoLib.types index b24d5ad4165e7..8a2bb6c3ce375 100644 --- a/tests/baselines/reference/awaitedTypeNoLib.types +++ b/tests/baselines/reference/awaitedTypeNoLib.types @@ -31,7 +31,7 @@ class Thenable { > : ^ ^^ ^^ ^^ ^^ ^^^^^^^^^ result: NotPromise | Thenable>, ->result : NotPromise | Thenable> +>result : Thenable> | NotPromise > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ resolve: Receiver, @@ -42,7 +42,7 @@ class Thenable { if (result instanceof Thenable) { >result instanceof Thenable : boolean > : ^^^^^^^ ->result : NotPromise | Thenable> +>result : Thenable> | NotPromise > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >Thenable : typeof Thenable > : ^^^^^^^^^^^^^^^ @@ -57,7 +57,7 @@ class Thenable { > : ^^^^ >resolvePromise : (result: Thenable, resolve: Receiver) => void > : ^^^^^^^^^^^^ ^^ ^^ ^^ ^^^^^^^^^ ->result : NotPromise | Thenable> +>result : Thenable> | NotPromise > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >resolve : Receiver > : ^^^^^^^^^^^^^^^^^ diff --git a/tests/baselines/reference/bestChoiceType.types b/tests/baselines/reference/bestChoiceType.types index 2b0a3a974e312..a16a665bdfcd8 100644 --- a/tests/baselines/reference/bestChoiceType.types +++ b/tests/baselines/reference/bestChoiceType.types @@ -107,9 +107,9 @@ function f2() { > : ^^^^^^ let y = x ? x : []; ->y : RegExpMatchArray | never[] +>y : never[] | RegExpMatchArray > : ^^^^^^^^^^^^^^^^^^^^^^^^^^ ->x ? x : [] : RegExpMatchArray | never[] +>x ? x : [] : never[] | RegExpMatchArray > : ^^^^^^^^^^^^^^^^^^^^^^^^^^ >x : RegExpMatchArray | null > : ^^^^^^^^^^^^^^^^^^^^^^^ @@ -125,7 +125,7 @@ function f2() { > : ^^^^^ >y.map : ((callbackfn: (value: string, index: number, array: string[]) => U, thisArg?: any) => U[]) | ((callbackfn: (value: never, index: number, array: never[]) => U, thisArg?: any) => U[]) > : ^^ ^^ ^^^ ^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^^^^^^^ ^^ ^^^ ^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^^ ->y : RegExpMatchArray | never[] +>y : never[] | RegExpMatchArray > : ^^^^^^^^^^^^^^^^^^^^^^^^^^ >map : ((callbackfn: (value: string, index: number, array: string[]) => U, thisArg?: any) => U[]) | ((callbackfn: (value: never, index: number, array: never[]) => U, thisArg?: any) => U[]) > : ^^ ^^ ^^^ ^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^^^^^^^ ^^ ^^^ ^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^^ diff --git a/tests/baselines/reference/bivariantInferences.types b/tests/baselines/reference/bivariantInferences.types index b291cd530e474..080e9df5077e3 100644 --- a/tests/baselines/reference/bivariantInferences.types +++ b/tests/baselines/reference/bivariantInferences.types @@ -14,11 +14,11 @@ interface Array { } declare const a: (string | number)[] | null[] | undefined[] | {}[]; ->a : (string | number)[] | null[] | undefined[] | {}[] +>a : undefined[] | null[] | {}[] | (string | number)[] > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ declare const b: (string | number)[] | null[] | undefined[] | {}[]; ->b : (string | number)[] | null[] | undefined[] | {}[] +>b : undefined[] | null[] | {}[] | (string | number)[] > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ let x = a.equalsShallow(b); @@ -28,10 +28,10 @@ let x = a.equalsShallow(b); > : ^^^^^^^ >a.equalsShallow : ((this: readonly T[], other: readonly T[]) => boolean) | ((this: readonly T[], other: readonly T[]) => boolean) | ((this: readonly T[], other: readonly T[]) => boolean) | ((this: readonly T[], other: readonly T[]) => boolean) > : ^^ ^^ ^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^ ^^^^^^ ^^ ^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^ ^^^^^^ ^^ ^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^ ^^^^^^ ^^ ^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^ ^ ->a : (string | number)[] | null[] | undefined[] | {}[] +>a : undefined[] | null[] | {}[] | (string | number)[] > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >equalsShallow : ((this: readonly T[], other: readonly T[]) => boolean) | ((this: readonly T[], other: readonly T[]) => boolean) | ((this: readonly T[], other: readonly T[]) => boolean) | ((this: readonly T[], other: readonly T[]) => boolean) > : ^^ ^^ ^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^ ^^^^^^ ^^ ^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^ ^^^^^^ ^^ ^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^ ^^^^^^ ^^ ^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^ ^ ->b : (string | number)[] | null[] | undefined[] | {}[] +>b : undefined[] | null[] | {}[] | (string | number)[] > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/baselines/reference/booleanLiteralTypes1.types b/tests/baselines/reference/booleanLiteralTypes1.types index bc640f5e0c44b..99c240c32e075 100644 --- a/tests/baselines/reference/booleanLiteralTypes1.types +++ b/tests/baselines/reference/booleanLiteralTypes1.types @@ -264,7 +264,7 @@ function assertNever(x: never): never { } function f10(x: true | false) { ->f10 : (x: true | false) => "true" | "false" +>f10 : (x: true | false) => "false" | "true" > : ^ ^^ ^^^^^^^^^^^^^^^^^^^^^ >x : boolean > : ^^^^^^^ @@ -292,7 +292,7 @@ function f10(x: true | false) { } function f11(x: true | false) { ->f11 : (x: true | false) => "true" | "false" +>f11 : (x: true | false) => "false" | "true" > : ^ ^^ ^^^^^^^^^^^^^^^^^^^^^ >x : boolean > : ^^^^^^^ diff --git a/tests/baselines/reference/booleanLiteralTypes2.types b/tests/baselines/reference/booleanLiteralTypes2.types index 484597c1ebeda..0844693f9e690 100644 --- a/tests/baselines/reference/booleanLiteralTypes2.types +++ b/tests/baselines/reference/booleanLiteralTypes2.types @@ -264,7 +264,7 @@ function assertNever(x: never): never { } function f10(x: true | false) { ->f10 : (x: true | false) => "true" | "false" +>f10 : (x: true | false) => "false" | "true" > : ^ ^^ ^^^^^^^^^^^^^^^^^^^^^ >x : boolean > : ^^^^^^^ @@ -292,7 +292,7 @@ function f10(x: true | false) { } function f11(x: true | false) { ->f11 : (x: true | false) => "true" | "false" +>f11 : (x: true | false) => "false" | "true" > : ^ ^^ ^^^^^^^^^^^^^^^^^^^^^ >x : boolean > : ^^^^^^^ diff --git a/tests/baselines/reference/builtinIterator.errors.txt b/tests/baselines/reference/builtinIterator.errors.txt index c4fc043ee366e..4a3a7eb45e00d 100644 --- a/tests/baselines/reference/builtinIterator.errors.txt +++ b/tests/baselines/reference/builtinIterator.errors.txt @@ -20,7 +20,7 @@ builtinIterator.ts(60,3): error TS2416: Property 'next' in type 'BadIterator3' i Type '{ done: boolean; value: number; }' is not assignable to type 'IteratorYieldResult'. Types of property 'done' are incompatible. Type 'boolean' is not assignable to type 'false'. -builtinIterator.ts(70,29): error TS2345: Argument of type 'Generator' is not assignable to parameter of type 'Iterator | Iterable'. +builtinIterator.ts(70,29): error TS2345: Argument of type 'Generator' is not assignable to parameter of type 'Iterable | Iterator'. Type 'Generator' is not assignable to type 'Iterator'. Types of property 'next' are incompatible. Type '(...[value]: [] | [boolean]) => IteratorResult' is not assignable to type '(...[value]: [] | [undefined]) => IteratorResult'. @@ -29,7 +29,7 @@ builtinIterator.ts(70,29): error TS2345: Argument of type 'Generator' is not assignable to type 'Iterator | Iterable'. +builtinIterator.ts(73,35): error TS2322: Type 'Generator' is not assignable to type 'Iterable | Iterator'. Type 'Generator' is not assignable to type 'Iterator'. Types of property 'next' are incompatible. Type '(...[value]: [] | [boolean]) => IteratorResult' is not assignable to type '(...[value]: [] | [undefined]) => IteratorResult'. @@ -139,7 +139,7 @@ builtinIterator.ts(73,35): error TS2322: Type 'Generator; const iter1 = Iterator.from(g1); ~~ -!!! error TS2345: Argument of type 'Generator' is not assignable to parameter of type 'Iterator | Iterable'. +!!! error TS2345: Argument of type 'Generator' is not assignable to parameter of type 'Iterable | Iterator'. !!! error TS2345: Type 'Generator' is not assignable to type 'Iterator'. !!! error TS2345: Types of property 'next' are incompatible. !!! error TS2345: Type '(...[value]: [] | [boolean]) => IteratorResult' is not assignable to type '(...[value]: [] | [undefined]) => IteratorResult'. @@ -152,7 +152,7 @@ builtinIterator.ts(73,35): error TS2322: Type 'Generator; const iter3 = iter2.flatMap(() => g1); ~~ -!!! error TS2322: Type 'Generator' is not assignable to type 'Iterator | Iterable'. +!!! error TS2322: Type 'Generator' is not assignable to type 'Iterable | Iterator'. !!! error TS2322: Type 'Generator' is not assignable to type 'Iterator'. !!! error TS2322: Types of property 'next' are incompatible. !!! error TS2322: Type '(...[value]: [] | [boolean]) => IteratorResult' is not assignable to type '(...[value]: [] | [undefined]) => IteratorResult'. diff --git a/tests/baselines/reference/builtinIterator.types b/tests/baselines/reference/builtinIterator.types index 75d934cddae8c..ce8f70bc8040f 100644 --- a/tests/baselines/reference/builtinIterator.types +++ b/tests/baselines/reference/builtinIterator.types @@ -146,9 +146,9 @@ function* gen() { } const mappedGen = gen().map(x => x === 0 ? "zero" : "other"); ->mappedGen : IteratorObject<"zero" | "other", undefined, unknown> +>mappedGen : IteratorObject<"other" | "zero", undefined, unknown> > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->gen().map(x => x === 0 ? "zero" : "other") : IteratorObject<"zero" | "other", undefined, unknown> +>gen().map(x => x === 0 ? "zero" : "other") : IteratorObject<"other" | "zero", undefined, unknown> > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >gen().map : (callbackfn: (value: number, index: number) => U) => IteratorObject > : ^ ^^ ^^^ ^^^^^^^^^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -158,11 +158,11 @@ const mappedGen = gen().map(x => x === 0 ? "zero" : "other"); > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >map : (callbackfn: (value: number, index: number) => U) => IteratorObject > : ^ ^^ ^^^ ^^^^^^^^^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->x => x === 0 ? "zero" : "other" : (x: number) => "zero" | "other" +>x => x === 0 ? "zero" : "other" : (x: number) => "other" | "zero" > : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >x : number > : ^^^^^^ ->x === 0 ? "zero" : "other" : "zero" | "other" +>x === 0 ? "zero" : "other" : "other" | "zero" > : ^^^^^^^^^^^^^^^^ >x === 0 : boolean > : ^^^^^^^ @@ -176,9 +176,9 @@ const mappedGen = gen().map(x => x === 0 ? "zero" : "other"); > : ^^^^^^^ const mappedValues = [0, 1, 2].values().map(x => x === 0 ? "zero" : "other"); ->mappedValues : IteratorObject<"zero" | "other", undefined, unknown> +>mappedValues : IteratorObject<"other" | "zero", undefined, unknown> > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->[0, 1, 2].values().map(x => x === 0 ? "zero" : "other") : IteratorObject<"zero" | "other", undefined, unknown> +>[0, 1, 2].values().map(x => x === 0 ? "zero" : "other") : IteratorObject<"other" | "zero", undefined, unknown> > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >[0, 1, 2].values().map : (callbackfn: (value: number, index: number) => U) => IteratorObject > : ^ ^^ ^^^ ^^^^^^^^^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -198,11 +198,11 @@ const mappedValues = [0, 1, 2].values().map(x => x === 0 ? "zero" : "other"); > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^ >map : (callbackfn: (value: number, index: number) => U) => IteratorObject > : ^ ^^ ^^^ ^^^^^^^^^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->x => x === 0 ? "zero" : "other" : (x: number) => "zero" | "other" +>x => x === 0 ? "zero" : "other" : (x: number) => "other" | "zero" > : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >x : number > : ^^^^^^ ->x === 0 ? "zero" : "other" : "zero" | "other" +>x === 0 ? "zero" : "other" : "other" | "zero" > : ^^^^^^^^^^^^^^^^ >x === 0 : boolean > : ^^^^^^^ @@ -415,11 +415,11 @@ const iter3 = iter2.flatMap(() => g1); > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >iter2.flatMap(() => g1) : IteratorObject > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->iter2.flatMap : (callback: (value: string, index: number) => Iterator | Iterable) => IteratorObject +>iter2.flatMap : (callback: (value: string, index: number) => Iterable | Iterator) => IteratorObject > : ^ ^^ ^^^ ^^^^^^^^^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >iter2 : IteratorObject > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->flatMap : (callback: (value: string, index: number) => Iterator | Iterable) => IteratorObject +>flatMap : (callback: (value: string, index: number) => Iterable | Iterator) => IteratorObject > : ^ ^^ ^^^ ^^^^^^^^^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >() => g1 : () => Generator > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/baselines/reference/callSignatureWithoutReturnTypeAnnotationInference.types b/tests/baselines/reference/callSignatureWithoutReturnTypeAnnotationInference.types index 724f995738871..dabd139fc9f62 100644 --- a/tests/baselines/reference/callSignatureWithoutReturnTypeAnnotationInference.types +++ b/tests/baselines/reference/callSignatureWithoutReturnTypeAnnotationInference.types @@ -143,21 +143,21 @@ var r6 = foo6(1); > : ^ function foo7(x) { ->foo7 : (x: any) => "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function" +>foo7 : (x: any) => "bigint" | "boolean" | "function" | "number" | "object" | "string" | "symbol" | "undefined" > : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >x : any return typeof x; ->typeof x : "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function" +>typeof x : "bigint" | "boolean" | "function" | "number" | "object" | "string" | "symbol" | "undefined" > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >x : any } var r7 = foo7(1); ->r7 : "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function" +>r7 : "bigint" | "boolean" | "function" | "number" | "object" | "string" | "symbol" | "undefined" > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->foo7(1) : "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function" +>foo7(1) : "bigint" | "boolean" | "function" | "number" | "object" | "string" | "symbol" | "undefined" > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->foo7 : (x: any) => "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function" +>foo7 : (x: any) => "bigint" | "boolean" | "function" | "number" | "object" | "string" | "symbol" | "undefined" > : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >1 : 1 > : ^ diff --git a/tests/baselines/reference/callWithMissingVoid.types b/tests/baselines/reference/callWithMissingVoid.types index a506760c192a2..0896a1d51dd80 100644 --- a/tests/baselines/reference/callWithMissingVoid.types +++ b/tests/baselines/reference/callWithMissingVoid.types @@ -37,29 +37,29 @@ x.f() // no error because f expects void > : ^ ^^^^^^^^^^^^^^^^^^^^^^^ declare const xUnion: X; ->xUnion : X +>xUnion : X > : ^^^^^^^^^^^^^^^^ xUnion.f(42) // no error because f accepts number ->xUnion.f(42) : { a: number | void; } +>xUnion.f(42) : { a: void | number; } > : ^^^^^^^^^^^^^^^^^^^^^ ->xUnion.f : (t: number | void) => { a: number | void; } +>xUnion.f : (t: void | number) => { a: void | number; } > : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->xUnion : X +>xUnion : X > : ^^^^^^^^^^^^^^^^ ->f : (t: number | void) => { a: number | void; } +>f : (t: void | number) => { a: void | number; } > : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >42 : 42 > : ^^ xUnion.f() // no error because f accepts void ->xUnion.f() : { a: number | void; } +>xUnion.f() : { a: void | number; } > : ^^^^^^^^^^^^^^^^^^^^^ ->xUnion.f : (t: number | void) => { a: number | void; } +>xUnion.f : (t: void | number) => { a: void | number; } > : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->xUnion : X +>xUnion : X > : ^^^^^^^^^^^^^^^^ ->f : (t: number | void) => { a: number | void; } +>f : (t: void | number) => { a: void | number; } > : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ declare const xAny: X; @@ -137,17 +137,17 @@ new MyPromise(resolve => resolve()); // no error > : ^ ^^^^^^^^^^^ new MyPromise(resolve => resolve()); // no error ->new MyPromise(resolve => resolve()) : MyPromise +>new MyPromise(resolve => resolve()) : MyPromise > : ^^^^^^^^^^^^^^^^^^^^^^^^ >MyPromise : typeof MyPromise > : ^^^^^^^^^^^^^^^^ ->resolve => resolve() : (resolve: (value: number | void) => void) => void +>resolve => resolve() : (resolve: (value: void | number) => void) => void > : ^ ^^^ ^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^ ->resolve : (value: number | void) => void +>resolve : (value: void | number) => void > : ^ ^^^^^^^^^^^^^^^^^^^^ >resolve() : void > : ^^^^ ->resolve : (value: number | void) => void +>resolve : (value: void | number) => void > : ^ ^^^^^^^^^^^^^^^^^^^^ new MyPromise(resolve => resolve()); // error, `any` arguments cannot be omitted @@ -304,11 +304,11 @@ b(4); // not ok function c(x: number | void, y: void, z: void | string | number): void { >c : (x: number | void, y: void, z: void | string | number) => void > : ^ ^^ ^^ ^^ ^^ ^^ ^^^^^ ->x : number | void +>x : void | number > : ^^^^^^^^^^^^^ >y : void > : ^^^^ ->z : string | number | void +>z : void | string | number > : ^^^^^^^^^^^^^^^^^^^^^^ } @@ -469,9 +469,9 @@ call((x: number | void, y: number | void) => 42) // ok > : ^ ^^^^^^^^^ ^^ ^^ ^^^^^ ^^ ^^^^^ >(x: number | void, y: number | void) => 42 : (x: number | void, y: number | void) => number > : ^ ^^ ^^ ^^ ^^^^^^^^^^^ ->x : number | void +>x : void | number > : ^^^^^^^^^^^^^ ->y : number | void +>y : void | number > : ^^^^^^^^^^^^^ >42 : 42 > : ^^ @@ -483,9 +483,9 @@ call((x: number | void, y: number | void) => 42, 4) // ok > : ^ ^^^^^^^^^ ^^ ^^ ^^^^^ ^^ ^^^^^ >(x: number | void, y: number | void) => 42 : (x: number | void, y: number | void) => number > : ^ ^^ ^^ ^^ ^^^^^^^^^^^ ->x : number | void +>x : void | number > : ^^^^^^^^^^^^^ ->y : number | void +>y : void | number > : ^^^^^^^^^^^^^ >42 : 42 > : ^^ @@ -499,9 +499,9 @@ call((x: number | void, y: number | void) => 42, 4, 2) // ok > : ^ ^^^^^^^^^ ^^ ^^ ^^^^^ ^^ ^^^^^ >(x: number | void, y: number | void) => 42 : (x: number | void, y: number | void) => number > : ^ ^^ ^^ ^^ ^^^^^^^^^^^ ->x : number | void +>x : void | number > : ^^^^^^^^^^^^^ ->y : number | void +>y : void | number > : ^^^^^^^^^^^^^ >42 : 42 > : ^^ diff --git a/tests/baselines/reference/callWithSpread4.types b/tests/baselines/reference/callWithSpread4.types index 52a3a995a8d20..fb0661d59858b 100644 --- a/tests/baselines/reference/callWithSpread4.types +++ b/tests/baselines/reference/callWithSpread4.types @@ -38,15 +38,15 @@ declare const pli: { > : ^ (streams: ReadonlyArray): Promise; ->streams : readonly (R | W | RW)[] +>streams : readonly (R | RW | W)[] > : ^^^^^^^^^^^^^^^^^^^^^^^ (s1: R, s2: RW | W, ...streams: Array): Promise; >s1 : R > : ^ ->s2 : W | RW +>s2 : RW | W > : ^^^^^^ ->streams : (W | RW)[] +>streams : (RW | W)[] > : ^^^^^^^^^^ } diff --git a/tests/baselines/reference/callsOnComplexSignatures.types b/tests/baselines/reference/callsOnComplexSignatures.types index a9a9805eb5554..f388b127be5ec 100644 --- a/tests/baselines/reference/callsOnComplexSignatures.types +++ b/tests/baselines/reference/callsOnComplexSignatures.types @@ -18,7 +18,7 @@ function test1() { > : ^^^^^^^^^^ type stringType1 = "foo" | "bar"; ->stringType1 : "foo" | "bar" +>stringType1 : "bar" | "foo" > : ^^^^^^^^^^^^^ type stringType2 = "baz" | "bar"; @@ -27,9 +27,9 @@ function test1() { interface Temp1 { getValue(name: stringType1): number; ->getValue : (name: "foo" | "bar") => number +>getValue : (name: "bar" | "foo") => number > : ^ ^^^^^^^^^^^^^^^^^^^^ ->name : "foo" | "bar" +>name : "bar" | "foo" > : ^^^^^^^^^^^^^ } @@ -52,11 +52,11 @@ function test1() { > : ^^^^^^^^^^^^^^^ >t.getValue("bar") : string | number > : ^^^^^^^^^^^^^^^ ->t.getValue : ((name: "foo" | "bar") => number) | ((name: "bar" | "baz") => string) +>t.getValue : ((name: "bar" | "foo") => number) | ((name: "bar" | "baz") => string) > : ^^ ^^^^^^^^^^^^^^^^^^^^ ^^^^^^ ^^^^^^^^^^^^^^^^^^^^ ^ >t : Temp1 | Temp2 > : ^^^^^^^^^^^^^ ->getValue : ((name: "foo" | "bar") => number) | ((name: "bar" | "baz") => string) +>getValue : ((name: "bar" | "foo") => number) | ((name: "bar" | "baz") => string) > : ^^ ^^^^^^^^^^^^^^^^^^^^ ^^^^^^ ^^^^^^^^^^^^^^^^^^^^ ^ >"bar" : "bar" > : ^^^^^ @@ -122,7 +122,7 @@ function test2() { > : ^ ^^ ^^^^^^^^^^^ >(type: "foo" | "bar") => messages[type]({ a: "A", b: 0 }) : (type: "foo" | "bar") => string > : ^ ^^ ^^^^^^^^^^^ ->type : "foo" | "bar" +>type : "bar" | "foo" > : ^^^^^^^^^^^^^ messages[type]({ a: "A", b: 0 }); @@ -132,7 +132,7 @@ function test2() { > : ^^ ^^ ^^^^^ ^^^^^^ ^^ ^^^^^ ^ >messages : Messages > : ^^^^^^^^ ->type : "foo" | "bar" +>type : "bar" | "foo" > : ^^^^^^^^^^^^^ >{ a: "A", b: 0 } : { a: string; b: number; } > : ^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/baselines/reference/castExpressionParentheses.types b/tests/baselines/reference/castExpressionParentheses.types index 71e34b3dbbd5c..6abba3993d671 100644 --- a/tests/baselines/reference/castExpressionParentheses.types +++ b/tests/baselines/reference/castExpressionParentheses.types @@ -230,7 +230,7 @@ declare var A; >(typeof A) : any > : ^^^ >typeof A : any ->typeof A : "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function" +>typeof A : "bigint" | "boolean" | "function" | "number" | "object" | "string" | "symbol" | "undefined" > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >A : any >x : any diff --git a/tests/baselines/reference/castOfAwait.types b/tests/baselines/reference/castOfAwait.types index 0d7ac0c3956d8..777563ad043e0 100644 --- a/tests/baselines/reference/castOfAwait.types +++ b/tests/baselines/reference/castOfAwait.types @@ -14,7 +14,7 @@ async function f() { > : ^ typeof await 0; ->typeof await 0 : "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function" +>typeof await 0 : "bigint" | "boolean" | "function" | "number" | "object" | "string" | "symbol" | "undefined" > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >await 0 : 0 > : ^ @@ -36,7 +36,7 @@ async function f() { > : ^^^^^^^^^ > typeof void await 0 : string > : ^^^^^^ ->typeof void await 0 : "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function" +>typeof void await 0 : "bigint" | "boolean" | "function" | "number" | "object" | "string" | "symbol" | "undefined" > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > void await 0 : number > : ^^^^^^ diff --git a/tests/baselines/reference/checkJsdocReturnTag2.types b/tests/baselines/reference/checkJsdocReturnTag2.types index eb45cf3aad71b..e821b70179113 100644 --- a/tests/baselines/reference/checkJsdocReturnTag2.types +++ b/tests/baselines/reference/checkJsdocReturnTag2.types @@ -22,7 +22,7 @@ function f1() { > : ^^^^^^ return 5 || true; ->5 || true : true | 5 +>5 || true : 5 | true > : ^^^^^^^^ >5 : 5 > : ^ diff --git a/tests/baselines/reference/checkJsdocTypeTag5.types b/tests/baselines/reference/checkJsdocTypeTag5.types index e7500bc7c59a0..712be2605e9be 100644 --- a/tests/baselines/reference/checkJsdocTypeTag5.types +++ b/tests/baselines/reference/checkJsdocTypeTag5.types @@ -70,7 +70,7 @@ var k = function (x) { return x } function blargle(s) { >blargle : (x: "hi" | "bye") => 0 | 1 | 2 > : ^ ^^ ^^^^^ ->s : "hi" | "bye" +>s : "bye" | "hi" > : ^^^^^^^^^^^^ return 0; @@ -103,7 +103,7 @@ function monaLisa(sb) { > : ^^^^^ >typeof sb === 'string' : boolean > : ^^^^^^^ ->typeof sb : "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function" +>typeof sb : "bigint" | "boolean" | "function" | "number" | "object" | "string" | "symbol" | "undefined" > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >sb : any > : ^^^ diff --git a/tests/baselines/reference/checkJsxChildrenProperty14.types b/tests/baselines/reference/checkJsxChildrenProperty14.types index 462991d4777c3..6ecdf6321e899 100644 --- a/tests/baselines/reference/checkJsxChildrenProperty14.types +++ b/tests/baselines/reference/checkJsxChildrenProperty14.types @@ -15,7 +15,7 @@ interface Prop { > : ^^^^^^ children: JSX.Element | JSX.Element[]; ->children : JSX.Element | JSX.Element[] +>children : JSX.Element[] | JSX.Element > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^ >JSX : any > : ^^^ diff --git a/tests/baselines/reference/checkJsxChildrenProperty6.types b/tests/baselines/reference/checkJsxChildrenProperty6.types index ce5c43d4bdc95..53cd3790a9bf8 100644 --- a/tests/baselines/reference/checkJsxChildrenProperty6.types +++ b/tests/baselines/reference/checkJsxChildrenProperty6.types @@ -15,7 +15,7 @@ interface Prop { > : ^^^^^^ children: JSX.Element | JSX.Element[]; ->children : JSX.Element | JSX.Element[] +>children : JSX.Element[] | JSX.Element > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^ >JSX : any > : ^^^ diff --git a/tests/baselines/reference/checkJsxChildrenProperty7.errors.txt b/tests/baselines/reference/checkJsxChildrenProperty7.errors.txt index c593701198647..f7cb8500cbbea 100644 --- a/tests/baselines/reference/checkJsxChildrenProperty7.errors.txt +++ b/tests/baselines/reference/checkJsxChildrenProperty7.errors.txt @@ -1,6 +1,6 @@ -file.tsx(24,40): error TS2747: 'Comp' components don't accept text as child elements. Text in JSX has the type 'string', but the expected type of 'children' is 'Element | Element[]'. -file.tsx(26,22): error TS2747: 'Comp' components don't accept text as child elements. Text in JSX has the type 'string', but the expected type of 'children' is 'Element | Element[]'. -file.tsx(27,30): error TS2747: 'Comp' components don't accept text as child elements. Text in JSX has the type 'string', but the expected type of 'children' is 'Element | Element[]'. +file.tsx(24,40): error TS2747: 'Comp' components don't accept text as child elements. Text in JSX has the type 'string', but the expected type of 'children' is 'Element[] | Element'. +file.tsx(26,22): error TS2747: 'Comp' components don't accept text as child elements. Text in JSX has the type 'string', but the expected type of 'children' is 'Element[] | Element'. +file.tsx(27,30): error TS2747: 'Comp' components don't accept text as child elements. Text in JSX has the type 'string', but the expected type of 'children' is 'Element[] | Element'. ==== file.tsx (3 errors) ==== @@ -29,12 +29,12 @@ file.tsx(27,30): error TS2747: 'Comp' components don't accept text as child elem // Error: whitespaces matters let k1 =