Skip to content

Commit 79a8514

Browse files
authored
Attempt to reuse type parameter constraint nodes (#58539)
1 parent e8274f7 commit 79a8514

File tree

705 files changed

+4654
-4609
lines changed

Some content is hidden

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

705 files changed

+4654
-4609
lines changed

src/compiler/checker.ts

+9-2
Original file line numberDiff line numberDiff line change
@@ -7459,8 +7459,12 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
74597459
return factory.createTypeParameterDeclaration(modifiers, name, constraintNode, defaultParameterNode);
74607460
}
74617461

7462+
function typeToTypeNodeHelperWithPossibleReusableTypeNode(type: Type, typeNode: TypeNode | undefined, context: NodeBuilderContext) {
7463+
return typeNode && tryReuseExistingNonParameterTypeNode(context, typeNode, type) || typeToTypeNodeHelper(type, context);
7464+
}
7465+
74627466
function typeParameterToDeclaration(type: TypeParameter, context: NodeBuilderContext, constraint = getConstraintOfTypeParameter(type)): TypeParameterDeclaration {
7463-
const constraintNode = constraint && typeToTypeNodeHelper(constraint, context);
7467+
const constraintNode = constraint && typeToTypeNodeHelperWithPossibleReusableTypeNode(constraint, getConstraintDeclaration(type), context);
74647468
return typeParameterToDeclarationWithConstraint(type, context, constraintNode);
74657469
}
74667470

@@ -8274,7 +8278,6 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
82748278
sym = resolveEntityName(leftmost, meaning, /*ignoreErrors*/ true, /*dontResolveAlias*/ true);
82758279
if (
82768280
context.enclosingDeclaration &&
8277-
(getNodeLinks(context.enclosingDeclaration).fakeScopeForSignatureDeclaration || !findAncestor(node, n => n === context.enclosingDeclaration)) &&
82788281
!(sym && sym.flags & SymbolFlags.TypeParameter)
82798282
) {
82808283
sym = getExportSymbolOfValueSymbolIfExported(sym);
@@ -8431,6 +8434,10 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
84318434
}
84328435

