Skip to content

Commit c4108b6

Browse files
authored
Cherry-pick PR #59170 to release-5.5 (#59212)
1 parent e809c04 commit c4108b6

File tree

262 files changed

+2670
-2355
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

262 files changed

+2670
-2355
lines changed

src/compiler/checker.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8310,11 +8310,9 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
83108310
const typePredicate = getTypePredicateOfSignature(signature);
83118311
const type = getReturnTypeOfSignature(signature);
83128312
if (context.enclosingDeclaration && (!isErrorType(type) || (context.flags & NodeBuilderFlags.AllowUnresolvedNames)) && signature.declaration && !nodeIsSynthesized(signature.declaration)) {
8313-
const annotation = signature.declaration && getNonlocalEffectiveReturnTypeAnnotationNode(signature.declaration);
8314-
// Default constructor signatures inherited from base classes return the derived class but have the base class declaration
8315-
// 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
8316-
if (annotation && getTypeFromTypeNode(context, annotation) === type) {
8317-
const result = tryReuseExistingTypeNodeHelper(context, annotation);
8313+
const annotation = getNonlocalEffectiveReturnTypeAnnotationNode(signature.declaration);
8314+
if (annotation) {
8315+
const result = tryReuseExistingTypeNode(context, annotation, type, context.enclosingDeclaration);
83188316
if (result) {
83198317
return result;
83208318
}

tests/baselines/reference/abstractClassUnionInstantiation.types

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ new cls3(); // should work
7575
>[ConcreteA, AbstractA, AbstractB].map(cls => new cls()) : any[]
7676
> : ^^^^^
7777
>[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[]
78-
> : ^ ^^ ^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^
78+
> : ^ ^^ ^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^
7979
>[ConcreteA, AbstractA, AbstractB] : (typeof ConcreteA | typeof AbstractA | typeof AbstractB)[]
8080
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
8181
>ConcreteA : typeof ConcreteA
@@ -85,7 +85,7 @@ new cls3(); // should work
8585
>AbstractB : typeof AbstractB
8686
> : ^^^^^^^^^^^^^^^^
8787
>map : <U>(callbackfn: (value: typeof ConcreteA | typeof AbstractA | typeof AbstractB, index: number, array: (typeof ConcreteA | typeof AbstractA | typeof AbstractB)[]) => U, thisArg?: any) => U[]
88-
> : ^ ^^ ^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^
88+
> : ^ ^^ ^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^
8989
>cls => new cls() : (cls: typeof ConcreteA | typeof AbstractA | typeof AbstractB) => any
9090
> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
9191
>cls : typeof ConcreteA | typeof AbstractA | typeof AbstractB
@@ -99,7 +99,7 @@ new cls3(); // should work
9999
>[AbstractA, AbstractB, ConcreteA].map(cls => new cls()) : any[]
100100
> : ^^^^^
101101
>[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[]
102-
> : ^ ^^ ^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^
102+
> : ^ ^^ ^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^
103103
>[AbstractA, AbstractB, ConcreteA] : (typeof ConcreteA | typeof AbstractA | typeof AbstractB)[]
104104
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
105105
>AbstractA : typeof AbstractA
@@ -109,7 +109,7 @@ new cls3(); // should work
109109
>ConcreteA : typeof ConcreteA
110110
> : ^^^^^^^^^^^^^^^^
111111
>map : <U>(callbackfn: (value: typeof ConcreteA | typeof AbstractA | typeof AbstractB, index: number, array: (typeof ConcreteA | typeof AbstractA | typeof AbstractB)[]) => U, thisArg?: any) => U[]
112-
> : ^ ^^ ^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^
112+
> : ^ ^^ ^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^
113113
>cls => new cls() : (cls: typeof ConcreteA | typeof AbstractA | typeof AbstractB) => any
114114
> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
115115
>cls : typeof ConcreteA | typeof AbstractA | typeof AbstractB
@@ -123,15 +123,15 @@ new cls3(); // should work
123123
>[ConcreteA, ConcreteB].map(cls => new cls()) : ConcreteA[]
124124
> : ^^^^^^^^^^^
125125
>[ConcreteA, ConcreteB].map : <U>(callbackfn: (value: typeof ConcreteA, index: number, array: (typeof ConcreteA)[]) => U, thisArg?: any) => U[]
126-
> : ^ ^^ ^^^ ^^^^^^^^^^^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^
126+
> : ^ ^^ ^^^ ^^^^^^^^^^^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^
127127
>[ConcreteA, ConcreteB] : (typeof ConcreteA)[]
128128
> : ^^^^^^^^^^^^^^^^^^^^
129129
>ConcreteA : typeof ConcreteA
130130
> : ^^^^^^^^^^^^^^^^
131131
>ConcreteB : typeof ConcreteB
132132
> : ^^^^^^^^^^^^^^^^
133133
>map : <U>(callbackfn: (value: typeof ConcreteA, index: number, array: (typeof ConcreteA)[]) => U, thisArg?: any) => U[]
134-
> : ^ ^^ ^^^ ^^^^^^^^^^^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^
134+
> : ^ ^^ ^^^ ^^^^^^^^^^^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^
135135
>cls => new cls() : (cls: typeof ConcreteA) => ConcreteA
136136
> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
137137
>cls : typeof ConcreteA
@@ -145,15 +145,15 @@ new cls3(); // should work
145145
>[AbstractA, AbstractB].map(cls => new cls()) : any[]
146146
> : ^^^^^
147147
>[AbstractA, AbstractB].map : <U>(callbackfn: (value: typeof AbstractA | typeof AbstractB, index: number, array: (typeof AbstractA | typeof AbstractB)[]) => U, thisArg?: any) => U[]
148-
> : ^ ^^ ^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^
148+
> : ^ ^^ ^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^
149149
>[AbstractA, AbstractB] : (typeof AbstractA | typeof AbstractB)[]
150150
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
151151
>AbstractA : typeof AbstractA
152152
> : ^^^^^^^^^^^^^^^^
153153
>AbstractB : typeof AbstractB
154154
> : ^^^^^^^^^^^^^^^^
155155
>map : <U>(callbackfn: (value: typeof AbstractA | typeof AbstractB, index: number, array: (typeof AbstractA | typeof AbstractB)[]) => U, thisArg?: any) => U[]
156-
> : ^ ^^ ^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^
156+
> : ^ ^^ ^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^
157157
>cls => new cls() : (cls: typeof AbstractA | typeof AbstractB) => any
158158
> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
159159
>cls : typeof AbstractA | typeof AbstractB

tests/baselines/reference/acceptSymbolAsWeakType.types

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,11 @@ wm.get(s);
105105
>wm.get(s) : boolean | undefined
106106
> : ^^^^^^^^^^^^^^^^^^^
107107
>wm.get : (key: symbol) => boolean | undefined
108-
> : ^ ^^^^^^^^^^^^^^^^^^^^
108+
> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
109109
>wm : WeakMap<symbol, boolean>
110110
> : ^^^^^^^^^^^^^^^^^^^^^^^^
111111
>get : (key: symbol) => boolean | undefined
112-
> : ^ ^^^^^^^^^^^^^^^^^^^^
112+
> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
113113
>s : symbol
114114
> : ^^^^^^
115115

@@ -139,11 +139,11 @@ wr.deref();
139139
>wr.deref() : symbol | undefined
140140
> : ^^^^^^^^^^^^^^^^^^
141141
>wr.deref : () => symbol | undefined
142-
> : ^^^^^^^^^^^^
142+
> : ^^^^^^^^^^^^^^^^^^^^^^^^
143143
>wr : WeakRef<symbol>
144144
> : ^^^^^^^^^^^^^^^
145145
>deref : () => symbol | undefined
146-
> : ^^^^^^^^^^^^
146+
> : ^^^^^^^^^^^^^^^^^^^^^^^^
147147

148148
const f = new FinalizationRegistry(() => {});
149149
>f : FinalizationRegistry<unknown>

tests/baselines/reference/accessorsOverrideProperty8.types

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ declare function classWithProperties<T extends { [key: string]: Types }, P exten
3939

4040
const Base = classWithProperties({
4141
>Base : { new (): Base & Properties<{ readonly x: "boolean"; y: "string"; }>; prototype: Base & Properties<{ readonly x: "boolean"; y: "string"; }>; }
42-
> : ^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
42+
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4343
>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"; }>; }
44-
> : ^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
44+
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4545
>classWithProperties : <T extends { [key: string]: Types; }, P extends object>(properties: T, klass: AnyCtor<P>) => { new (): P & Properties<T>; prototype: P & Properties<T>; }
4646
> : ^ ^^^^^^^^^ ^^ ^^^^^^^^^ ^^ ^^ ^^ ^^ ^^^^^
4747
>{ get x() { return 'boolean' as const }, y: 'string',} : { readonly x: "boolean"; y: "string"; }

tests/baselines/reference/amdLikeInputDeclarationEmit.types

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ define("lib/ExtendedClass", ["deps/BaseClass"],
5757

5858
const ExtendedClass = BaseClass.extends({
5959
>ExtendedClass : new () => { f: () => "something"; } & import("deps/BaseClass")
60-
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^
60+
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6161
>BaseClass.extends({ f: function() { return "something"; } }) : new () => { f: () => "something"; } & import("deps/BaseClass")
62-
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^
62+
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6363
>BaseClass.extends : <A>(a: A) => new () => A & import("deps/BaseClass")
6464
> : ^ ^^ ^^ ^^^^^ ^^^^^^^^^^^^^^^^
6565
>BaseClass : typeof import("deps/BaseClass")
@@ -96,7 +96,7 @@ define("lib/ExtendedClass", ["deps/BaseClass"],
9696
>exports : any
9797
> : ^^^
9898
>ExtendedClass : new () => { f: () => "something"; } & import("deps/BaseClass")
99-
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^
99+
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
100100

101101
return module.exports;
102102
>module.exports : any

tests/baselines/reference/anyInferenceAnonymousFunctions.types

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,11 @@ paired.map((c1) => c1.count);
8686
>paired.map((c1) => c1.count) : any[]
8787
> : ^^^^^
8888
>paired.map : <U>(callbackfn: (value: any, index: number, array: any[]) => U, thisArg?: any) => U[]
89-
> : ^ ^^ ^^^ ^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^ ^^^ ^^^^^^
89+
> : ^ ^^ ^^^ ^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^
9090
>paired : any[]
9191
> : ^^^^^
9292
>map : <U>(callbackfn: (value: any, index: number, array: any[]) => U, thisArg?: any) => U[]
93-
> : ^ ^^ ^^^ ^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^ ^^^ ^^^^^^
93+
> : ^ ^^ ^^^ ^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^
9494
>(c1) => c1.count : (c1: any) => any
9595
> : ^ ^^^^^^^^^^^^^
9696
>c1 : any
@@ -104,11 +104,11 @@ paired.map(function (c2) { return c2.count; });
104104
>paired.map(function (c2) { return c2.count; }) : any[]
105105
> : ^^^^^
106106
>paired.map : <U>(callbackfn: (value: any, index: number, array: any[]) => U, thisArg?: any) => U[]
107-
> : ^ ^^ ^^^ ^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^ ^^^ ^^^^^^
107+
> : ^ ^^ ^^^ ^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^
108108
>paired : any[]
109109
> : ^^^^^
110110
>map : <U>(callbackfn: (value: any, index: number, array: any[]) => U, thisArg?: any) => U[]
111-
> : ^ ^^ ^^^ ^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^ ^^^ ^^^^^^
111+
> : ^ ^^ ^^^ ^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^
112112
>function (c2) { return c2.count; } : (c2: any) => any
113113
> : ^ ^^^^^^^^^^^^^
114114
>c2 : any

tests/baselines/reference/arrayAugment.types

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ var y = x.split(4);
2323
>x.split(4) : string[][]
2424
> : ^^^^^^^^^^
2525
>x.split : (parts: number) => string[][]
26-
> : ^ ^^ ^^^^^^^^^^^
26+
> : ^ ^^ ^^^^^^^^^^^^^^^
2727
>x : string[]
2828
> : ^^^^^^^^
2929
>split : (parts: number) => string[][]
30-
> : ^ ^^ ^^^^^^^^^^^
30+
> : ^ ^^ ^^^^^^^^^^^^^^^
3131
>4 : 4
3232
> : ^
3333

tests/baselines/reference/arrayConcat2.types

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ a.concat("hello", 'world');
1111
>a.concat("hello", 'world') : string[]
1212
> : ^^^^^^^^
1313
>a.concat : { (...items: ConcatArray<string>[]): string[]; (...items: (string | ConcatArray<string>)[]): string[]; }
14-
> : ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^
14+
> : ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1515
>a : string[]
1616
> : ^^^^^^^^
1717
>concat : { (...items: ConcatArray<string>[]): string[]; (...items: (string | ConcatArray<string>)[]): string[]; }
18-
> : ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^
18+
> : ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1919
>"hello" : "hello"
2020
> : ^^^^^^^
2121
>'world' : "world"
@@ -25,11 +25,11 @@ a.concat('Hello');
2525
>a.concat('Hello') : string[]
2626
> : ^^^^^^^^
2727
>a.concat : { (...items: ConcatArray<string>[]): string[]; (...items: (string | ConcatArray<string>)[]): string[]; }
28-
> : ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^
28+
> : ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2929
>a : string[]
3030
> : ^^^^^^^^
3131
>concat : { (...items: ConcatArray<string>[]): string[]; (...items: (string | ConcatArray<string>)[]): string[]; }
32-
> : ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^
32+
> : ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3333
>'Hello' : "Hello"
3434
> : ^^^^^^^
3535

@@ -45,11 +45,11 @@ b.concat('hello');
4545
>b.concat('hello') : string[]
4646
> : ^^^^^^^^
4747
>b.concat : { (...items: ConcatArray<string>[]): string[]; (...items: (string | ConcatArray<string>)[]): string[]; }
48-
> : ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^
48+
> : ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4949
>b : string[]
5050
> : ^^^^^^^^
5151
>concat : { (...items: ConcatArray<string>[]): string[]; (...items: (string | ConcatArray<string>)[]): string[]; }
52-
> : ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^
52+
> : ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
5353
>'hello' : "hello"
5454
> : ^^^^^^^
5555

tests/baselines/reference/arrayConcat3.types

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ function doStuff<T extends object, T1 extends T>(a: Array<Fn<T>>, b: Array<Fn<T1
2020
>b.concat(a) : Fn<T1>[]
2121
> : ^^^^^^^^
2222
>b.concat : { (...items: ConcatArray<Fn<T1>>[]): Fn<T1>[]; (...items: (Fn<T1> | ConcatArray<Fn<T1>>)[]): Fn<T1>[]; }
23-
> : ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^
23+
> : ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2424
>b : Fn<T1>[]
2525
> : ^^^^^^^^
2626
>concat : { (...items: ConcatArray<Fn<T1>>[]): Fn<T1>[]; (...items: (Fn<T1> | ConcatArray<Fn<T1>>)[]): Fn<T1>[]; }
27-
> : ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^
27+
> : ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2828
>a : Fn<T>[]
2929
> : ^^^^^^^
3030
}

tests/baselines/reference/arrayConcatMap.types

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ var x = [].concat([{ a: 1 }], [{ a: 2 }])
77
>[].concat([{ a: 1 }], [{ a: 2 }]) .map(b => b.a) : any[]
88
> : ^^^^^
99
>[].concat([{ a: 1 }], [{ a: 2 }]) .map : <U>(callbackfn: (value: any, index: number, array: any[]) => U, thisArg?: any) => U[]
10-
> : ^ ^^ ^^^ ^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^ ^^^ ^^^^^^
10+
> : ^ ^^ ^^^ ^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^
1111
>[].concat([{ a: 1 }], [{ a: 2 }]) : any[]
1212
> : ^^^^^
1313
>[].concat : { (...items: ConcatArray<any>[]): any[]; (...items: any[]): any[]; }
14-
> : ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^ ^^^^^^^^^^^^^ ^^^
14+
> : ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^
1515
>[] : undefined[]
1616
> : ^^^^^^^^^^^
1717
>concat : { (...items: ConcatArray<any>[]): any[]; (...items: any[]): any[]; }
18-
> : ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^ ^^^^^^^^^^^^^ ^^^
18+
> : ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^
1919
>[{ a: 1 }] : { a: number; }[]
2020
> : ^^^^^^^^^^^^^^^^
2121
>{ a: 1 } : { a: number; }
@@ -35,7 +35,7 @@ var x = [].concat([{ a: 1 }], [{ a: 2 }])
3535

3636
.map(b => b.a);
3737
>map : <U>(callbackfn: (value: any, index: number, array: any[]) => U, thisArg?: any) => U[]
38-
> : ^ ^^ ^^^ ^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^ ^^^ ^^^^^^
38+
> : ^ ^^ ^^^ ^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^
3939
>b => b.a : (b: any) => any
4040
> : ^ ^^^^^^^^^^^^^
4141
>b : any

0 commit comments

Comments
 (0)