From 185d2cbb330cf25d2aca729ecd74bebae754260d Mon Sep 17 00:00:00 2001 From: Jake Bailey <5341706+jakebailey@users.noreply.github.com> Date: Mon, 6 Oct 2025 14:59:39 -0700 Subject: [PATCH 1/3] tsgo compat changes --- src/compiler/checker.ts | 413 ++++++++++++++++++++++++++++++++++++- src/compiler/core.ts | 10 +- src/compiler/corePublic.ts | 5 + src/compiler/types.ts | 73 ++++--- 4 files changed, 455 insertions(+), 46 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 48bc0da113816..3e52559578a22 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -81,6 +81,7 @@ import { classOrConstructorParameterIsDecorated, ClassStaticBlockDeclaration, clear, + compareComparableValues, compareDiagnostics, comparePaths, compareValues, @@ -427,6 +428,7 @@ import { Identifier, identifierToKeywordKind, IdentifierTypePredicate, + identity, idText, IfStatement, ImportAttribute, @@ -1078,6 +1080,7 @@ import { tryGetModuleSpecifierFromDeclaration, tryGetPropertyAccessOrIdentifierToString, TryStatement, + TSGO_COMPAT, TupleType, TupleTypeNode, TupleTypeReference, @@ -1499,6 +1502,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(); @@ -5533,7 +5538,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { } function createTypeofType() { - return getUnionType(arrayFrom(typeofNEFacts.keys(), getStringLiteralType)); + return getUnionType(map(TSGO_COMPAT ? [...typeofNEFacts.keys()].sort() : arrayFrom(typeofNEFacts.keys()), getStringLiteralType)); } function createTypeParameter(symbol?: Symbol) { @@ -5559,6 +5564,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { (result || (result = [])).push(symbol); } }); + sortSymbolsIfTSGoCompat(result); return result || emptyArray; } @@ -17986,11 +17992,11 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { } function containsType(types: readonly Type[], type: Type): boolean { - return binarySearch(types, type, getTypeId, compareValues) >= 0; + return TSGO_COMPAT ? binarySearch(types, type, identity, compareTypes) >= 0 : binarySearch(types, type, getTypeId, compareValues) >= 0; } function insertType(types: Type[], type: Type): boolean { - const index = binarySearch(types, type, getTypeId, compareValues); + const index = TSGO_COMPAT ? binarySearch(types, type, identity, compareTypes) : binarySearch(types, type, getTypeId, compareValues); if (index < 0) { types.splice(~index, 0, type); return true; @@ -18012,7 +18018,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { } else { const len = typeSet.length; - const index = len && type.id > typeSet[len - 1].id ? ~len : binarySearch(typeSet, type, getTypeId, compareValues); + const index = TSGO_COMPAT ? binarySearch(typeSet, type, identity, compareTypes) : (len && type.id > typeSet[len - 1].id ? ~len : binarySearch(typeSet, type, getTypeId, compareValues)); if (index < 0) { typeSet.splice(~index, 0, type); } @@ -35170,7 +35176,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { // So the table *contains* `x` but `x` isn't actually in scope. // However, resolveNameHelper will continue and call this callback again, so we'll eventually get a correct suggestion. if (symbol) return symbol; - let candidates: Symbol[]; + let candidates = arrayFrom(symbols.values()); if (symbols === globals) { const primitives = mapDefined( ["string", "number", "boolean", "object", "bigint", "symbol"], @@ -35178,11 +35184,9 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { ? createSymbol(SymbolFlags.TypeAlias, s as __String) as Symbol : undefined, ); - candidates = primitives.concat(arrayFrom(symbols.values())); - } - else { - candidates = arrayFrom(symbols.values()); + candidates = concatenate(primitives, candidates); } + sortSymbolsIfTSGoCompat(candidates); return getSpellingSuggestionForName(unescapeLeadingUnderscores(name), candidates, meaning); } function getSuggestedSymbolForNonexistentSymbol(location: Node | undefined, outerName: __String, meaning: SymbolFlags): Symbol | undefined { @@ -35192,7 +35196,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { } function getSuggestedSymbolForNonexistentModule(name: Identifier, targetModule: Symbol): Symbol | undefined { - return targetModule.exports && getSpellingSuggestionForName(idText(name), getExportsOfModuleAsArray(targetModule), SymbolFlags.ModuleMember); + return targetModule.exports && getSpellingSuggestionForName(idText(name), sortSymbolsIfTSGoCompat(getExportsOfModuleAsArray(targetModule)), SymbolFlags.ModuleMember); } function getSuggestionForNonexistentIndexSignature(objectType: Type, expr: ElementAccessExpression, keyedType: Type): string | undefined { @@ -53622,6 +53626,395 @@ 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 sortSymbolsIfTSGoCompat(array: Symbol[]): Symbol[]; + function sortSymbolsIfTSGoCompat(array: Symbol[] | undefined): Symbol[] | undefined; + function sortSymbolsIfTSGoCompat(array: Symbol[] | undefined): Symbol[] | undefined { + if (TSGO_COMPAT && array) { + return array.sort(compareSymbols); // eslint-disable-line local/no-array-mutating-method-expressions + } + return array; + } + + 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 s1 = getSourceFileOfNode(n1); + const s2 = getSourceFileOfNode(n2); + if (s1 !== s2) { + const f1 = fileIndexMap.get(s1)!; + const f2 = fileIndexMap.get(s2)!; + // 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 47f6ce95df557..2085548836e8d 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/corePublic.ts b/src/compiler/corePublic.ts index aef4d86b79a35..eeef5e0d23b5f 100644 --- a/src/compiler/corePublic.ts +++ b/src/compiler/corePublic.ts @@ -5,6 +5,11 @@ export const versionMajorMinor = "6.0"; /** The version of the TypeScript compiler release */ export const version: string = `${versionMajorMinor}.0-dev`; +const tsgoCompatEnv = typeof process !== "undefined" && process.env ? process.env.TSGO_COMPAT : undefined; + +/** @internal */ +export const TSGO_COMPAT: boolean = tsgoCompatEnv ? tsgoCompatEnv === "true" : true; + /** * Type of objects whose values are all of the same type. * The `in` and `for-in` operators can *not* be safely used, diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 4835b4bdf2efa..e796729534ea3 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -6319,42 +6319,49 @@ export interface SerializedTypeEntry { trackedSymbols: readonly TrackedSymbol[] | undefined; } +// Note that for types of different kinds, the numeric values of TypeFlags determine the order +// computed by the CompareTypes function and therefore the order of constituent types in union types. +// Since union type processing often bails out early when a result is known, it is important to order +// TypeFlags in increasing order of potential type complexity. In particular, indexed access and +// conditional types should sort last as those types are potentially recursive and possibly infinite. + // dprint-ignore 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, - Never = 1 << 17, // Never type - TypeParameter = 1 << 18, // Type parameter - Object = 1 << 19, // Object type - Union = 1 << 20, // Union (T | U) - Intersection = 1 << 21, // Intersection (T & U) - Index = 1 << 22, // keyof T - IndexedAccess = 1 << 23, // T[K] - Conditional = 1 << 24, // T extends U ? X : Y - Substitution = 1 << 25, // Type parameter substitution - NonPrimitive = 1 << 26, // intrinsic object type - TemplateLiteral = 1 << 27, // Template literal type - StringMapping = 1 << 28, // Uppercase/Lowercase type + 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, + BigIntLiteral = 1 << 12, + BooleanLiteral = 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 (must be right after EnumLiteral, see getSortOrderFlags) + NonPrimitive = 1 << 17, // intrinsic object type + Never = 1 << 18, // Never type + TypeParameter = 1 << 19, // Type parameter + Object = 1 << 20, // Object type + Index = 1 << 21, // keyof T + TemplateLiteral = 1 << 22, // Template literal type + StringMapping = 1 << 23, // Uppercase/Lowercase type + Substitution = 1 << 24, // Type parameter substitution + IndexedAccess = 1 << 25, // T[K] + Conditional = 1 << 26, // T extends U ? X : Y + Union = 1 << 27, // Union (T | U) + Intersection = 1 << 28, // Intersection (T & U) /** @internal */ Reserved1 = 1 << 29, // Used by union/intersection type construction /** @internal */ Reserved2 = 1 << 30, // Used by union/intersection type construction - + /** @internal */ + Reserved3 = 1 << 31, /** @internal */ AnyOrUnknown = Any | Unknown, /** @internal */ @@ -6538,14 +6545,16 @@ 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 + + // 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 a44a4341241f2a9d5872682aa38de1673d38a677 Mon Sep 17 00:00:00 2001 From: Jake Bailey <5341706+jakebailey@users.noreply.github.com> Date: Mon, 6 Oct 2025 15:09:44 -0700 Subject: [PATCH 2/3] Accept baselines --- .../reference/TypeGuardWithArrayUnion.types | 4 +- .../reference/TypeGuardWithEnumUnion.types | 22 +- .../ambientExportDefaultErrors.types | 4 +- .../reference/anonymousClassExpression1.types | 2 +- tests/baselines/reference/api/typescript.d.ts | 94 +-- .../arityAndOrderCompatibility01.errors.txt | 20 +- .../reference/arrayAssignmentTest1.errors.txt | 12 +- .../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 +- .../reference/arrowFunctionExpressions.types | 4 +- ...nfuseParenthesizedObjectForArrowHead.types | 12 +- .../reference/assertionTypePredicates1.types | 28 +- .../assertionsAndNonReturningFunctions.types | 8 +- ...gnmentCompatWithCallSignatures3.errors.txt | 4 +- ...tCompatWithConstructSignatures3.errors.txt | 4 +- ...entCompatWithDiscriminatedUnion.errors.txt | 12 +- ...gnmentCompatWithDiscriminatedUnion.symbols | 4 +- ...signmentCompatWithDiscriminatedUnion.types | 16 +- ...ignmentCompatWithNumericIndexer.errors.txt | 8 +- ...gnmentCompatWithNumericIndexer2.errors.txt | 8 +- ...signmentCompatWithStringIndexer.errors.txt | 12 +- ...ignmentCompatWithStringIndexer2.errors.txt | 12 +- .../assignmentToAnyArrayRestParameters.types | 4 +- ...syncFunctionContextuallyTypedReturns.types | 14 +- .../asyncFunctionTempVariableScoping.types | 2 +- .../reference/awaitUnionPromise.types | 6 +- .../baselines/reference/awaitUnion_es5.types | 4 +- .../baselines/reference/awaitUnion_es6.types | 4 +- .../reference/awaitedTypeNoLib.errors.txt | 4 +- .../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 +- ...ConstrainedToOtherTypeParameter.errors.txt | 4 +- .../reference/checkJsdocReturnTag2.types | 2 +- .../reference/checkJsdocTypeTag5.types | 4 +- .../checkJsxChildrenProperty14.types | 2 +- .../checkJsxChildrenProperty15.errors.txt | 8 +- .../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 +- .../conditionalOperatorWithIdenticalBCT.types | 2 +- ...asedContextualTypeReturnTypeWidening.types | 16 +- .../reference/conditionalTypes1.types | 14 +- .../reference/conditionalTypes2.errors.txt | 16 +- .../reference/conditionalTypes2.types | 2 +- tests/baselines/reference/constAssertions.js | 14 +- .../baselines/reference/constAssertions.types | 44 +- 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 +- ...StringLiteralsInJsxAttributes02.errors.txt | 24 +- ...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 | 4 +- ...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 +- ...nferredUndefinedPropFromFunctionInArray.js | 2 +- ...rredUndefinedPropFromFunctionInArray.types | 2 +- ...eWithNonEntityNameExpressionHeritage.types | 4 +- ...tionEmitPartialReuseComputedProperty.types | 4 +- ...ationEmitStringEnumUsedInNonlocalSpread.js | 2 +- ...onEmitStringEnumUsedInNonlocalSpread.types | 8 +- ...itUsingAlternativeContainingModules1.types | 12 +- ...itUsingAlternativeContainingModules2.types | 16 +- .../baselines/reference/deepComparisons.types | 2 +- .../deeplyNestedConditionalTypes.types | 2 +- .../reference/deeplyNestedMappedTypes.types | 8 +- .../reference/deferredLookupTypeResolution.js | 19 +- .../deferredLookupTypeResolution.types | 6 +- .../definiteAssignmentAssertions.types | 2 +- .../dependentDestructuredVariables.js | 2 +- .../dependentDestructuredVariables.types | 44 +- ...tructuredVariablesFromNestedPatterns.types | 8 +- ...ivedUninitializedPropertyDeclaration.types | 2 +- .../destructuringAssignmentWithDefault.types | 14 +- .../reference/destructuringControlFlow.types | 30 +- ...ParameterDeclaration10(strict=false).types | 4 +- ...gParameterDeclaration10(strict=true).types | 4 +- ...estructuringParameterDeclaration1ES5.types | 2 +- ...ringParameterDeclaration1ES5iterable.types | 2 +- ...estructuringParameterDeclaration1ES6.types | 2 +- ...tructuringParameterDeclaration2.errors.txt | 8 +- .../destructuringParameterDeclaration2.types | 2 +- ...ngParameterDeclaration9(strict=true).types | 2 +- .../reference/destructuringSpread.errors.txt | 4 +- .../reference/destructuringSpread.types | 8 +- ...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 +- ...y4(exactoptionalpropertytypes=false).types | 14 +- ...ty4(exactoptionalpropertytypes=true).types | 14 +- .../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 +- .../dynamicImportDefer(module=nodenext).types | 12 +- .../baselines/reference/elidedJSImport1.types | 2 +- .../reference/emitArrowFunctionES6.types | 4 +- .../emitClassExpressionInDeclarationFile.js | 4 +- ...emitClassExpressionInDeclarationFile.types | 12 +- ...mitClassExpressionInDeclarationFile2.types | 12 +- ...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 +- .../reference/esModuleIntersectionCrash.types | 12 +- ...yCheckWithMultipleDiscriminants.errors.txt | 8 +- .../exhaustiveSwitchStatements1.symbols | 24 +- .../exhaustiveSwitchStatements1.types | 24 +- .../expandoFunctionContextualTypes.types | 2 +- .../expandoFunctionNestedAssigments.js | 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 | 10 +- .../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 | 24 +- ...rfaceExtendingClassWithPrivates.errors.txt | 4 +- ...aceExtendingClassWithProtecteds.errors.txt | 4 +- .../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 +- .../reference/incompatibleTypes.types | 2 +- 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 +- ...eOptionalPropertiesToIndexSignatures.types | 6 +- ...nferredFunctionReturnTypeIsEmptyType.types | 2 +- .../reference/instanceOfAssignability.types | 16 +- ...fOperatorWithRHSHasSymbolHasInstance.types | 166 +++--- .../instantiateContextualTypes.types | 8 +- .../instantiationExpressionErrors.types | 8 +- .../reference/instantiationExpressions.types | 16 +- .../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 +- .../invalidReturnStatements.errors.txt | 4 +- .../isolatedDeclarationErrorsObjects.types | 4 +- .../isomorphicMappedTypeInference.js | 4 +- .../isomorphicMappedTypeInference.types | 26 +- .../jsContainerMergeTsDeclaration3.errors.txt | 4 +- .../reference/jsDeclarationsClassAccessor.js | 4 +- .../jsDeclarationsFunctionLikeClasses2.types | 32 +- ...onsImportAliasExposedWithinNamespace.types | 2 +- ...ImportAliasExposedWithinNamespaceCjs.types | 2 +- .../baselines/reference/jsDeclarationsJson.js | 2 +- .../reference/jsDeclarationsJson.types | 14 +- ...sDeclarationsNonIdentifierInferredNames.js | 4 +- ...clarationsNonIdentifierInferredNames.types | 4 +- .../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/jsdocTypeTagCast.errors.txt | 4 +- .../reference/jsxChildrenArrayWrongType.types | 2 +- ...drenIndividualErrorElaborations.errors.txt | 8 +- ...xChildrenIndividualErrorElaborations.types | 2 +- .../reference/jsxChildrenWrongType.types | 2 +- ...omplexSignatureHasApplicabilityError.types | 10 +- .../reference/keyofAndIndexedAccess.types | 24 +- .../reference/keyofAndIndexedAccess2.types | 10 +- .../keyofAndIndexedAccessErrors.types | 6 +- .../reference/keyofDoesntContainSymbols.types | 2 +- .../reference/keyofIntersection.types | 4 +- .../keywordExpressionInternalComments.types | 2 +- .../lateBoundAssignmentCandidateJS1.js | 10 +- .../lateBoundClassMemberAssignmentJS.js | 2 +- .../lateBoundClassMemberAssignmentJS2.js | 2 +- .../lateBoundClassMemberAssignmentJS3.js | 2 +- ...ExportsSpecifierGenerationConditions.types | 12 +- ...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 +- .../mappedTypeIndexedAccessConstraint.types | 20 +- .../mappedTypeNotMistakenlyHomomorphic.types | 2 +- .../reference/mappedTypeProperties.types | 10 +- .../mappedTypeRecursiveInference.errors.txt | 40 +- .../mappedTypeRecursiveInference.types | 20 +- ...ithAsClauseAndLateBoundProperty.errors.txt | 4 +- ...TypeWithAsClauseAndLateBoundProperty.types | 12 +- ...edTypeWithAsClauseAndLateBoundProperty2.js | 12 +- ...ypeWithAsClauseAndLateBoundProperty2.types | 16 +- tests/baselines/reference/mappedTypes2.types | 8 +- tests/baselines/reference/mappedTypes4.types | 4 +- .../reference/metadataOfStringLiteral.types | 2 +- .../baselines/reference/metadataOfUnion.types | 4 +- ...inAbstractClassesReturnTypeInference.types | 12 +- .../reference/mixinClassesAnnotated.types | 2 +- .../reference/mixinClassesAnonymous.types | 32 +- .../mixinIntersectionIsValidbaseType.types | 68 +-- .../reference/moduleExportAlias5.types | 14 +- .../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 +- .../noCircularitySelfReferentialGetter1.types | 2 +- .../noCircularitySelfReferentialGetter2.types | 22 +- .../reference/noImplicitAnyForIn.types | 2 +- ...icitAnyUnionNormalizedObjectLiteral1.types | 2 +- ...oInferUnionExcessPropertyCheck1.errors.txt | 12 +- .../noInferUnionExcessPropertyCheck1.types | 4 +- .../noIterationTypeErrorsInCFA.types | 6 +- .../reference/noUncheckedIndexedAccess.types | 2 +- ...SynchronousCallErrors(module=node16).types | 12 +- ...SynchronousCallErrors(module=node18).types | 12 +- ...SynchronousCallErrors(module=node20).types | 12 +- ...nchronousCallErrors(module=nodenext).types | 12 +- ...ImportWithPackageExports(module=node18).js | 12 +- ...ortWithPackageExports(module=node18).types | 64 +-- ...ImportWithPackageExports(module=node20).js | 12 +- ...ortWithPackageExports(module=node20).types | 64 +-- ...portWithPackageExports(module=nodenext).js | 12 +- ...tWithPackageExports(module=nodenext).types | 64 +-- ...ModulesResolveJsonModule(module=node16).js | 6 +- ...ulesResolveJsonModule(module=node16).types | 8 +- ...ModulesResolveJsonModule(module=node18).js | 6 +- ...ulesResolveJsonModule(module=node18).types | 8 +- ...ModulesResolveJsonModule(module=node20).js | 6 +- ...ulesResolveJsonModule(module=node20).types | 8 +- ...dulesResolveJsonModule(module=nodenext).js | 6 +- ...esResolveJsonModule(module=nodenext).types | 8 +- ...SynchronousCallErrors(module=node16).types | 12 +- ...SynchronousCallErrors(module=node18).types | 12 +- ...SynchronousCallErrors(module=node20).types | 12 +- ...nchronousCallErrors(module=nodenext).types | 12 +- .../reference/nonNullReferenceMatching.types | 36 +- .../reference/nonNullableTypes1.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 +-- .../reference/objectLiteralErrors.types | 4 +- .../objectLiteralExcessProperties.errors.txt | 8 +- .../objectLiteralExcessProperties.types | 10 +- .../objectLiteralFreshnessWithSpread.types | 2 +- .../objectLiteralNormalization.errors.txt | 8 +- .../reference/objectLiteralNormalization.js | 36 +- .../objectLiteralNormalization.types | 82 +-- ...bjectLiteralsAgainstUnionsOfArrays01.types | 2 +- .../baselines/reference/objectRestForOf.types | 28 +- tests/baselines/reference/objectSpread.types | 44 +- .../objectSpreadIndexSignature.errors.txt | 8 +- .../objectSpreadIndexSignature.types | 24 +- .../reference/objectSpreadNegative.errors.txt | 8 +- .../reference/objectSpreadNegative.types | 22 +- .../objectSpreadRepeatedComplexity.types | 4 +- .../objectSpreadRepeatedNullCheckPerf.types | 2 +- .../objectSpreadSetonlyAccessor.types | 2 +- .../reference/objectSpreadStrictNull.types | 2 +- .../observableInferenceCanBeMade.types | 2 +- ...tantiationExpression1(target=es2019).types | 4 +- ...tantiationExpression1(target=es2020).types | 4 +- .../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 +- ...enthesizedJSDocCastAtReturnStatement.types | 2 +- ...nthesizedJSDocCastDoesNotNarrow.errors.txt | 4 +- .../parenthesizedJSDocCastDoesNotNarrow.types | 2 +- .../reference/parserArgumentList1.types | 2 +- tests/baselines/reference/parserharness.types | 26 +- .../partiallyDiscriminantedUnions.symbols | 4 +- .../partiallyDiscriminantedUnions.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/quickinfoVerbosity2.baseline | 64 +-- .../quickinfoVerbosityClass1.baseline | 210 +++---- .../quickinfoVerbosityIndexType.baseline | 6 +- ...ickinfoVerbosityIndexedAccessType.baseline | 6 +- .../quickinfoVerbosityInterface1.baseline | 538 +++++++++--------- .../quickinfoVerbosityTuple.baseline | 204 +++---- .../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 +- .../restElementWithNumberPropertyName.types | 4 +- .../reference/restInvalidArgumentType.types | 4 +- .../restParameterWithBindingPattern3.types | 4 +- .../restPropertyWithBindingPattern.types | 8 +- ...returnConditionalExpressionJSDocCast.types | 2 +- .../reference/returnTagTypeGuard.types | 4 +- ...appedTypeIntersectionConstraint.errors.txt | 16 +- tests/baselines/reference/sharedMemory.types | 4 +- .../spreadBooleanRespectsFreshness.types | 4 +- ...xpressionContextualTypeWithNamespace.types | 32 +- .../spreadIdenticalTypesRemoved.types | 16 +- .../reference/spreadIntersection.types | 4 +- .../reference/spreadInvalidArgumentType.types | 8 +- .../reference/spreadNonPrimitive.types | 2 +- .../reference/spreadObjectNoCircular1.types | 6 +- ...ectLiteralAssignableToIndexSignature.types | 12 +- .../spreadOverwritesPropertyStrict.types | 28 +- tests/baselines/reference/spreadUnion.types | 6 +- .../reference/spreadUnion2.errors.txt | 24 +- tests/baselines/reference/spreadUnion2.types | 46 +- .../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 +- .../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 +- ...ateStringsTypeArgumentInference.errors.txt | 4 +- ...TemplateStringsTypeArgumentInference.types | 6 +- ...StringsTypeArgumentInferenceES6.errors.txt | 4 +- ...plateStringsTypeArgumentInferenceES6.types | 6 +- ...edTemplateStringsWithCurriedFunction.types | 4 +- .../tailRecursiveConditionalTypes.types | 2 +- .../reference/templateLiteralTypes1.types | 12 +- .../templateLiteralTypes2.errors.txt | 8 +- .../reference/templateLiteralTypes2.types | 32 +- .../reference/templateLiteralTypes3.types | 12 +- .../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 +- .../declarationMapsEnableMapping_NoInline.js | 425 +------------- ...rationMapsEnableMapping_NoInlineSources.js | 425 +------------- ...clarationMapsGeneratedMapsEnableMapping.js | 425 +------------- ...larationMapsGeneratedMapsEnableMapping2.js | 425 +------------- ...larationMapsGeneratedMapsEnableMapping3.js | 440 +------------- .../fourslashServer/quickinfoWrongComment.js | 2 +- .../tsxDiscriminantPropertyInference.types | 2 +- ...tsxSpreadAttributesResolution12.errors.txt | 4 +- ...tsxSpreadAttributesResolution14.errors.txt | 4 +- .../tsxSpreadAttributesResolution2.errors.txt | 4 +- ...elessFunctionComponentOverload4.errors.txt | 24 +- ...elessFunctionComponentOverload5.errors.txt | 12 +- ...xStatelessFunctionComponentOverload5.types | 8 +- ...xStatelessFunctionComponentOverload6.types | 8 +- .../reference/tsxUnionTypeComponent1.types | 6 +- .../reference/typeArgInference2.types | 4 +- .../typeArgumentInference.errors.txt | 4 +- .../reference/typeArgumentInference.types | 6 +- ...entInferenceConstructSignatures.errors.txt | 4 +- ...ArgumentInferenceConstructSignatures.types | 6 +- ...rgumentInferenceWithConstraints.errors.txt | 4 +- ...typeArgumentInferenceWithConstraints.types | 6 +- ...ypeArgumentsWithStringLiteralTypes01.types | 2 +- .../reference/typeAssertions.errors.txt | 4 +- .../reference/typeFromPropertyAssignment29.js | 2 +- .../typeFromPropertyAssignment29.types | 28 +- .../reference/typeFromPrototypeAssignment4.js | 6 +- .../typeGuardConstructorClassAndNumber.types | 2 +- ...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 +- .../typeParameterConstModifiers.types | 3 + .../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 +- .../reference/typedefCrossModule2.types | 26 +- .../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 +- .../unionExcessPropsWithPartialMember.types | 8 +- .../reference/unionOfArraysFilterCall.symbols | 16 +- .../reference/unionOfArraysFilterCall.types | 110 ++-- .../reference/unionOfClassCalls.types | 24 +- .../reference/unionOfEnumInference.types | 4 +- ...nionOfFunctionAndSignatureIsCallable.types | 2 +- .../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 +- .../unusedParametersWithUnderscore.types | 2 +- ...BeforeDeclaration_propertyAssignment.types | 4 +- .../useUnknownInCatchVariables01.types | 4 +- tests/baselines/reference/variadicTuples1.js | 20 +- .../baselines/reference/variadicTuples1.types | 4 +- .../reference/voidIsInitialized.types | 4 +- .../weakTypeAndPrimitiveNarrowing.types | 8 +- .../reference/weakTypesAndLiterals01.js | 19 +- .../reference/weakTypesAndLiterals01.types | 14 +- 769 files changed, 4878 insertions(+), 7188 deletions(-) create mode 100644 tests/baselines/reference/coAndContraVariantInferences5.errors.txt 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 ec624a12be559..441a242af16e3 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -6591,53 +6591,53 @@ 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, - Never = 131072, - TypeParameter = 262144, - Object = 524288, - Union = 1048576, - Intersection = 2097152, - Index = 4194304, - IndexedAccess = 8388608, - Conditional = 16777216, - Substitution = 33554432, - 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, - UnionOrIntersection = 3145728, - StructuredType = 3670016, - TypeVariable = 8650752, - InstantiableNonPrimitive = 58982400, - InstantiablePrimitive = 406847488, - Instantiable = 465829888, - StructuredOrInstantiable = 469499904, - Narrowable = 536624127, + Undefined = 4, + Null = 8, + Void = 16, + String = 32, + Number = 64, + BigInt = 128, + Boolean = 256, + ESSymbol = 512, + StringLiteral = 1024, + NumberLiteral = 2048, + BigIntLiteral = 4096, + BooleanLiteral = 8192, + UniqueESSymbol = 16384, + EnumLiteral = 32768, + Enum = 65536, + NonPrimitive = 131072, + Never = 262144, + TypeParameter = 524288, + Object = 1048576, + Index = 2097152, + TemplateLiteral = 4194304, + StringMapping = 8388608, + Substitution = 16777216, + IndexedAccess = 33554432, + Conditional = 67108864, + Union = 134217728, + Intersection = 268435456, + Literal = 15360, + Unit = 97292, + Freshable = 80896, + StringOrNumberLiteral = 3072, + PossiblyFalsy = 15868, + StringLike = 12583968, + NumberLike = 67648, + BigIntLike = 4224, + BooleanLike = 8448, + EnumLike = 98304, + ESSymbolLike = 16896, + VoidLike = 20, + UnionOrIntersection = 402653184, + StructuredType = 403701760, + TypeVariable = 34078720, + InstantiableNonPrimitive = 117964800, + InstantiablePrimitive = 14680064, + Instantiable = 132644864, + StructuredOrInstantiable = 536346624, + Narrowable = 536575971, } type DestructuringPattern = BindingPattern | ObjectLiteralExpression | ArrayLiteralExpression; interface Type { diff --git a/tests/baselines/reference/arityAndOrderCompatibility01.errors.txt b/tests/baselines/reference/arityAndOrderCompatibility01.errors.txt index b4e4cdbcf67a4..bfbebbfbefd5e 100644 --- a/tests/baselines/reference/arityAndOrderCompatibility01.errors.txt +++ b/tests/baselines/reference/arityAndOrderCompatibility01.errors.txt @@ -11,14 +11,16 @@ arityAndOrderCompatibility01.ts(23,5): error TS2322: Type '{ 0: string; 1: numbe arityAndOrderCompatibility01.ts(24,5): error TS2322: Type '[string, number]' is not assignable to type '[number]'. Source has 2 element(s) but target allows only 1. arityAndOrderCompatibility01.ts(25,5): error TS2322: Type 'StrNum' is not assignable to type '[number]'. - Types of property '0' are incompatible. - Type 'string' is not assignable to type 'number'. + The types returned by 'pop()' are incompatible between these types. + Type 'string | number' is not assignable to type 'number'. + Type 'string' is not assignable to type 'number'. arityAndOrderCompatibility01.ts(26,5): error TS2322: Type '{ 0: string; 1: number; length: 2; }' is not assignable to type '[number]'. arityAndOrderCompatibility01.ts(27,5): error TS2322: Type '[string, number]' is not assignable to type '[string]'. Source has 2 element(s) but target allows only 1. arityAndOrderCompatibility01.ts(28,5): error TS2322: Type 'StrNum' is not assignable to type '[string]'. - Types of property 'length' are incompatible. - Type '2' is not assignable to type '1'. + The types returned by 'pop()' are incompatible between these types. + Type 'string | number' is not assignable to type 'string'. + Type 'number' is not assignable to type 'string'. arityAndOrderCompatibility01.ts(29,5): error TS2322: Type '{ 0: string; 1: number; length: 2; }' is not assignable to type '[string]'. arityAndOrderCompatibility01.ts(30,5): error TS2322: Type '[string, number]' is not assignable to type '[number, string]'. Type at position 0 in source is not compatible with type at position 0 in target. @@ -78,8 +80,9 @@ arityAndOrderCompatibility01.ts(32,5): error TS2322: Type '{ 0: string; 1: numbe var l2: [number] = y; ~~ !!! error TS2322: Type 'StrNum' is not assignable to type '[number]'. -!!! error TS2322: Types of property '0' are incompatible. -!!! error TS2322: Type 'string' is not assignable to type 'number'. +!!! error TS2322: The types returned by 'pop()' are incompatible between these types. +!!! error TS2322: Type 'string | number' is not assignable to type 'number'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. var l3: [number] = z; ~~ !!! error TS2322: Type '{ 0: string; 1: number; length: 2; }' is not assignable to type '[number]'. @@ -90,8 +93,9 @@ arityAndOrderCompatibility01.ts(32,5): error TS2322: Type '{ 0: string; 1: numbe var m2: [string] = y; ~~ !!! error TS2322: Type 'StrNum' is not assignable to type '[string]'. -!!! error TS2322: Types of property 'length' are incompatible. -!!! error TS2322: Type '2' is not assignable to type '1'. +!!! error TS2322: The types returned by 'pop()' are incompatible between these types. +!!! error TS2322: Type 'string | number' is not assignable to type 'string'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. var m3: [string] = z; ~~ !!! error TS2322: Type '{ 0: string; 1: number; length: 2; }' is not assignable to type '[string]'. diff --git a/tests/baselines/reference/arrayAssignmentTest1.errors.txt b/tests/baselines/reference/arrayAssignmentTest1.errors.txt index 6ff1f037b1214..059b1fa5dfab1 100644 --- a/tests/baselines/reference/arrayAssignmentTest1.errors.txt +++ b/tests/baselines/reference/arrayAssignmentTest1.errors.txt @@ -1,6 +1,6 @@ arrayAssignmentTest1.ts(46,5): error TS2741: Property 'IM1' is missing in type 'undefined[]' but required in type 'I1'. arrayAssignmentTest1.ts(47,5): error TS2739: Type 'undefined[]' is missing the following properties from type 'C1': IM1, C1M1 -arrayAssignmentTest1.ts(48,5): error TS2739: Type 'undefined[]' is missing the following properties from type 'C2': C2M1, IM1, C1M1 +arrayAssignmentTest1.ts(48,5): error TS2739: Type 'undefined[]' is missing the following properties from type 'C2': IM1, C1M1, C2M1 arrayAssignmentTest1.ts(49,5): error TS2741: Property 'CM3M1' is missing in type 'undefined[]' but required in type 'C3'. arrayAssignmentTest1.ts(60,1): error TS2322: Type 'C3[]' is not assignable to type 'I1[]'. Property 'IM1' is missing in type 'C3' but required in type 'I1'. @@ -11,9 +11,9 @@ arrayAssignmentTest1.ts(65,1): error TS2322: Type 'C3[]' is not assignable to ty arrayAssignmentTest1.ts(68,1): error TS2322: Type 'C1[]' is not assignable to type 'C2[]'. Property 'C2M1' is missing in type 'C1' but required in type 'C2'. arrayAssignmentTest1.ts(69,1): error TS2322: Type 'I1[]' is not assignable to type 'C2[]'. - Type 'I1' is missing the following properties from type 'C2': C2M1, C1M1 + Type 'I1' is missing the following properties from type 'C2': C1M1, C2M1 arrayAssignmentTest1.ts(70,1): error TS2322: Type 'C3[]' is not assignable to type 'C2[]'. - Type 'C3' is missing the following properties from type 'C2': C2M1, IM1, C1M1 + Type 'C3' is missing the following properties from type 'C2': IM1, C1M1, C2M1 arrayAssignmentTest1.ts(75,1): error TS2322: Type 'C2[]' is not assignable to type 'C3[]'. Property 'CM3M1' is missing in type 'C2' but required in type 'C3'. arrayAssignmentTest1.ts(76,1): error TS2322: Type 'C1[]' is not assignable to type 'C3[]'. @@ -83,7 +83,7 @@ arrayAssignmentTest1.ts(85,1): error TS2740: Type 'I1' is missing the following !!! error TS2739: Type 'undefined[]' is missing the following properties from type 'C1': IM1, C1M1 var c2_error: C2 = []; // should be an error - is ~~~~~~~~ -!!! error TS2739: Type 'undefined[]' is missing the following properties from type 'C2': C2M1, IM1, C1M1 +!!! error TS2739: Type 'undefined[]' is missing the following properties from type 'C2': IM1, C1M1, C2M1 var c3_error: C3 = []; // should be an error - is ~~~~~~~~ !!! error TS2741: Property 'CM3M1' is missing in type 'undefined[]' but required in type 'C3'. @@ -125,11 +125,11 @@ arrayAssignmentTest1.ts(85,1): error TS2740: Type 'I1' is missing the following arr_c2 = arr_i1; // should be an error - subtype relationship - is ~~~~~~ !!! error TS2322: Type 'I1[]' is not assignable to type 'C2[]'. -!!! error TS2322: Type 'I1' is missing the following properties from type 'C2': C2M1, C1M1 +!!! error TS2322: Type 'I1' is missing the following properties from type 'C2': C1M1, C2M1 arr_c2 = arr_c3; // should be an error - is ~~~~~~ !!! error TS2322: Type 'C3[]' is not assignable to type 'C2[]'. -!!! error TS2322: Type 'C3' is missing the following properties from type 'C2': C2M1, IM1, C1M1 +!!! error TS2322: Type 'C3' is missing the following properties from type 'C2': IM1, C1M1, C2M1 // "clean up bug" occurs at this point // if you move these three expressions to another file, they raise an error diff --git a/tests/baselines/reference/arrayBestCommonTypes.types b/tests/baselines/reference/arrayBestCommonTypes.types index 510e6e7ddd913..32d65288df5ba 100644 --- a/tests/baselines/reference/arrayBestCommonTypes.types +++ b/tests/baselines/reference/arrayBestCommonTypes.types @@ -620,10 +620,10 @@ namespace 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 @@ namespace 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 @@ namespace 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 @@ namespace 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/arrowFunctionExpressions.types b/tests/baselines/reference/arrowFunctionExpressions.types index cf5973fc84e6f..20765fc438b56 100644 --- a/tests/baselines/reference/arrowFunctionExpressions.types +++ b/tests/baselines/reference/arrowFunctionExpressions.types @@ -175,9 +175,9 @@ var p9 = ({ a: { b = 1 } = { b: 1 } }) => { }; > : ^ var p10 = ([{ value, done }]) => { }; ->p10 : ([{ value, done }]: [{ value: any; done: any; }]) => void +>p10 : ([{ value, done }]: [{ done: any; value: any; }]) => void > : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->([{ value, done }]) => { } : ([{ value, done }]: [{ value: any; done: any; }]) => void +>([{ value, done }]) => { } : ([{ value, done }]: [{ done: any; value: any; }]) => void > : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >value : any > : ^^^ 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/assignmentCompatWithCallSignatures3.errors.txt b/tests/baselines/reference/assignmentCompatWithCallSignatures3.errors.txt index 1d1c9bfdcebd3..b10e53d32b276 100644 --- a/tests/baselines/reference/assignmentCompatWithCallSignatures3.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithCallSignatures3.errors.txt @@ -46,7 +46,7 @@ assignmentCompatWithCallSignatures3.ts(80,1): error TS2322: Type '(x: Base[], y: Types of parameters 'y' and 'y' are incompatible. Type 'T' is not assignable to type 'Derived2[]'. Type 'Base[]' is not assignable to type 'Derived2[]'. - Type 'Base' is missing the following properties from type 'Derived2': baz, bar + Type 'Base' is missing the following properties from type 'Derived2': bar, baz assignmentCompatWithCallSignatures3.ts(83,1): error TS2322: Type '(x: Base[], y: Derived[]) => Derived[]' is not assignable to type '>(x: Base[], y: T) => T'. Type 'Derived[]' is not assignable to type 'T'. 'Derived[]' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Derived[]'. @@ -208,7 +208,7 @@ assignmentCompatWithCallSignatures3.ts(86,1): error TS2322: Type '(x: { a: strin !!! error TS2322: Types of parameters 'y' and 'y' are incompatible. !!! error TS2322: Type 'T' is not assignable to type 'Derived2[]'. !!! error TS2322: Type 'Base[]' is not assignable to type 'Derived2[]'. -!!! error TS2322: Type 'Base' is missing the following properties from type 'Derived2': baz, bar +!!! error TS2322: Type 'Base' is missing the following properties from type 'Derived2': bar, baz var b13: >(x: Array, y: T) => T; a13 = b13; // ok b13 = a13; // ok diff --git a/tests/baselines/reference/assignmentCompatWithConstructSignatures3.errors.txt b/tests/baselines/reference/assignmentCompatWithConstructSignatures3.errors.txt index ce2b75804682f..cb003d57722a5 100644 --- a/tests/baselines/reference/assignmentCompatWithConstructSignatures3.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithConstructSignatures3.errors.txt @@ -46,7 +46,7 @@ assignmentCompatWithConstructSignatures3.ts(80,1): error TS2322: Type 'new (x: B Types of parameters 'y' and 'y' are incompatible. Type 'T' is not assignable to type 'Derived2[]'. Type 'Base[]' is not assignable to type 'Derived2[]'. - Type 'Base' is missing the following properties from type 'Derived2': baz, bar + Type 'Base' is missing the following properties from type 'Derived2': bar, baz assignmentCompatWithConstructSignatures3.ts(83,1): error TS2322: Type 'new (x: Base[], y: Derived[]) => Derived[]' is not assignable to type 'new >(x: Base[], y: T) => T'. Type 'Derived[]' is not assignable to type 'T'. 'Derived[]' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Derived[]'. @@ -208,7 +208,7 @@ assignmentCompatWithConstructSignatures3.ts(86,1): error TS2322: Type 'new (x: { !!! error TS2322: Types of parameters 'y' and 'y' are incompatible. !!! error TS2322: Type 'T' is not assignable to type 'Derived2[]'. !!! error TS2322: Type 'Base[]' is not assignable to type 'Derived2[]'. -!!! error TS2322: Type 'Base' is missing the following properties from type 'Derived2': baz, bar +!!! error TS2322: Type 'Base' is missing the following properties from type 'Derived2': bar, baz var b13: new >(x: Array, y: T) => T; a13 = b13; // ok b13 = a13; // ok 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/assignmentCompatWithNumericIndexer.errors.txt b/tests/baselines/reference/assignmentCompatWithNumericIndexer.errors.txt index 16dba66897213..4e397858a8904 100644 --- a/tests/baselines/reference/assignmentCompatWithNumericIndexer.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithNumericIndexer.errors.txt @@ -3,7 +3,7 @@ assignmentCompatWithNumericIndexer.ts(14,1): error TS2322: Type 'A' is not assig Property 'bar' is missing in type 'Base' but required in type 'Derived'. assignmentCompatWithNumericIndexer.ts(18,1): error TS2322: Type 'A' is not assignable to type '{ [x: number]: Derived2; }'. 'number' index signatures are incompatible. - Type 'Base' is missing the following properties from type 'Derived2': baz, bar + Type 'Base' is missing the following properties from type 'Derived2': bar, baz assignmentCompatWithNumericIndexer.ts(32,9): error TS2322: Type '{ [x: number]: Derived; }' is not assignable to type 'A'. 'number' index signatures are incompatible. Type 'Derived' is not assignable to type 'T'. @@ -19,7 +19,7 @@ assignmentCompatWithNumericIndexer.ts(36,9): error TS2322: Type '{ [x: number]: assignmentCompatWithNumericIndexer.ts(37,9): error TS2322: Type 'A' is not assignable to type '{ [x: number]: Derived2; }'. 'number' index signatures are incompatible. Type 'T' is not assignable to type 'Derived2'. - Type 'Base' is missing the following properties from type 'Derived2': baz, bar + Type 'Base' is missing the following properties from type 'Derived2': bar, baz ==== assignmentCompatWithNumericIndexer.ts (6 errors) ==== @@ -49,7 +49,7 @@ assignmentCompatWithNumericIndexer.ts(37,9): error TS2322: Type 'A' is not as ~~ !!! error TS2322: Type 'A' is not assignable to type '{ [x: number]: Derived2; }'. !!! error TS2322: 'number' index signatures are incompatible. -!!! error TS2322: Type 'Base' is missing the following properties from type 'Derived2': baz, bar +!!! error TS2322: Type 'Base' is missing the following properties from type 'Derived2': bar, baz namespace Generics { class A { @@ -89,7 +89,7 @@ assignmentCompatWithNumericIndexer.ts(37,9): error TS2322: Type 'A' is not as !!! error TS2322: Type 'A' is not assignable to type '{ [x: number]: Derived2; }'. !!! error TS2322: 'number' index signatures are incompatible. !!! error TS2322: Type 'T' is not assignable to type 'Derived2'. -!!! error TS2322: Type 'Base' is missing the following properties from type 'Derived2': baz, bar +!!! error TS2322: Type 'Base' is missing the following properties from type 'Derived2': bar, baz var b3: { [x: number]: T; } a = b3; // ok diff --git a/tests/baselines/reference/assignmentCompatWithNumericIndexer2.errors.txt b/tests/baselines/reference/assignmentCompatWithNumericIndexer2.errors.txt index a9535962fb7d6..6bbb697e8946e 100644 --- a/tests/baselines/reference/assignmentCompatWithNumericIndexer2.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithNumericIndexer2.errors.txt @@ -3,7 +3,7 @@ assignmentCompatWithNumericIndexer2.ts(14,1): error TS2322: Type 'A' is not assi Property 'bar' is missing in type 'Base' but required in type 'Derived'. assignmentCompatWithNumericIndexer2.ts(18,1): error TS2322: Type 'A' is not assignable to type '{ [x: number]: Derived2; }'. 'number' index signatures are incompatible. - Type 'Base' is missing the following properties from type 'Derived2': baz, bar + Type 'Base' is missing the following properties from type 'Derived2': bar, baz assignmentCompatWithNumericIndexer2.ts(32,9): error TS2322: Type '{ [x: number]: Derived; }' is not assignable to type 'A'. 'number' index signatures are incompatible. Type 'Derived' is not assignable to type 'T'. @@ -19,7 +19,7 @@ assignmentCompatWithNumericIndexer2.ts(36,9): error TS2322: Type '{ [x: number]: assignmentCompatWithNumericIndexer2.ts(37,9): error TS2322: Type 'A' is not assignable to type '{ [x: number]: Derived2; }'. 'number' index signatures are incompatible. Type 'T' is not assignable to type 'Derived2'. - Type 'Base' is missing the following properties from type 'Derived2': baz, bar + Type 'Base' is missing the following properties from type 'Derived2': bar, baz ==== assignmentCompatWithNumericIndexer2.ts (6 errors) ==== @@ -49,7 +49,7 @@ assignmentCompatWithNumericIndexer2.ts(37,9): error TS2322: Type 'A' is not a ~~ !!! error TS2322: Type 'A' is not assignable to type '{ [x: number]: Derived2; }'. !!! error TS2322: 'number' index signatures are incompatible. -!!! error TS2322: Type 'Base' is missing the following properties from type 'Derived2': baz, bar +!!! error TS2322: Type 'Base' is missing the following properties from type 'Derived2': bar, baz namespace Generics { interface A { @@ -89,7 +89,7 @@ assignmentCompatWithNumericIndexer2.ts(37,9): error TS2322: Type 'A' is not a !!! error TS2322: Type 'A' is not assignable to type '{ [x: number]: Derived2; }'. !!! error TS2322: 'number' index signatures are incompatible. !!! error TS2322: Type 'T' is not assignable to type 'Derived2'. -!!! error TS2322: Type 'Base' is missing the following properties from type 'Derived2': baz, bar +!!! error TS2322: Type 'Base' is missing the following properties from type 'Derived2': bar, baz var b3: { [x: number]: T; } a = b3; // ok diff --git a/tests/baselines/reference/assignmentCompatWithStringIndexer.errors.txt b/tests/baselines/reference/assignmentCompatWithStringIndexer.errors.txt index 33184907db2a8..bcad1bb77488f 100644 --- a/tests/baselines/reference/assignmentCompatWithStringIndexer.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithStringIndexer.errors.txt @@ -3,13 +3,13 @@ assignmentCompatWithStringIndexer.ts(15,1): error TS2322: Type 'A' is not assign Property 'bar' is missing in type 'Base' but required in type 'Derived'. assignmentCompatWithStringIndexer.ts(19,1): error TS2322: Type 'A' is not assignable to type '{ [x: string]: Derived2; }'. 'string' index signatures are incompatible. - Type 'Base' is missing the following properties from type 'Derived2': baz, bar + Type 'Base' is missing the following properties from type 'Derived2': bar, baz assignmentCompatWithStringIndexer.ts(33,5): error TS2322: Type 'A' is not assignable to type '{ [x: string]: Derived; }'. 'string' index signatures are incompatible. Property 'bar' is missing in type 'Base' but required in type 'Derived'. assignmentCompatWithStringIndexer.ts(41,5): error TS2322: Type 'A' is not assignable to type '{ [x: string]: Derived2; }'. 'string' index signatures are incompatible. - Type 'Base' is missing the following properties from type 'Derived2': baz, bar + Type 'Base' is missing the following properties from type 'Derived2': bar, baz assignmentCompatWithStringIndexer.ts(46,9): error TS2322: Type '{ [x: string]: Derived; }' is not assignable to type 'A'. 'string' index signatures are incompatible. Type 'Derived' is not assignable to type 'T'. @@ -25,7 +25,7 @@ assignmentCompatWithStringIndexer.ts(50,9): error TS2322: Type '{ [x: string]: D assignmentCompatWithStringIndexer.ts(51,9): error TS2322: Type 'A' is not assignable to type '{ [x: string]: Derived2; }'. 'string' index signatures are incompatible. Type 'T' is not assignable to type 'Derived2'. - Type 'Base' is missing the following properties from type 'Derived2': baz, bar + Type 'Base' is missing the following properties from type 'Derived2': bar, baz ==== assignmentCompatWithStringIndexer.ts (8 errors) ==== @@ -56,7 +56,7 @@ assignmentCompatWithStringIndexer.ts(51,9): error TS2322: Type 'A' is not ass ~~ !!! error TS2322: Type 'A' is not assignable to type '{ [x: string]: Derived2; }'. !!! error TS2322: 'string' index signatures are incompatible. -!!! error TS2322: Type 'Base' is missing the following properties from type 'Derived2': baz, bar +!!! error TS2322: Type 'Base' is missing the following properties from type 'Derived2': bar, baz namespace Generics { class A { @@ -87,7 +87,7 @@ assignmentCompatWithStringIndexer.ts(51,9): error TS2322: Type 'A' is not ass ~~ !!! error TS2322: Type 'A' is not assignable to type '{ [x: string]: Derived2; }'. !!! error TS2322: 'string' index signatures are incompatible. -!!! error TS2322: Type 'Base' is missing the following properties from type 'Derived2': baz, bar +!!! error TS2322: Type 'Base' is missing the following properties from type 'Derived2': bar, baz function foo() { var b3: { [x: string]: Derived; }; @@ -118,6 +118,6 @@ assignmentCompatWithStringIndexer.ts(51,9): error TS2322: Type 'A' is not ass !!! error TS2322: Type 'A' is not assignable to type '{ [x: string]: Derived2; }'. !!! error TS2322: 'string' index signatures are incompatible. !!! error TS2322: Type 'T' is not assignable to type 'Derived2'. -!!! error TS2322: Type 'Base' is missing the following properties from type 'Derived2': baz, bar +!!! error TS2322: Type 'Base' is missing the following properties from type 'Derived2': bar, baz } } \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatWithStringIndexer2.errors.txt b/tests/baselines/reference/assignmentCompatWithStringIndexer2.errors.txt index c2a99920604c6..f7265644e8508 100644 --- a/tests/baselines/reference/assignmentCompatWithStringIndexer2.errors.txt +++ b/tests/baselines/reference/assignmentCompatWithStringIndexer2.errors.txt @@ -3,13 +3,13 @@ assignmentCompatWithStringIndexer2.ts(15,1): error TS2322: Type 'A' is not assig Property 'bar' is missing in type 'Base' but required in type 'Derived'. assignmentCompatWithStringIndexer2.ts(19,1): error TS2322: Type 'A' is not assignable to type '{ [x: string]: Derived2; }'. 'string' index signatures are incompatible. - Type 'Base' is missing the following properties from type 'Derived2': baz, bar + Type 'Base' is missing the following properties from type 'Derived2': bar, baz assignmentCompatWithStringIndexer2.ts(33,5): error TS2322: Type 'A' is not assignable to type '{ [x: string]: Derived; }'. 'string' index signatures are incompatible. Property 'bar' is missing in type 'Base' but required in type 'Derived'. assignmentCompatWithStringIndexer2.ts(41,5): error TS2322: Type 'A' is not assignable to type '{ [x: string]: Derived2; }'. 'string' index signatures are incompatible. - Type 'Base' is missing the following properties from type 'Derived2': baz, bar + Type 'Base' is missing the following properties from type 'Derived2': bar, baz assignmentCompatWithStringIndexer2.ts(46,9): error TS2322: Type '{ [x: string]: Derived; }' is not assignable to type 'A'. 'string' index signatures are incompatible. Type 'Derived' is not assignable to type 'T'. @@ -25,7 +25,7 @@ assignmentCompatWithStringIndexer2.ts(50,9): error TS2322: Type '{ [x: string]: assignmentCompatWithStringIndexer2.ts(51,9): error TS2322: Type 'A' is not assignable to type '{ [x: string]: Derived2; }'. 'string' index signatures are incompatible. Type 'T' is not assignable to type 'Derived2'. - Type 'Base' is missing the following properties from type 'Derived2': baz, bar + Type 'Base' is missing the following properties from type 'Derived2': bar, baz ==== assignmentCompatWithStringIndexer2.ts (8 errors) ==== @@ -56,7 +56,7 @@ assignmentCompatWithStringIndexer2.ts(51,9): error TS2322: Type 'A' is not as ~~ !!! error TS2322: Type 'A' is not assignable to type '{ [x: string]: Derived2; }'. !!! error TS2322: 'string' index signatures are incompatible. -!!! error TS2322: Type 'Base' is missing the following properties from type 'Derived2': baz, bar +!!! error TS2322: Type 'Base' is missing the following properties from type 'Derived2': bar, baz namespace Generics { interface A { @@ -87,7 +87,7 @@ assignmentCompatWithStringIndexer2.ts(51,9): error TS2322: Type 'A' is not as ~~ !!! error TS2322: Type 'A' is not assignable to type '{ [x: string]: Derived2; }'. !!! error TS2322: 'string' index signatures are incompatible. -!!! error TS2322: Type 'Base' is missing the following properties from type 'Derived2': baz, bar +!!! error TS2322: Type 'Base' is missing the following properties from type 'Derived2': bar, baz function foo() { var b3: { [x: string]: Derived; }; @@ -118,6 +118,6 @@ assignmentCompatWithStringIndexer2.ts(51,9): error TS2322: Type 'A' is not as !!! error TS2322: Type 'A' is not assignable to type '{ [x: string]: Derived2; }'. !!! error TS2322: 'string' index signatures are incompatible. !!! error TS2322: Type 'T' is not assignable to type 'Derived2'. -!!! error TS2322: Type 'Base' is missing the following properties from type 'Derived2': baz, bar +!!! error TS2322: Type 'Base' is missing the following properties from type 'Derived2': bar, baz } } \ No newline at end of file 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/asyncFunctionTempVariableScoping.types b/tests/baselines/reference/asyncFunctionTempVariableScoping.types index f419de00d7f96..97a38ddf95144 100644 --- a/tests/baselines/reference/asyncFunctionTempVariableScoping.types +++ b/tests/baselines/reference/asyncFunctionTempVariableScoping.types @@ -4,7 +4,7 @@ // https://github.com/Microsoft/TypeScript/issues/19187 async ({ foo, bar, ...rest }) => bar(await foo); ->async ({ foo, bar, ...rest }) => bar(await foo) : ({ foo, bar, ...rest }: { [x: string]: any; foo: any; bar: any; }) => Promise +>async ({ foo, bar, ...rest }) => bar(await foo) : ({ foo, bar, ...rest }: { [x: string]: any; bar: any; foo: any; }) => Promise > : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >foo : any > : ^^^ 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..73edb0244c695 100644 --- a/tests/baselines/reference/awaitedTypeNoLib.errors.txt +++ b/tests/baselines/reference/awaitedTypeNoLib.errors.txt @@ -8,7 +8,7 @@ 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 'Thenable & TResult' is not assignable to type 'Thenable'. @@ -47,7 +47,7 @@ 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 'Thenable & TResult' is not assignable to type 'Thenable'. 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 aedabb0df7ebd..341cf2372d8de 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 5c81cf536b3b4..86d191cfe458e 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/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.errors.txt b/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.errors.txt index 6679063d1a3bf..66e34d66b49b0 100644 --- a/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.errors.txt +++ b/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.errors.txt @@ -1,5 +1,5 @@ chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.ts(19,64): error TS2741: Property 'z' is missing in type 'B' but required in type 'C'. -chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.ts(19,81): error TS2739: Type 'A' is missing the following properties from type 'C': z, y +chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.ts(19,81): error TS2739: Type 'A' is missing the following properties from type 'C': y, z ==== chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.ts (2 errors) ==== @@ -27,5 +27,5 @@ chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.ts(19,81): error TS !!! related TS2728 chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.ts:15:5: 'z' is declared here. !!! related TS6502 chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.ts:3:27: The expected type comes from the return type of this signature. ~~~~~ -!!! error TS2739: Type 'A' is missing the following properties from type 'C': z, y +!!! error TS2739: Type 'A' is missing the following properties from type 'C': y, z !!! related TS6502 chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.ts:3:27: The expected type comes from the return type of this signature. \ No newline at end of file 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/checkJsxChildrenProperty15.errors.txt b/tests/baselines/reference/checkJsxChildrenProperty15.errors.txt index bd58dea1368da..cc85e0f436900 100644 --- a/tests/baselines/reference/checkJsxChildrenProperty15.errors.txt +++ b/tests/baselines/reference/checkJsxChildrenProperty15.errors.txt @@ -1,8 +1,8 @@ file.tsx(10,17): error TS2322: Type '{ children: Element; }' is not assignable to type 'IntrinsicAttributes'. Property 'children' does not exist on type 'IntrinsicAttributes'. -file.tsx(11,13): error TS2322: Type '{ children: Element; key: string; }' is not assignable to type 'IntrinsicAttributes'. +file.tsx(11,13): error TS2322: Type '{ key: string; children: Element; }' is not assignable to type 'IntrinsicAttributes'. Property 'children' does not exist on type 'IntrinsicAttributes'. -file.tsx(12,13): error TS2322: Type '{ children: Element[]; key: string; }' is not assignable to type 'IntrinsicAttributes'. +file.tsx(12,13): error TS2322: Type '{ key: string; children: Element[]; }' is not assignable to type 'IntrinsicAttributes'. Property 'children' does not exist on type 'IntrinsicAttributes'. @@ -22,10 +22,10 @@ file.tsx(12,13): error TS2322: Type '{ children: Element[]; key: string; }' is n !!! error TS2322: Property 'children' does not exist on type 'IntrinsicAttributes'. const k4 =
; ~~~ -!!! error TS2322: Type '{ children: Element; key: string; }' is not assignable to type 'IntrinsicAttributes'. +!!! error TS2322: Type '{ key: string; children: Element; }' is not assignable to type 'IntrinsicAttributes'. !!! error TS2322: Property 'children' does not exist on type 'IntrinsicAttributes'. const k5 =
; ~~~ -!!! error TS2322: Type '{ children: Element[]; key: string; }' is not assignable to type 'IntrinsicAttributes'. +!!! error TS2322: Type '{ key: string; children: Element[]; }' is not assignable to type 'IntrinsicAttributes'. !!! error TS2322: Property 'children' does not exist on type 'IntrinsicAttributes'. \ No newline at end of file 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 =