84338436
function visitExistingNodeTreeSymbolsWorker(node: Node): Node | undefined {
8437+
if (isJSDocTypeExpression(node)) {
8438+
// Unwrap JSDocTypeExpressions
8439+
return visitNode(node.type, visitExistingNodeTreeSymbols, isTypeNode);
8440+
}
84348441
// We don't _actually_ support jsdoc namepath types, emit `any` instead
84358442
if (isJSDocAllType(node) || node.kind === SyntaxKind.JSDocNamepathType) {
84368443
return factory.createKeywordTypeNode(SyntaxKind.AnyKeyword);

tests/baselines/reference/1.0lib-noErrors.types

+2-2
Original file line numberDiff line numberDiff line change
@@ -2081,7 +2081,7 @@ interface Array<T> {
20812081
*/
20822082
concat<U extends T[]>(...items: U[]): T[];
20832083
>concat : { <U extends T[]>(...items: U[]): T[]; (...items: T[]): T[]; }
2084-
> : ^^^ ^^^^^^^^^^^^^^^^^ ^^ ^^^ ^^^^^^ ^^ ^^^^^^^^^
2084+
> : ^^^ ^^^^^^^^^ ^^^^^ ^^ ^^^ ^^^^^^ ^^ ^^^^^^^^^
20852085
>items : U[]
20862086
> : ^^^
20872087

@@ -2091,7 +2091,7 @@ interface Array<T> {
20912091
*/
20922092
concat(...items: T[]): T[];
20932093
>concat : { <U extends T[]>(...items: U[]): T[]; (...items: T[]): T[]; }
2094-
> : ^^^ ^^^^^^^^^^^^^^^^^ ^^ ^^^^^^^^^^^^ ^^ ^^^ ^^^
2094+
> : ^^^ ^^^^^^^^^ ^^^^^ ^^ ^^^^^^^^^^^^ ^^ ^^^ ^^^
20952095
>items : T[]
20962096
> : ^^^
20972097

tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedAndNonExportedLocalVarsOfTheSameName.types

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ module A {
2121

2222
export function mirror<T extends Point>(p: T) {
2323
>mirror : <T extends Point>(p: T) => { x: number; y: number; }
24-
> : ^ ^^^^^^^^^^^^^^^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
24+
> : ^ ^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2525
>p : T
2626
> : ^
2727

tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedLocalVarsOfTheSameName.types

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export module A {
2121

2222
export function mirror<T extends Point>(p: T) {
2323
>mirror : <T extends Point>(p: T) => { x: number; y: number; }
24-
> : ^ ^^^^^^^^^^^^^^^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
24+
> : ^ ^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2525
>p : T
2626
> : ^
2727

tests/baselines/reference/TwoInternalModulesWithTheSameNameAndDifferentCommonRoot.types

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ module Root {
2525

2626
export function mirror<T extends Point>(p: T) {
2727
>mirror : <T extends Point>(p: T) => { x: number; y: number; }
28-
> : ^ ^^^^^^^^^^^^^^^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
28+
> : ^ ^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2929
>p : T
3030
> : ^
3131

tests/baselines/reference/TwoInternalModulesWithTheSameNameAndSameCommonRoot.types

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ module A {
2121

2222
export function mirror<T extends Point>(p: T) {
2323
>mirror : <T extends Point>(p: T) => { x: number; y: number; }
24-
> : ^ ^^^^^^^^^^^^^^^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
24+
> : ^ ^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2525
>p : T
2626
> : ^
2727

tests/baselines/reference/accessorsOverrideProperty8.types

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ type AnyCtor<P extends object> = new (...a: any[]) => P
2222

2323
declare function classWithProperties<T extends { [key: string]: Types }, P extends object>(properties: T, klass: AnyCtor<P>): {
2424
>classWithProperties : <T extends { [key: string]: Types; }, P extends object>(properties: T, klass: AnyCtor<P>) => { new (): P & Properties<T>; prototype: P & Properties<T>; }
25-
> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^ ^^ ^^ ^^ ^^^^^
25+
> : ^ ^^^^^^^^^ ^^ ^^^^^^^^^ ^^ ^^ ^^ ^^ ^^^^^
2626
>key : string
2727
> : ^^^^^^
2828
>properties : T
@@ -43,7 +43,7 @@ const Base = classWithProperties({
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"; }>; }
4444
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4545
>classWithProperties : <T extends { [key: string]: Types; }, P extends object>(properties: T, klass: AnyCtor<P>) => { new (): P & Properties<T>; prototype: P & Properties<T>; }
46-
> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^ ^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
46+
> : ^ ^^^^^^^^^ ^^ ^^^^^^^^^ ^^ ^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4747
>{ get x() { return 'boolean' as const }, y: 'string',} : { readonly x: "boolean"; y: "string"; }
4848
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4949

tests/baselines/reference/accessorsOverrideProperty9.types

+2-2
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ interface ApiItemContainerMixin extends ApiItem {
5050

5151
function ApiItemContainerMixin<TBaseClass extends IApiItemConstructor>(
5252
>ApiItemContainerMixin : <TBaseClass extends IApiItemConstructor>(baseClass: TBaseClass) => TBaseClass & (new (...args: any[]) => ApiItemContainerMixin)
53-
> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^^^^
53+
> : ^ ^^^^^^^^^ ^^ ^^ ^^^^^
5454

5555
baseClass: TBaseClass
5656
>baseClass : TBaseClass
@@ -102,7 +102,7 @@ export class ApiEnum extends ApiItemContainerMixin(ApiItem) {
102102
>ApiItemContainerMixin(ApiItem) : ApiItem & ApiItemContainerMixin
103103
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
104104
>ApiItemContainerMixin : <TBaseClass extends IApiItemConstructor>(baseClass: TBaseClass) => TBaseClass & (new (...args: any[]) => ApiItemContainerMixin)
105-
> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^
105+
> : ^ ^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^
106106
>ApiItem : typeof ApiItem
107107
> : ^^^^^^^^^^^^^^
108108

tests/baselines/reference/additionOperatorWithConstrainedTypeParameter.types

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// test for #17069
55
function sum<T extends Record<K, number>, K extends string>(n: number, v: T, k: K) {
66
>sum : <T extends Record<K, number>, K extends string>(n: number, v: T, k: K) => void
7-
> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^ ^^ ^^ ^^ ^^ ^^ ^^^^^^^^^
7+
> : ^ ^^^^^^^^^ ^^ ^^^^^^^^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^^^^^^^^
88
>n : number
99
> : ^^^^^^
1010
>v : T
@@ -42,7 +42,7 @@ function sum<T extends Record<K, number>, K extends string>(n: number, v: T, k:
4242
}
4343
function realSum<T extends Record<K, number>, K extends string>(n: number, vs: T[], k: K) {
4444
>realSum : <T extends Record<K, number>, K extends string>(n: number, vs: T[], k: K) => void
45-
> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^ ^^ ^^ ^^ ^^ ^^ ^^^^^^^^^
45+
> : ^ ^^^^^^^^^ ^^ ^^^^^^^^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^^^^^^^^
4646
>n : number
4747
> : ^^^^^^
4848
>vs : T[]

tests/baselines/reference/aliasUsageInGenericFunction.types

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ interface IHasVisualizationModel {
2222
}
2323
function foo<T extends { a: IHasVisualizationModel }>(x: T) {
2424
>foo : <T extends { a: IHasVisualizationModel; }>(x: T) => T
25-
> : ^ ^^^^^^^^^^^^^^ ^^^^^ ^^ ^^^^^^
25+
> : ^ ^^^^^^^^^ ^^ ^^ ^^^^^^
2626
>a : IHasVisualizationModel
2727
> : ^^^^^^^^^^^^^^^^^^^^^^
2828
>x : T
@@ -38,7 +38,7 @@ var r = foo({ a: moduleA });
3838
>foo({ a: moduleA }) : { a: typeof moduleA; }
3939
> : ^^^^^^^^^^^^^^^^^^^^^^
4040
>foo : <T extends { a: IHasVisualizationModel; }>(x: T) => T
41-
> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^^^^^
41+
> : ^ ^^^^^^^^^ ^^ ^^ ^^^^^^
4242
>{ a: moduleA } : { a: typeof moduleA; }
4343
> : ^^^^^^^^^^^^^^^^^^^^^^
4444
>a : typeof moduleA
@@ -52,7 +52,7 @@ var r2 = foo({ a: <IHasVisualizationModel>null });
5252
>foo({ a: <IHasVisualizationModel>null }) : { a: IHasVisualizationModel; }
5353
> : ^^^^^ ^^^
5454
>foo : <T extends { a: IHasVisualizationModel; }>(x: T) => T
55-
> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^^^^^
55+
> : ^ ^^^^^^^^^ ^^ ^^ ^^^^^^
5656
>{ a: <IHasVisualizationModel>null } : { a: IHasVisualizationModel; }
5757
> : ^^^^^ ^^^
5858
>a : IHasVisualizationModel

tests/baselines/reference/amdDeclarationEmitNoExtraDeclare.types

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
=== Class.ts ===
44
import { Configurable } from "./Configurable"
55
>Configurable : <T extends import("Configurable").Constructor<{}>>(base: T) => T
6-
> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^^^^^
6+
> : ^ ^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^ ^^ ^^ ^^^^^^
77

88
export class HiddenClass {}
99
>HiddenClass : HiddenClass
@@ -15,7 +15,7 @@ export class ActualClass extends Configurable(HiddenClass) {}
1515
>Configurable(HiddenClass) : HiddenClass
1616
> : ^^^^^^^^^^^
1717
>Configurable : <T extends import("Configurable").Constructor<{}>>(base: T) => T
18-
> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^^^^^
18+
> : ^ ^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^ ^^ ^^ ^^^^^^
1919
>HiddenClass : typeof HiddenClass
2020
> : ^^^^^^^^^^^^^^^^^^
2121

@@ -30,7 +30,7 @@ export type Constructor<T> = {
3030
}
3131
export function Configurable<T extends Constructor<{}>>(base: T): T {
3232
>Configurable : <T extends Constructor<{}>>(base: T) => T
33-
> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^^^^
33+
> : ^ ^^^^^^^^^ ^^ ^^ ^^^^^
3434
>base : T
3535
> : ^
3636

tests/baselines/reference/anonClassDeclarationEmitIsAnon.types

+6-6
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ export type Constructor<T = {}> = new (...args: any[]) => T;
2929
> : ^^^^^
3030

3131
export function Timestamped<TBase extends Constructor>(Base: TBase) {
32-
>Timestamped : <TBase extends Constructor<{}>>(Base: TBase) => { new (...args: any[]): (Anonymous class); prototype: Timestamped<any>.(Anonymous class); } & TBase
33-
> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^^^^^^^^^^^^^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
32+
>Timestamped : <TBase extends Constructor>(Base: TBase) => { new (...args: any[]): (Anonymous class); prototype: Timestamped<any>.(Anonymous class); } & TBase
33+
> : ^ ^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3434
>Base : TBase
3535
> : ^^^^^
3636

@@ -59,8 +59,8 @@ export function Timestamped<TBase extends Constructor>(Base: TBase) {
5959
import { wrapClass, Timestamped } from "./wrapClass";
6060
>wrapClass : (param: any) => typeof Wrapped
6161
> : ^ ^^ ^^^^^^^^^^^^^^^^^^^
62-
>Timestamped : <TBase extends import("wrapClass").Constructor<{}>>(Base: TBase) => { new (...args: any[]): (Anonymous class); prototype: Timestamped<any>.(Anonymous class); } & TBase
63-
> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^^^^^^^^^^^^^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
62+
>Timestamped : <TBase extends import("wrapClass").Constructor>(Base: TBase) => { new (...args: any[]): (Anonymous class); prototype: Timestamped<any>.(Anonymous class); } & TBase
63+
> : ^ ^^^^^^^^^ ^^^^^^^^^^^ ^^^^^^^^^^^^^ ^^ ^^^^^^^^^^^^^^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6464

6565
export default wrapClass(0);
6666
>wrapClass(0) : typeof Wrapped
@@ -88,8 +88,8 @@ export class TimestampedUser extends Timestamped(User) {
8888
> : ^^^^^^^^^^^^^^^
8989
>Timestamped(User) : Timestamped<typeof User>.(Anonymous class) & User
9090
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
91-
>Timestamped : <TBase extends import("wrapClass").Constructor<{}>>(Base: TBase) => { new (...args: any[]): (Anonymous class); prototype: Timestamped<any>.(Anonymous class); } & TBase
92-
> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^^^^^^^^^^^^^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
91+
>Timestamped : <TBase extends import("wrapClass").Constructor>(Base: TBase) => { new (...args: any[]): (Anonymous class); prototype: Timestamped<any>.(Anonymous class); } & TBase
92+
> : ^ ^^^^^^^^^ ^^^^^^^^^^^ ^^^^^^^^^^^^^ ^^ ^^^^^^^^^^^^^^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
9393
>User : typeof User
9494
> : ^^^^^^^^^^^
9595

tests/baselines/reference/anyAssignableToEveryType.types

+1-1
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ var q: String = a;
140140

141141
function foo<T, U /*extends T*/, V extends Date>(x: T, y: U, z: V) {
142142
>foo : <T, U, V extends Date>(x: T, y: U, z: V) => void
143-
> : ^ ^^ ^^ ^^^^^^^^^^^^^^^ ^^ ^^ ^^ ^^ ^^ ^^^^^^^^^
143+
> : ^ ^^ ^^ ^^^^^^^^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^^^^^^^^
144144
>x : T
145145
> : ^
146146
>y : U

tests/baselines/reference/argumentsReferenceInFunction1_Js.types

+2-2
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,11 @@ const debuglog = function() {
9393
>format.apply(null, arguments) : string
9494
> : ^^^^^^
9595
>format.apply : { <T, R>(this: (this: T) => R, thisArg: T): R; <T, A extends any[], R>(this: (this: T, ...args: A) => R, thisArg: T, args: A): R; }
96-
> : ^^^ ^^ ^^ ^^ ^^ ^^ ^^^^^^^ ^^ ^^^^^^^^^^^^^^^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^^^^^^
96+
> : ^^^ ^^ ^^ ^^ ^^ ^^ ^^^^^^^ ^^ ^^^^^^^^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^^^^^^
9797
>format : (f: any, ...args: any[]) => string
9898
> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
9999
>apply : { <T, R>(this: (this: T) => R, thisArg: T): R; <T, A extends any[], R>(this: (this: T, ...args: A) => R, thisArg: T, args: A): R; }
100-
> : ^^^ ^^ ^^ ^^ ^^ ^^ ^^^^^^^ ^^ ^^^^^^^^^^^^^^^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^^^^^^
100+
> : ^^^ ^^ ^^ ^^ ^^ ^^ ^^^^^^^ ^^ ^^^^^^^^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^^^^^^
101101
>arguments : IArguments
102102
> : ^^^^^^^^^^
103103

tests/baselines/reference/argumentsSpreadRestIterables(target=es5).types

+10-10
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ declare const itNum: Iterable<number>
5959

6060
declare function fn1<const T extends readonly unknown[]>(...args: T): T;
6161
>fn1 : <const T extends readonly unknown[]>(...args: T) => T
62-
> : ^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^^^^
62+
> : ^^^^^^^ ^^^^^^^^^ ^^^^^ ^^ ^^^^^
6363
>args : T
6464
> : ^
6565

@@ -69,7 +69,7 @@ const res1 = fn1(..."hello");
6969
>fn1(..."hello") : readonly any[]
7070
> : ^^^^^^^^^^^^^^
7171
>fn1 : <const T extends readonly unknown[]>(...args: T) => T
72-
> : ^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^^^^^
72+
> : ^^^^^^^ ^^^^^^^^^ ^^^^^ ^^ ^^^^^^
7373
>..."hello" : any
7474
> : ^^^
7575
>"hello" : "hello"
@@ -81,7 +81,7 @@ const res2 = fn1(...itNum);
8181
>fn1(...itNum) : Iterable<number>
8282
> : ^^^^^^^^^^^^^^^^
8383
>fn1 : <const T extends readonly unknown[]>(...args: T) => T
84-
> : ^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^^^^^
84+
> : ^^^^^^^ ^^^^^^^^^ ^^^^^ ^^ ^^^^^^
8585
>...itNum : Iterable<number>
8686
> : ^^^^^^^^^^^^^^^^
8787
>itNum : Iterable<number>
@@ -93,7 +93,7 @@ const res3 = fn1(true, ..."hello");
9393
>fn1(true, ..."hello") : readonly [true, ...any[]]
9494
> : ^^^^^^^^^^^^^^^^^^^^^^^^^
9595
>fn1 : <const T extends readonly unknown[]>(...args: T) => T
96-
> : ^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^^^^^
96+
> : ^^^^^^^ ^^^^^^^^^ ^^^^^ ^^ ^^^^^^
9797
>true : true
9898
> : ^^^^
9999
>..."hello" : any
@@ -107,7 +107,7 @@ const res4 = fn1(true, ...itNum);
107107
>fn1(true, ...itNum) : readonly [true, ...Iterable<number>[]]
108108
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
109109
>fn1 : <const T extends readonly unknown[]>(...args: T) => T
110-
> : ^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^^^^^
110+
> : ^^^^^^^ ^^^^^^^^^ ^^^^^ ^^ ^^^^^^
111111
>true : true
112112
> : ^^^^
113113
>...itNum : Iterable<number>
@@ -118,7 +118,7 @@ const res4 = fn1(true, ...itNum);
118118
// repro from #52781
119119
declare function foo<T extends unknown[]>(...args: T): T;
120120
>foo : <T extends unknown[]>(...args: T) => T
121-
> : ^ ^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^^^^
121+
> : ^ ^^^^^^^^^ ^^^^^ ^^ ^^^^^
122122
>args : T
123123
> : ^
124124

@@ -128,7 +128,7 @@ const p1 = foo(..."hello");
128128
>foo(..."hello") : any[]
129129
> : ^^^^^
130130
>foo : <T extends unknown[]>(...args: T) => T
131-
> : ^ ^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^^^^^
131+
> : ^ ^^^^^^^^^ ^^^^^ ^^ ^^^^^^
132132
>..."hello" : any
133133
> : ^^^
134134
>"hello" : "hello"
@@ -140,7 +140,7 @@ const p2 = foo(...itNum);
140140
>foo(...itNum) : Iterable<number>
141141
> : ^^^^^^^^^^^^^^^^
142142
>foo : <T extends unknown[]>(...args: T) => T
143-
> : ^ ^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^^^^^
143+
> : ^ ^^^^^^^^^ ^^^^^ ^^ ^^^^^^
144144
>...itNum : Iterable<number>
145145
> : ^^^^^^^^^^^^^^^^
146146
>itNum : Iterable<number>
@@ -152,7 +152,7 @@ const p3 = foo(true, ..."hello");
152152
>foo(true, ..."hello") : [boolean, ...any[]]
153153
> : ^^^^^^^^^^^^^^^^^^^
154154
>foo : <T extends unknown[]>(...args: T) => T
155-
> : ^ ^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^^^^^
155+
> : ^ ^^^^^^^^^ ^^^^^ ^^ ^^^^^^
156156
>true : true
157157
> : ^^^^
158158
>..."hello" : any
@@ -166,7 +166,7 @@ const p4 = foo(true, ...itNum);
166166
>foo(true, ...itNum) : [boolean, ...Iterable<number>[]]
167167
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
168168
>foo : <T extends unknown[]>(...args: T) => T
169-
> : ^ ^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^^^^^
169+
> : ^ ^^^^^^^^^ ^^^^^ ^^ ^^^^^^
170170
>true : true
171171
> : ^^^^
172172
>...itNum : Iterable<number>

0 commit comments

Comments
 (0)