Skip to content

Consider enclosing declaration when serializing inferred return types #59170

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions src/compiler/checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8322,11 +8322,9 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
const typePredicate = getTypePredicateOfSignature(signature);
const type = getReturnTypeOfSignature(signature);
if (context.enclosingDeclaration && (!isErrorType(type) || (context.flags & NodeBuilderFlags.AllowUnresolvedNames)) && signature.declaration && !nodeIsSynthesized(signature.declaration)) {
const annotation = signature.declaration && getNonlocalEffectiveReturnTypeAnnotationNode(signature.declaration);
// Default constructor signatures inherited from base classes return the derived class but have the base class declaration
// To ensure we don't serialize the wrong type we check that that return type of the signature corresponds to the declaration return type signature
if (annotation && getTypeFromTypeNode(context, annotation) === type) {
const result = tryReuseExistingTypeNodeHelper(context, annotation);
const annotation = getNonlocalEffectiveReturnTypeAnnotationNode(signature.declaration);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we sure removing this check getTypeFromTypeNode(context, annotation) === type is a good idea? I think there are cases where the type of the annotation might differ from the type of the signature.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's what tryReuseExistingTypeNode does internally and is how it differs from tryReuseExistingTypeNodeHelper

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right; removing this didn't change anything except reducing some type instantiations. Sorry, I rebased that particular thing away because I felt pretty confident that I could remove the equality here.

if (annotation) {
const result = tryReuseExistingTypeNode(context, annotation, type, context.enclosingDeclaration);
if (result) {
return result;
}
Expand Down
16 changes: 8 additions & 8 deletions tests/baselines/reference/abstractClassUnionInstantiation.types
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ new cls3(); // should work
>[ConcreteA, AbstractA, AbstractB].map(cls => new cls()) : any[]
> : ^^^^^
>[ConcreteA, AbstractA, AbstractB].map : <U>(callbackfn: (value: typeof ConcreteA | typeof AbstractA | typeof AbstractB, index: number, array: (typeof ConcreteA | typeof AbstractA | typeof AbstractB)[]) => U, thisArg?: any) => U[]
> : ^ ^^ ^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^
> : ^ ^^ ^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^
>[ConcreteA, AbstractA, AbstractB] : (typeof ConcreteA | typeof AbstractA | typeof AbstractB)[]
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>ConcreteA : typeof ConcreteA
Expand All @@ -85,7 +85,7 @@ new cls3(); // should work
>AbstractB : typeof AbstractB
> : ^^^^^^^^^^^^^^^^
>map : <U>(callbackfn: (value: typeof ConcreteA | typeof AbstractA | typeof AbstractB, index: number, array: (typeof ConcreteA | typeof AbstractA | typeof AbstractB)[]) => U, thisArg?: any) => U[]
> : ^ ^^ ^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^
> : ^ ^^ ^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^
>cls => new cls() : (cls: typeof ConcreteA | typeof AbstractA | typeof AbstractB) => any
> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>cls : typeof ConcreteA | typeof AbstractA | typeof AbstractB
Expand All @@ -99,7 +99,7 @@ new cls3(); // should work
>[AbstractA, AbstractB, ConcreteA].map(cls => new cls()) : any[]
> : ^^^^^
>[AbstractA, AbstractB, ConcreteA].map : <U>(callbackfn: (value: typeof ConcreteA | typeof AbstractA | typeof AbstractB, index: number, array: (typeof ConcreteA | typeof AbstractA | typeof AbstractB)[]) => U, thisArg?: any) => U[]
> : ^ ^^ ^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^
> : ^ ^^ ^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^
>[AbstractA, AbstractB, ConcreteA] : (typeof ConcreteA | typeof AbstractA | typeof AbstractB)[]
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>AbstractA : typeof AbstractA
Expand All @@ -109,7 +109,7 @@ new cls3(); // should work
>ConcreteA : typeof ConcreteA
> : ^^^^^^^^^^^^^^^^
>map : <U>(callbackfn: (value: typeof ConcreteA | typeof AbstractA | typeof AbstractB, index: number, array: (typeof ConcreteA | typeof AbstractA | typeof AbstractB)[]) => U, thisArg?: any) => U[]
> : ^ ^^ ^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^
> : ^ ^^ ^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^
>cls => new cls() : (cls: typeof ConcreteA | typeof AbstractA | typeof AbstractB) => any
> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>cls : typeof ConcreteA | typeof AbstractA | typeof AbstractB
Expand All @@ -123,15 +123,15 @@ new cls3(); // should work
>[ConcreteA, ConcreteB].map(cls => new cls()) : ConcreteA[]
> : ^^^^^^^^^^^
>[ConcreteA, ConcreteB].map : <U>(callbackfn: (value: typeof ConcreteA, index: number, array: (typeof ConcreteA)[]) => U, thisArg?: any) => U[]
> : ^ ^^ ^^^ ^^^^^^^^^^^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^
> : ^ ^^ ^^^ ^^^^^^^^^^^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^
>[ConcreteA, ConcreteB] : (typeof ConcreteA)[]
> : ^^^^^^^^^^^^^^^^^^^^
>ConcreteA : typeof ConcreteA
> : ^^^^^^^^^^^^^^^^
>ConcreteB : typeof ConcreteB
> : ^^^^^^^^^^^^^^^^
>map : <U>(callbackfn: (value: typeof ConcreteA, index: number, array: (typeof ConcreteA)[]) => U, thisArg?: any) => U[]
> : ^ ^^ ^^^ ^^^^^^^^^^^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^
> : ^ ^^ ^^^ ^^^^^^^^^^^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^
>cls => new cls() : (cls: typeof ConcreteA) => ConcreteA
> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>cls : typeof ConcreteA
Expand All @@ -145,15 +145,15 @@ new cls3(); // should work
>[AbstractA, AbstractB].map(cls => new cls()) : any[]
> : ^^^^^
>[AbstractA, AbstractB].map : <U>(callbackfn: (value: typeof AbstractA | typeof AbstractB, index: number, array: (typeof AbstractA | typeof AbstractB)[]) => U, thisArg?: any) => U[]
> : ^ ^^ ^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^
> : ^ ^^ ^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^
>[AbstractA, AbstractB] : (typeof AbstractA | typeof AbstractB)[]
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>AbstractA : typeof AbstractA
> : ^^^^^^^^^^^^^^^^
>AbstractB : typeof AbstractB
> : ^^^^^^^^^^^^^^^^
>map : <U>(callbackfn: (value: typeof AbstractA | typeof AbstractB, index: number, array: (typeof AbstractA | typeof AbstractB)[]) => U, thisArg?: any) => U[]
> : ^ ^^ ^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^
> : ^ ^^ ^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^
>cls => new cls() : (cls: typeof AbstractA | typeof AbstractB) => any
> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>cls : typeof AbstractA | typeof AbstractB
Expand Down
8 changes: 4 additions & 4 deletions tests/baselines/reference/acceptSymbolAsWeakType.types
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,11 @@ wm.get(s);
>wm.get(s) : boolean | undefined
> : ^^^^^^^^^^^^^^^^^^^
>wm.get : (key: symbol) => boolean | undefined
> : ^ ^^^^^^^^^^^^^^^^^^^^
> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>wm : WeakMap<symbol, boolean>
> : ^^^^^^^^^^^^^^^^^^^^^^^^
>get : (key: symbol) => boolean | undefined
> : ^ ^^^^^^^^^^^^^^^^^^^^
> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>s : symbol
> : ^^^^^^

Expand Down Expand Up @@ -139,11 +139,11 @@ wr.deref();
>wr.deref() : symbol | undefined
> : ^^^^^^^^^^^^^^^^^^
>wr.deref : () => symbol | undefined
> : ^^^^^^^^^^^^
> : ^^^^^^^^^^^^^^^^^^^^^^^^
>wr : WeakRef<symbol>
> : ^^^^^^^^^^^^^^^
>deref : () => symbol | undefined
> : ^^^^^^^^^^^^
> : ^^^^^^^^^^^^^^^^^^^^^^^^

const f = new FinalizationRegistry(() => {});
>f : FinalizationRegistry<unknown>
Expand Down
4 changes: 2 additions & 2 deletions tests/baselines/reference/accessorsOverrideProperty8.types
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ declare function classWithProperties<T extends { [key: string]: Types }, P exten

const Base = classWithProperties({
>Base : { new (): Base & Properties<{ readonly x: "boolean"; y: "string"; }>; prototype: Base & Properties<{ readonly x: "boolean"; y: "string"; }>; }
> : ^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>classWithProperties({ get x() { return 'boolean' as const }, y: 'string',}, class Base {}) : { new (): Base & Properties<{ readonly x: "boolean"; y: "string"; }>; prototype: Base & Properties<{ readonly x: "boolean"; y: "string"; }>; }
> : ^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>classWithProperties : <T extends { [key: string]: Types; }, P extends object>(properties: T, klass: AnyCtor<P>) => { new (): P & Properties<T>; prototype: P & Properties<T>; }
> : ^ ^^^^^^^^^ ^^ ^^^^^^^^^ ^^ ^^ ^^ ^^ ^^^^^
>{ get x() { return 'boolean' as const }, y: 'string',} : { readonly x: "boolean"; y: "string"; }
Expand Down
6 changes: 3 additions & 3 deletions tests/baselines/reference/amdLikeInputDeclarationEmit.types
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ define("lib/ExtendedClass", ["deps/BaseClass"],

const ExtendedClass = BaseClass.extends({
>ExtendedClass : new () => { f: () => "something"; } & import("deps/BaseClass")
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>BaseClass.extends({ f: function() { return "something"; } }) : new () => { f: () => "something"; } & import("deps/BaseClass")
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>BaseClass.extends : <A>(a: A) => new () => A & import("deps/BaseClass")
> : ^ ^^ ^^ ^^^^^ ^^^^^^^^^^^^^^^^
>BaseClass : typeof import("deps/BaseClass")
Expand Down Expand Up @@ -96,7 +96,7 @@ define("lib/ExtendedClass", ["deps/BaseClass"],
>exports : any
> : ^^^
>ExtendedClass : new () => { f: () => "something"; } & import("deps/BaseClass")
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

return module.exports;
>module.exports : any
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,11 @@ paired.map((c1) => c1.count);
>paired.map((c1) => c1.count) : any[]
> : ^^^^^
>paired.map : <U>(callbackfn: (value: any, index: number, array: any[]) => U, thisArg?: any) => U[]
> : ^ ^^ ^^^ ^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^ ^^^ ^^^^^^
> : ^ ^^ ^^^ ^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^
>paired : any[]
> : ^^^^^
>map : <U>(callbackfn: (value: any, index: number, array: any[]) => U, thisArg?: any) => U[]
> : ^ ^^ ^^^ ^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^ ^^^ ^^^^^^
> : ^ ^^ ^^^ ^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^
>(c1) => c1.count : (c1: any) => any
> : ^ ^^^^^^^^^^^^^
>c1 : any
Expand All @@ -104,11 +104,11 @@ paired.map(function (c2) { return c2.count; });
>paired.map(function (c2) { return c2.count; }) : any[]
> : ^^^^^
>paired.map : <U>(callbackfn: (value: any, index: number, array: any[]) => U, thisArg?: any) => U[]
> : ^ ^^ ^^^ ^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^ ^^^ ^^^^^^
> : ^ ^^ ^^^ ^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^
>paired : any[]
> : ^^^^^
>map : <U>(callbackfn: (value: any, index: number, array: any[]) => U, thisArg?: any) => U[]
> : ^ ^^ ^^^ ^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^ ^^^ ^^^^^^
> : ^ ^^ ^^^ ^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^
>function (c2) { return c2.count; } : (c2: any) => any
> : ^ ^^^^^^^^^^^^^
>c2 : any
Expand Down
4 changes: 2 additions & 2 deletions tests/baselines/reference/arrayAugment.types
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ var y = x.split(4);
>x.split(4) : string[][]
> : ^^^^^^^^^^
>x.split : (parts: number) => string[][]
> : ^ ^^ ^^^^^^^^^^^
> : ^ ^^ ^^^^^^^^^^^^^^^
>x : string[]
> : ^^^^^^^^
>split : (parts: number) => string[][]
> : ^ ^^ ^^^^^^^^^^^
> : ^ ^^ ^^^^^^^^^^^^^^^
>4 : 4
> : ^

Expand Down
12 changes: 6 additions & 6 deletions tests/baselines/reference/arrayConcat2.types
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ a.concat("hello", 'world');
>a.concat("hello", 'world') : string[]
> : ^^^^^^^^
>a.concat : { (...items: ConcatArray<string>[]): string[]; (...items: (string | ConcatArray<string>)[]): string[]; }
> : ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^
> : ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>a : string[]
> : ^^^^^^^^
>concat : { (...items: ConcatArray<string>[]): string[]; (...items: (string | ConcatArray<string>)[]): string[]; }
> : ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^
> : ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>"hello" : "hello"
> : ^^^^^^^
>'world' : "world"
Expand All @@ -25,11 +25,11 @@ a.concat('Hello');
>a.concat('Hello') : string[]
> : ^^^^^^^^
>a.concat : { (...items: ConcatArray<string>[]): string[]; (...items: (string | ConcatArray<string>)[]): string[]; }
> : ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^
> : ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>a : string[]
> : ^^^^^^^^
>concat : { (...items: ConcatArray<string>[]): string[]; (...items: (string | ConcatArray<string>)[]): string[]; }
> : ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^
> : ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>'Hello' : "Hello"
> : ^^^^^^^

Expand All @@ -45,11 +45,11 @@ b.concat('hello');
>b.concat('hello') : string[]
> : ^^^^^^^^
>b.concat : { (...items: ConcatArray<string>[]): string[]; (...items: (string | ConcatArray<string>)[]): string[]; }
> : ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^
> : ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>b : string[]
> : ^^^^^^^^
>concat : { (...items: ConcatArray<string>[]): string[]; (...items: (string | ConcatArray<string>)[]): string[]; }
> : ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^
> : ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>'hello' : "hello"
> : ^^^^^^^

4 changes: 2 additions & 2 deletions tests/baselines/reference/arrayConcat3.types
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ function doStuff<T extends object, T1 extends T>(a: Array<Fn<T>>, b: Array<Fn<T1
>b.concat(a) : Fn<T1>[]
> : ^^^^^^^^
>b.concat : { (...items: ConcatArray<Fn<T1>>[]): Fn<T1>[]; (...items: (Fn<T1> | ConcatArray<Fn<T1>>)[]): Fn<T1>[]; }
> : ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^
> : ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>b : Fn<T1>[]
> : ^^^^^^^^
>concat : { (...items: ConcatArray<Fn<T1>>[]): Fn<T1>[]; (...items: (Fn<T1> | ConcatArray<Fn<T1>>)[]): Fn<T1>[]; }
> : ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^
> : ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>a : Fn<T>[]
> : ^^^^^^^
}
Expand Down
8 changes: 4 additions & 4 deletions tests/baselines/reference/arrayConcatMap.types
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ var x = [].concat([{ a: 1 }], [{ a: 2 }])
>[].concat([{ a: 1 }], [{ a: 2 }]) .map(b => b.a) : any[]
> : ^^^^^
>[].concat([{ a: 1 }], [{ a: 2 }]) .map : <U>(callbackfn: (value: any, index: number, array: any[]) => U, thisArg?: any) => U[]
> : ^ ^^ ^^^ ^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^ ^^^ ^^^^^^
> : ^ ^^ ^^^ ^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^
>[].concat([{ a: 1 }], [{ a: 2 }]) : any[]
> : ^^^^^
>[].concat : { (...items: ConcatArray<any>[]): any[]; (...items: any[]): any[]; }
> : ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^ ^^^^^^^^^^^^^ ^^^
> : ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^
>[] : undefined[]
> : ^^^^^^^^^^^
>concat : { (...items: ConcatArray<any>[]): any[]; (...items: any[]): any[]; }
> : ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^ ^^^^^^^^^^^^^ ^^^
> : ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^
>[{ a: 1 }] : { a: number; }[]
> : ^^^^^^^^^^^^^^^^
>{ a: 1 } : { a: number; }
Expand All @@ -35,7 +35,7 @@ var x = [].concat([{ a: 1 }], [{ a: 2 }])

.map(b => b.a);
>map : <U>(callbackfn: (value: any, index: number, array: any[]) => U, thisArg?: any) => U[]
> : ^ ^^ ^^^ ^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^ ^^^ ^^^^^^
> : ^ ^^ ^^^ ^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^
>b => b.a : (b: any) => any
> : ^ ^^^^^^^^^^^^^
>b : any
Expand Down
Loading