diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 3f20314adbb65..4210aefe8d3ff 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -17132,7 +17132,10 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { } function insertType(types: Type[], type: Type): boolean { - const index = binarySearch(types, type, getTypeId, compareValues); + // TODO(jakebailey): we already have insertSorted and should use it here (adding the perf optimization?) + const len = types.length; + // Perf optimization (measure?); check the last element first as we often insert in order. + const index = len && type.id > types[len - 1].id ? ~len : binarySearch(types, type, getTypeId, compareValues); if (index < 0) { types.splice(~index, 0, type); return true; @@ -17152,11 +17155,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { if (!(getObjectFlags(type) & ObjectFlags.ContainsWideningType)) includes |= TypeFlags.IncludesNonWideningType; } else { - const len = typeSet.length; - const index = len && type.id > typeSet[len - 1].id ? ~len : binarySearch(typeSet, type, getTypeId, compareValues); - if (index < 0) { - typeSet.splice(~index, 0, type); - } + insertType(typeSet, type); } } return includes; @@ -17527,7 +17526,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { return links.resolvedType; } - function addTypeToIntersection(typeSet: Map, includes: TypeFlags, type: Type) { + function addTypeToIntersection(typeSet: Type[], includes: TypeFlags, type: Type) { const flags = type.flags; if (flags & TypeFlags.Intersection) { return addTypesToIntersection(typeSet, includes, (type as IntersectionType).types); @@ -17535,7 +17534,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { if (isEmptyAnonymousObjectType(type)) { if (!(includes & TypeFlags.IncludesEmptyObject)) { includes |= TypeFlags.IncludesEmptyObject; - typeSet.set(type.id.toString(), type); + insertType(typeSet, type); } } else { @@ -17547,13 +17546,13 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { includes |= TypeFlags.IncludesMissingType; type = undefinedType; } - if (!typeSet.has(type.id.toString())) { + const inserted = insertType(typeSet, type); + if (inserted) { if (type.flags & TypeFlags.Unit && includes & TypeFlags.Unit) { // We have seen two distinct unit types which means we should reduce to an // empty intersection. Adding TypeFlags.NonPrimitive causes that to happen. includes |= TypeFlags.NonPrimitive; } - typeSet.set(type.id.toString(), type); } } includes |= flags & TypeFlags.IncludesMask; @@ -17563,7 +17562,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { // Add the given types to the given type set. Order is preserved, freshness is removed from literal // types, duplicates are removed, and nested types of the given kind are flattened into the set. - function addTypesToIntersection(typeSet: Map, includes: TypeFlags, types: readonly Type[]) { + function addTypesToIntersection(typeSet: Type[], includes: TypeFlags, types: readonly Type[]) { for (const type of types) { includes = addTypeToIntersection(typeSet, includes, getRegularTypeOfLiteralType(type)); } @@ -17702,9 +17701,8 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { // Also, unlike union types, the order of the constituent types is preserved in order that overload resolution // for intersections of types with signatures can be deterministic. function getIntersectionType(types: readonly Type[], aliasSymbol?: Symbol, aliasTypeArguments?: readonly Type[], noSupertypeReduction?: boolean): Type { - const typeMembershipMap = new Map(); - const includes = addTypesToIntersection(typeMembershipMap, 0 as TypeFlags, types); - const typeSet: Type[] = arrayFrom(typeMembershipMap.values()); + const typeSet: Type[] = []; + const includes = addTypesToIntersection(typeSet, 0 as TypeFlags, types); let objectFlags = ObjectFlags.None; // An intersection type is considered empty if it contains // the type never, or @@ -22142,29 +22140,29 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { function typeRelatedToSomeType(source: Type, target: UnionOrIntersectionType, reportErrors: boolean, intersectionState: IntersectionState): Ternary { const targetTypes = target.types; + if (target.flags & TypeFlags.UnionOrIntersection && containsType(targetTypes, source)) { + return Ternary.True; + } + if ( + relation !== comparableRelation && getObjectFlags(target) & ObjectFlags.PrimitiveUnion && !(source.flags & TypeFlags.EnumLiteral) && ( + source.flags & (TypeFlags.StringLiteral | TypeFlags.BooleanLiteral | TypeFlags.BigIntLiteral) || + (relation === subtypeRelation || relation === strictSubtypeRelation) && source.flags & TypeFlags.NumberLiteral + ) + ) { + // When relating a literal type to a union of primitive types, we know the relation is false unless + // the union contains the base primitive type or the literal type in one of its fresh/regular forms. + // We exclude numeric literals for non-subtype relations because numeric literals are assignable to + // numeric enum literals with the same value. Similarly, we exclude enum literal types because + // identically named enum types are related (see isEnumTypeRelatedTo). We exclude the comparable + // relation in entirety because it needs to be checked in both directions. + const alternateForm = source === (source as StringLiteralType).regularType ? (source as StringLiteralType).freshType : (source as StringLiteralType).regularType; + const primitive = source.flags & TypeFlags.StringLiteral ? stringType : + source.flags & TypeFlags.NumberLiteral ? numberType : + source.flags & TypeFlags.BigIntLiteral ? bigintType : + undefined; + return primitive && containsType(targetTypes, primitive) || alternateForm && containsType(targetTypes, alternateForm) ? Ternary.True : Ternary.False; + } if (target.flags & TypeFlags.Union) { - if (containsType(targetTypes, source)) { - return Ternary.True; - } - if ( - relation !== comparableRelation && getObjectFlags(target) & ObjectFlags.PrimitiveUnion && !(source.flags & TypeFlags.EnumLiteral) && ( - source.flags & (TypeFlags.StringLiteral | TypeFlags.BooleanLiteral | TypeFlags.BigIntLiteral) || - (relation === subtypeRelation || relation === strictSubtypeRelation) && source.flags & TypeFlags.NumberLiteral - ) - ) { - // When relating a literal type to a union of primitive types, we know the relation is false unless - // the union contains the base primitive type or the literal type in one of its fresh/regular forms. - // We exclude numeric literals for non-subtype relations because numeric literals are assignable to - // numeric enum literals with the same value. Similarly, we exclude enum literal types because - // identically named enum types are related (see isEnumTypeRelatedTo). We exclude the comparable - // relation in entirety because it needs to be checked in both directions. - const alternateForm = source === (source as StringLiteralType).regularType ? (source as StringLiteralType).freshType : (source as StringLiteralType).regularType; - const primitive = source.flags & TypeFlags.StringLiteral ? stringType : - source.flags & TypeFlags.NumberLiteral ? numberType : - source.flags & TypeFlags.BigIntLiteral ? bigintType : - undefined; - return primitive && containsType(targetTypes, primitive) || alternateForm && containsType(targetTypes, alternateForm) ? Ternary.True : Ternary.False; - } const match = getMatchingUnionConstituentForType(target as UnionType, source); if (match) { const related = isRelatedTo(source, match, RecursionFlags.Target, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState); @@ -22204,7 +22202,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { function someTypeRelatedToType(source: UnionOrIntersectionType, target: Type, reportErrors: boolean, intersectionState: IntersectionState): Ternary { const sourceTypes = source.types; - if (source.flags & TypeFlags.Union && containsType(sourceTypes, target)) { + if (containsType(sourceTypes, target)) { return Ternary.True; } const len = sourceTypes.length; diff --git a/tests/baselines/reference/accessorsOverrideProperty8.types b/tests/baselines/reference/accessorsOverrideProperty8.types index 26507f6dbf3ad..60885f13283b5 100644 --- a/tests/baselines/reference/accessorsOverrideProperty8.types +++ b/tests/baselines/reference/accessorsOverrideProperty8.types @@ -72,7 +72,7 @@ const Base = classWithProperties({ class MyClass extends Base { >MyClass : MyClass > : ^^^^^^^ ->Base : Base & Properties<{ readonly x: "boolean"; y: "string"; }> +>Base : Properties<{ readonly x: "boolean"; y: "string"; }> & Base > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ get x() { diff --git a/tests/baselines/reference/accessorsOverrideProperty9.types b/tests/baselines/reference/accessorsOverrideProperty9.types index b496254164993..04c5ee8bef80e 100644 --- a/tests/baselines/reference/accessorsOverrideProperty9.types +++ b/tests/baselines/reference/accessorsOverrideProperty9.types @@ -91,7 +91,7 @@ function ApiItemContainerMixin( } return MixedClass; ->MixedClass : ((abstract new (...args: any[]) => MixedClass) & { prototype: ApiItemContainerMixin.MixedClass; }) & TBaseClass +>MixedClass : TBaseClass & ((abstract new (...args: any[]) => MixedClass) & { prototype: ApiItemContainerMixin.MixedClass; }) > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ } diff --git a/tests/baselines/reference/amdDeclarationEmitNoExtraDeclare.types b/tests/baselines/reference/amdDeclarationEmitNoExtraDeclare.types index 0a0fc5ffdbb6d..5a825448f93f2 100644 --- a/tests/baselines/reference/amdDeclarationEmitNoExtraDeclare.types +++ b/tests/baselines/reference/amdDeclarationEmitNoExtraDeclare.types @@ -35,8 +35,8 @@ export function Configurable>(base: T): T { > : ^ return class extends base { ->class extends base { constructor(...args: any[]) { super(...args); } } : { new (...args: any[]): (Anonymous class); prototype: Configurable.(Anonymous class); } & T -> : ^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>class extends base { constructor(...args: any[]) { super(...args); } } : T & { new (...args: any[]): (Anonymous class); prototype: Configurable.(Anonymous class); } +> : ^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >base : {} > : ^^ diff --git a/tests/baselines/reference/amdLikeInputDeclarationEmit.js b/tests/baselines/reference/amdLikeInputDeclarationEmit.js index 8067260169d7b..acb7088ca5325 100644 --- a/tests/baselines/reference/amdLikeInputDeclarationEmit.js +++ b/tests/baselines/reference/amdLikeInputDeclarationEmit.js @@ -34,6 +34,6 @@ define("lib/ExtendedClass", ["deps/BaseClass"], //// [ExtendedClass.d.ts] export = ExtendedClass; -declare const ExtendedClass: new () => { +declare const ExtendedClass: new () => import("deps/BaseClass") & { f: () => "something"; -} & import("deps/BaseClass"); +}; diff --git a/tests/baselines/reference/amdLikeInputDeclarationEmit.types b/tests/baselines/reference/amdLikeInputDeclarationEmit.types index b2a768fd1b6c7..14412720e3f07 100644 --- a/tests/baselines/reference/amdLikeInputDeclarationEmit.types +++ b/tests/baselines/reference/amdLikeInputDeclarationEmit.types @@ -56,15 +56,15 @@ define("lib/ExtendedClass", ["deps/BaseClass"], > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ const ExtendedClass = BaseClass.extends({ ->ExtendedClass : new () => { f: () => "something"; } & import("deps/BaseClass") +>ExtendedClass : new () => import("deps/BaseClass") & { f: () => "something"; } > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->BaseClass.extends({ f: function() { return "something"; } }) : new () => { f: () => "something"; } & import("deps/BaseClass") +>BaseClass.extends({ f: function() { return "something"; } }) : new () => import("deps/BaseClass") & { f: () => "something"; } > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->BaseClass.extends : (a: A) => new () => A & import("deps/BaseClass") +>BaseClass.extends : (a: A) => new () => import("deps/BaseClass") & A > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >BaseClass : typeof import("deps/BaseClass") > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->extends : (a: A) => new () => A & import("deps/BaseClass") +>extends : (a: A) => new () => import("deps/BaseClass") & A > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >{ f: function() { return "something"; } } : { f: () => "something"; } > : ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -95,7 +95,7 @@ define("lib/ExtendedClass", ["deps/BaseClass"], > : ^^ >exports : any > : ^^^ ->ExtendedClass : new () => { f: () => "something"; } & import("deps/BaseClass") +>ExtendedClass : new () => import("deps/BaseClass") & { f: () => "something"; } > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ return module.exports; diff --git a/tests/baselines/reference/anonClassDeclarationEmitIsAnon.js b/tests/baselines/reference/anonClassDeclarationEmitIsAnon.js index 2c0dc04e17776..1506b106eb63f 100644 --- a/tests/baselines/reference/anonClassDeclarationEmitIsAnon.js +++ b/tests/baselines/reference/anonClassDeclarationEmitIsAnon.js @@ -122,11 +122,11 @@ export declare function wrapClass(param: any): { }; }; export type Constructor = new (...args: any[]) => T; -export declare function Timestamped(Base: TBase): { +export declare function Timestamped(Base: TBase): TBase & { new (...args: any[]): { timestamp: number; }; -} & TBase; +}; //// [index.d.ts] declare const _default: { new (): { @@ -137,11 +137,11 @@ export default _default; export declare class User { name: string; } -declare const TimestampedUser_base: { +declare const TimestampedUser_base: typeof User & { new (...args: any[]): { timestamp: number; }; -} & typeof User; +}; export declare class TimestampedUser extends TimestampedUser_base { constructor(); } diff --git a/tests/baselines/reference/anonClassDeclarationEmitIsAnon.types b/tests/baselines/reference/anonClassDeclarationEmitIsAnon.types index 206056a633bbd..38dc0482ccda9 100644 --- a/tests/baselines/reference/anonClassDeclarationEmitIsAnon.types +++ b/tests/baselines/reference/anonClassDeclarationEmitIsAnon.types @@ -29,13 +29,13 @@ export type Constructor = new (...args: any[]) => T; > : ^^^^^ export function Timestamped(Base: TBase) { ->Timestamped : >(Base: TBase) => { new (...args: any[]): (Anonymous class); prototype: Timestamped.(Anonymous class); } & TBase +>Timestamped : >(Base: TBase) => TBase & { new (...args: any[]): (Anonymous class); prototype: Timestamped.(Anonymous class); } > : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >Base : TBase > : ^^^^^ return class extends Base { ->class extends Base { timestamp = Date.now(); } : { new (...args: any[]): (Anonymous class); prototype: Timestamped.(Anonymous class); } & TBase +>class extends Base { timestamp = Date.now(); } : TBase & { new (...args: any[]): (Anonymous class); prototype: Timestamped.(Anonymous class); } > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >Base : {} > : ^^ @@ -59,7 +59,7 @@ export function Timestamped(Base: TBase) { import { wrapClass, Timestamped } from "./wrapClass"; >wrapClass : (param: any) => typeof Wrapped > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->Timestamped : >(Base: TBase) => { new (...args: any[]): (Anonymous class); prototype: Timestamped.(Anonymous class); } & TBase +>Timestamped : >(Base: TBase) => TBase & { new (...args: any[]): (Anonymous class); prototype: Timestamped.(Anonymous class); } > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ export default wrapClass(0); @@ -86,9 +86,9 @@ export class User { export class TimestampedUser extends Timestamped(User) { >TimestampedUser : TimestampedUser > : ^^^^^^^^^^^^^^^ ->Timestamped(User) : Timestamped.(Anonymous class) & User +>Timestamped(User) : User & Timestamped.(Anonymous class) > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->Timestamped : >(Base: TBase) => { new (...args: any[]): (Anonymous class); prototype: Timestamped.(Anonymous class); } & TBase +>Timestamped : >(Base: TBase) => TBase & { new (...args: any[]): (Anonymous class); prototype: Timestamped.(Anonymous class); } > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >User : typeof User > : ^^^^^^^^^^^ @@ -97,7 +97,7 @@ export class TimestampedUser extends Timestamped(User) { super(); >super() : void > : ^^^^ ->super : { new (...args: any[]): Timestamped.(Anonymous class); prototype: Timestamped.(Anonymous class); } & typeof User +>super : typeof User & { new (...args: any[]): Timestamped.(Anonymous class); prototype: Timestamped.(Anonymous class); } > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ } } diff --git a/tests/baselines/reference/arrowFunctionContexts.types b/tests/baselines/reference/arrowFunctionContexts.types index 7a0f4ecf75b74..532094a0ab36f 100644 --- a/tests/baselines/reference/arrowFunctionContexts.types +++ b/tests/baselines/reference/arrowFunctionContexts.types @@ -3,7 +3,7 @@ === arrowFunctionContexts.ts === // Arrow function used in with statement with (window) { ->window : Window & typeof globalThis +>window : typeof globalThis & Window > : ^^^^^^^^^^^^^^^^^^^^^^^^^^ var p = () => this; @@ -50,7 +50,7 @@ window.setTimeout(() => null, 100); > : ^^^^^^ >window.setTimeout : ((handler: TimerHandler, timeout?: number, ...arguments: any[]) => number) & ((handler: TimerHandler, timeout?: number, ...arguments: any[]) => number) > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->window : Window & typeof globalThis +>window : typeof globalThis & Window > : ^^^^^^^^^^^^^^^^^^^^^^^^^^ >setTimeout : ((handler: TimerHandler, timeout?: number, ...arguments: any[]) => number) & ((handler: TimerHandler, timeout?: number, ...arguments: any[]) => number) > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -156,7 +156,7 @@ module M2 { // Arrow function used in with statement with (window) { ->window : Window & typeof globalThis +>window : typeof globalThis & Window > : ^^^^^^^^^^^^^^^^^^^^^^^^^^ var p = () => this; @@ -203,7 +203,7 @@ module M2 { > : ^^^^^^ >window.setTimeout : ((handler: TimerHandler, timeout?: number, ...arguments: any[]) => number) & ((handler: TimerHandler, timeout?: number, ...arguments: any[]) => number) > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->window : Window & typeof globalThis +>window : typeof globalThis & Window > : ^^^^^^^^^^^^^^^^^^^^^^^^^^ >setTimeout : ((handler: TimerHandler, timeout?: number, ...arguments: any[]) => number) & ((handler: TimerHandler, timeout?: number, ...arguments: any[]) => number) > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/baselines/reference/assertionTypePredicates1.symbols b/tests/baselines/reference/assertionTypePredicates1.symbols index 33031eead7221..753e1731c92ee 100644 --- a/tests/baselines/reference/assertionTypePredicates1.symbols +++ b/tests/baselines/reference/assertionTypePredicates1.symbols @@ -545,9 +545,9 @@ function example1(things: Thing[]) { >isGood : Symbol(Thing.isGood, Decl(assertionTypePredicates1.ts, 181, 18)) thing.good; ->thing.good : Symbol(good, Decl(assertionTypePredicates1.ts, 180, 17), Decl(assertionTypePredicates1.ts, 185, 21)) +>thing.good : Symbol(good, Decl(assertionTypePredicates1.ts, 185, 21), Decl(assertionTypePredicates1.ts, 180, 17)) >thing : Symbol(thing, Decl(assertionTypePredicates1.ts, 190, 12)) ->good : Symbol(good, Decl(assertionTypePredicates1.ts, 180, 17), Decl(assertionTypePredicates1.ts, 185, 21)) +>good : Symbol(good, Decl(assertionTypePredicates1.ts, 185, 21), Decl(assertionTypePredicates1.ts, 180, 17)) } } diff --git a/tests/baselines/reference/asyncFunctionNoReturnType.types b/tests/baselines/reference/asyncFunctionNoReturnType.types index 7b2fa1e95bc97..4995277fa6866 100644 --- a/tests/baselines/reference/asyncFunctionNoReturnType.types +++ b/tests/baselines/reference/asyncFunctionNoReturnType.types @@ -6,7 +6,7 @@ async () => { > : ^^^^^^^^^^^^^^^^^^^ if (window) ->window : Window & typeof globalThis +>window : typeof globalThis & Window > : ^^^^^^^^^^^^^^^^^^^^^^^^^^ return; diff --git a/tests/baselines/reference/baseConstraintOfDecorator.types b/tests/baselines/reference/baseConstraintOfDecorator.types index f691fbed32ba0..60454537ea3db 100644 --- a/tests/baselines/reference/baseConstraintOfDecorator.types +++ b/tests/baselines/reference/baseConstraintOfDecorator.types @@ -69,10 +69,10 @@ export function classExtender2 MyCl > : ^^^^^ return class decoratorFunc extends superClass { ->class decoratorFunc extends superClass { constructor(...args: any[]) { super(...args); _instanceModifier(this, args); } } : { new (...args: any[]): decoratorFunc; prototype: classExtender2.decoratorFunc; } & TFunction -> : ^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->decoratorFunc : { new (...args: any[]): decoratorFunc; prototype: classExtender2.decoratorFunc; } & TFunction -> : ^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>class decoratorFunc extends superClass { constructor(...args: any[]) { super(...args); _instanceModifier(this, args); } } : TFunction & { new (...args: any[]): decoratorFunc; prototype: classExtender2.decoratorFunc; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>decoratorFunc : TFunction & { new (...args: any[]): decoratorFunc; prototype: classExtender2.decoratorFunc; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >superClass : MyClass > : ^^^^^^^ diff --git a/tests/baselines/reference/callOfConditionalTypeWithConcreteBranches.types b/tests/baselines/reference/callOfConditionalTypeWithConcreteBranches.types index 3be1ae27ff110..4120960b53043 100644 --- a/tests/baselines/reference/callOfConditionalTypeWithConcreteBranches.types +++ b/tests/baselines/reference/callOfConditionalTypeWithConcreteBranches.types @@ -99,15 +99,15 @@ function fn2(arg: Q2) { > : ^^^^ >arg : Q2 > : ^^^^^ ->arg => useT(arg) : (arg: T & number) => void +>arg => useT(arg) : (arg: number & T) => void > : ^^^^^^^^^^^^^^^^^^^^^^^^^ ->arg : T & number +>arg : number & T > : ^^^^^^^^^^ >useT(arg) : void > : ^^^^ >useT : (_arg: T) => void > : ^^^^^^^^^^^^^^^^^ ->arg : T & number +>arg : number & T > : ^^^^^^^^^^ } // Legal invocations are not problematic diff --git a/tests/baselines/reference/callbackTag2.types b/tests/baselines/reference/callbackTag2.types index 32b1fc74b1b9c..127deed2a4dee 100644 --- a/tests/baselines/reference/callbackTag2.types +++ b/tests/baselines/reference/callbackTag2.types @@ -62,13 +62,13 @@ var outside = n => n + 1; var noreturn = (barts, tidus, noctis) => "cecil" >noreturn : Final<{ fantasy: any; }, { heroes: any; }> > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->(barts, tidus, noctis) => "cecil" : (barts: { fantasy: any; }, tidus: { heroes: any; }, noctis: { heroes: any; } & { fantasy: any; }) => "cecil" | "zidane" +>(barts, tidus, noctis) => "cecil" : (barts: { fantasy: any; }, tidus: { heroes: any; }, noctis: { fantasy: any; } & { heroes: any; }) => "cecil" | "zidane" > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >barts : { fantasy: any; } > : ^^^^^^^^^^^^^^^^^ >tidus : { heroes: any; } > : ^^^^^^^^^^^^^^^^ ->noctis : { heroes: any; } & { fantasy: any; } +>noctis : { fantasy: any; } & { heroes: any; } > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >"cecil" : "cecil" > : ^^^^^^^ diff --git a/tests/baselines/reference/callsOnComplexSignatures.types b/tests/baselines/reference/callsOnComplexSignatures.types index c1d5944195f04..044ef7e221f70 100644 --- a/tests/baselines/reference/callsOnComplexSignatures.types +++ b/tests/baselines/reference/callsOnComplexSignatures.types @@ -1,9 +1,8 @@ //// [tests/cases/compiler/callsOnComplexSignatures.tsx] //// === Performance Stats === -Subtype cache: 100 / 100 (nearest 100) Assignability cache: 2,400 / 2,400 (nearest 100) -Type Count: 8,200 / 8,200 (nearest 100) +Type Count: 8,100 / 8,200 (nearest 100) Instantiation count: 92,500 / 92,500 (nearest 500) Symbol count: 68,000 / 68,000 (nearest 500) diff --git a/tests/baselines/reference/cannotIndexGenericWritingError.types b/tests/baselines/reference/cannotIndexGenericWritingError.types index 9e279af48c622..3c43257737bf3 100644 --- a/tests/baselines/reference/cannotIndexGenericWritingError.types +++ b/tests/baselines/reference/cannotIndexGenericWritingError.types @@ -25,7 +25,7 @@ function foo>(target: T, p: string | symb } function foo2(target: T, p: string | number) { ->foo2 : (target: T, p: string | number) => void +>foo2 : (target: T, p: string | number) => void > : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^ ^^^^^^^^^ >s : string > : ^^^^^^ diff --git a/tests/baselines/reference/checkJsxChildrenProperty5.errors.txt b/tests/baselines/reference/checkJsxChildrenProperty5.errors.txt index a33a925ab34e8..e7b496ab06093 100644 --- a/tests/baselines/reference/checkJsxChildrenProperty5.errors.txt +++ b/tests/baselines/reference/checkJsxChildrenProperty5.errors.txt @@ -34,7 +34,7 @@ file.tsx(29,10): error TS2740: Type 'typeof Button' is missing the following pro