Skip to content
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

Attempt to reuse type parameter constraint nodes #58539

Merged
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
11 changes: 9 additions & 2 deletions src/compiler/checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7459,8 +7459,12 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
return factory.createTypeParameterDeclaration(modifiers, name, constraintNode, defaultParameterNode);
}

function typeToTypeNodeHelperWithPossibleReusableTypeNode(type: Type, typeNode: TypeNode | undefined, context: NodeBuilderContext) {
return typeNode && tryReuseExistingNonParameterTypeNode(context, typeNode, type) || typeToTypeNodeHelper(type, context);
}

function typeParameterToDeclaration(type: TypeParameter, context: NodeBuilderContext, constraint = getConstraintOfTypeParameter(type)): TypeParameterDeclaration {
const constraintNode = constraint && typeToTypeNodeHelper(constraint, context);
const constraintNode = constraint && typeToTypeNodeHelperWithPossibleReusableTypeNode(constraint, getConstraintDeclaration(type), context);
return typeParameterToDeclarationWithConstraint(type, context, constraintNode);
}

Expand Down Expand Up @@ -8274,7 +8278,6 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
sym = resolveEntityName(leftmost, meaning, /*ignoreErrors*/ true, /*dontResolveAlias*/ true);
if (
context.enclosingDeclaration &&
(getNodeLinks(context.enclosingDeclaration).fakeScopeForSignatureDeclaration || !findAncestor(node, n => n === context.enclosingDeclaration)) &&
Copy link
Member Author

Choose a reason for hiding this comment

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

A fourslash test was affected by the code change and made it clear this small change to #58516 was needed - checking that the entity name resolves within the enclosing context is just always required to ensure the name's actually available, not just when there's a fake scope.

!(sym && sym.flags & SymbolFlags.TypeParameter)
) {
sym = getExportSymbolOfValueSymbolIfExported(sym);
Expand Down Expand Up @@ -8431,6 +8434,10 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
}

function visitExistingNodeTreeSymbolsWorker(node: Node): Node | undefined {
if (isJSDocTypeExpression(node)) {
Copy link
Member Author

Choose a reason for hiding this comment

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

The constraint type node for a type parameter declared in jsdoc is a JSDocTypeExpression which, as it turns out, is not actually a type node (according to isTypeNode, though the typesystem thinks it is - inconsistent much?), so it needs to get unwrapped; you also definitely don't want the {} from jsdoc copied into a .d.ts file in the first place! So the assertion triggering off the core of this change found this bug, which was nice.

// Unwrap JSDocTypeExpressions
return visitNode(node.type, visitExistingNodeTreeSymbols, isTypeNode);
}
// We don't _actually_ support jsdoc namepath types, emit `any` instead
if (isJSDocAllType(node) || node.kind === SyntaxKind.JSDocNamepathType) {
return factory.createKeywordTypeNode(SyntaxKind.AnyKeyword);
Expand Down
4 changes: 2 additions & 2 deletions tests/baselines/reference/1.0lib-noErrors.types
Original file line number Diff line number Diff line change
Expand Up @@ -2081,7 +2081,7 @@ interface Array<T> {
*/
concat<U extends T[]>(...items: U[]): T[];
>concat : { <U extends T[]>(...items: U[]): T[]; (...items: T[]): T[]; }
> : ^^^ ^^^^^^^^^^^^^^^^^ ^^ ^^^ ^^^^^^ ^^ ^^^^^^^^^
> : ^^^ ^^^^^^^^^ ^^^^^ ^^ ^^^ ^^^^^^ ^^ ^^^^^^^^^
>items : U[]
> : ^^^

Expand All @@ -2091,7 +2091,7 @@ interface Array<T> {
*/
concat(...items: T[]): T[];
>concat : { <U extends T[]>(...items: U[]): T[]; (...items: T[]): T[]; }
> : ^^^ ^^^^^^^^^^^^^^^^^ ^^ ^^^^^^^^^^^^ ^^ ^^^ ^^^
> : ^^^ ^^^^^^^^^ ^^^^^ ^^ ^^^^^^^^^^^^ ^^ ^^^ ^^^
>items : T[]
> : ^^^

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ module A {

export function mirror<T extends Point>(p: T) {
>mirror : <T extends Point>(p: T) => { x: number; y: number; }
> : ^ ^^^^^^^^^^^^^^^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> : ^ ^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>p : T
> : ^

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export module A {

export function mirror<T extends Point>(p: T) {
>mirror : <T extends Point>(p: T) => { x: number; y: number; }
> : ^ ^^^^^^^^^^^^^^^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> : ^ ^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>p : T
> : ^

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ module Root {

export function mirror<T extends Point>(p: T) {
>mirror : <T extends Point>(p: T) => { x: number; y: number; }
> : ^ ^^^^^^^^^^^^^^^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> : ^ ^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>p : T
> : ^

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ module A {

export function mirror<T extends Point>(p: T) {
>mirror : <T extends Point>(p: T) => { x: number; y: number; }
> : ^ ^^^^^^^^^^^^^^^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> : ^ ^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>p : T
> : ^

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 @@ -22,7 +22,7 @@ type AnyCtor<P extends object> = new (...a: any[]) => P

declare function classWithProperties<T extends { [key: string]: Types }, P extends object>(properties: T, klass: AnyCtor<P>): {
>classWithProperties : <T extends { [key: string]: Types; }, P extends object>(properties: T, klass: AnyCtor<P>) => { new (): P & Properties<T>; prototype: P & Properties<T>; }
> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^ ^^ ^^ ^^ ^^^^^
> : ^ ^^^^^^^^^ ^^ ^^^^^^^^^ ^^ ^^ ^^ ^^ ^^^^^
>key : string
> : ^^^^^^
>properties : T
Expand All @@ -43,7 +43,7 @@ const Base = classWithProperties({
>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
4 changes: 2 additions & 2 deletions tests/baselines/reference/accessorsOverrideProperty9.types
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ interface ApiItemContainerMixin extends ApiItem {

function ApiItemContainerMixin<TBaseClass extends IApiItemConstructor>(
>ApiItemContainerMixin : <TBaseClass extends IApiItemConstructor>(baseClass: TBaseClass) => TBaseClass & (new (...args: any[]) => ApiItemContainerMixin)
> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^^^^
> : ^ ^^^^^^^^^ ^^ ^^ ^^^^^

baseClass: TBaseClass
>baseClass : TBaseClass
Expand Down Expand Up @@ -102,7 +102,7 @@ export class ApiEnum extends ApiItemContainerMixin(ApiItem) {
>ApiItemContainerMixin(ApiItem) : ApiItem & ApiItemContainerMixin
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>ApiItemContainerMixin : <TBaseClass extends IApiItemConstructor>(baseClass: TBaseClass) => TBaseClass & (new (...args: any[]) => ApiItemContainerMixin)
> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^
> : ^ ^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^
>ApiItem : typeof ApiItem
> : ^^^^^^^^^^^^^^

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// test for #17069
function sum<T extends Record<K, number>, K extends string>(n: number, v: T, k: K) {
>sum : <T extends Record<K, number>, K extends string>(n: number, v: T, k: K) => void
> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^ ^^ ^^ ^^ ^^ ^^ ^^^^^^^^^
> : ^ ^^^^^^^^^ ^^ ^^^^^^^^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^^^^^^^^
>n : number
> : ^^^^^^
>v : T
Expand Down Expand Up @@ -42,7 +42,7 @@ function sum<T extends Record<K, number>, K extends string>(n: number, v: T, k:
}
function realSum<T extends Record<K, number>, K extends string>(n: number, vs: T[], k: K) {
>realSum : <T extends Record<K, number>, K extends string>(n: number, vs: T[], k: K) => void
> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^ ^^ ^^ ^^ ^^ ^^ ^^^^^^^^^
> : ^ ^^^^^^^^^ ^^ ^^^^^^^^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^^^^^^^^
>n : number
> : ^^^^^^
>vs : T[]
Expand Down
6 changes: 3 additions & 3 deletions tests/baselines/reference/aliasUsageInGenericFunction.types
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ interface IHasVisualizationModel {
}
function foo<T extends { a: IHasVisualizationModel }>(x: T) {
>foo : <T extends { a: IHasVisualizationModel; }>(x: T) => T
> : ^ ^^^^^^^^^^^^^^ ^^^^^ ^^ ^^^^^^
> : ^ ^^^^^^^^^ ^^ ^^ ^^^^^^
>a : IHasVisualizationModel
> : ^^^^^^^^^^^^^^^^^^^^^^
>x : T
Expand All @@ -38,7 +38,7 @@ var r = foo({ a: moduleA });
>foo({ a: moduleA }) : { a: typeof moduleA; }
> : ^^^^^^^^^^^^^^^^^^^^^^
>foo : <T extends { a: IHasVisualizationModel; }>(x: T) => T
> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^^^^^
> : ^ ^^^^^^^^^ ^^ ^^ ^^^^^^
>{ a: moduleA } : { a: typeof moduleA; }
> : ^^^^^^^^^^^^^^^^^^^^^^
>a : typeof moduleA
Expand All @@ -52,7 +52,7 @@ var r2 = foo({ a: <IHasVisualizationModel>null });
>foo({ a: <IHasVisualizationModel>null }) : { a: IHasVisualizationModel; }
> : ^^^^^ ^^^
>foo : <T extends { a: IHasVisualizationModel; }>(x: T) => T
> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^^^^^
> : ^ ^^^^^^^^^ ^^ ^^ ^^^^^^
>{ a: <IHasVisualizationModel>null } : { a: IHasVisualizationModel; }
> : ^^^^^ ^^^
>a : IHasVisualizationModel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
=== Class.ts ===
import { Configurable } from "./Configurable"
>Configurable : <T extends import("Configurable").Constructor<{}>>(base: T) => T
> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^^^^^
> : ^ ^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^ ^^ ^^ ^^^^^^

export class HiddenClass {}
>HiddenClass : HiddenClass
Expand All @@ -15,7 +15,7 @@ export class ActualClass extends Configurable(HiddenClass) {}
>Configurable(HiddenClass) : HiddenClass
> : ^^^^^^^^^^^
>Configurable : <T extends import("Configurable").Constructor<{}>>(base: T) => T
> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^^^^^
> : ^ ^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^ ^^ ^^ ^^^^^^
>HiddenClass : typeof HiddenClass
> : ^^^^^^^^^^^^^^^^^^

Expand All @@ -30,7 +30,7 @@ export type Constructor<T> = {
}
export function Configurable<T extends Constructor<{}>>(base: T): T {
>Configurable : <T extends Constructor<{}>>(base: T) => T
> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^^^^
> : ^ ^^^^^^^^^ ^^ ^^ ^^^^^
>base : T
> : ^

Expand Down
12 changes: 6 additions & 6 deletions tests/baselines/reference/anonClassDeclarationEmitIsAnon.types
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ export type Constructor<T = {}> = new (...args: any[]) => T;
> : ^^^^^

export function Timestamped<TBase extends Constructor>(Base: TBase) {
>Timestamped : <TBase extends Constructor<{}>>(Base: TBase) => { new (...args: any[]): (Anonymous class); prototype: Timestamped<any>.(Anonymous class); } & TBase
> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^^^^^^^^^^^^^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>Timestamped : <TBase extends Constructor>(Base: TBase) => { new (...args: any[]): (Anonymous class); prototype: Timestamped<any>.(Anonymous class); } & TBase
> : ^ ^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>Base : TBase
> : ^^^^^

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

export default wrapClass(0);
>wrapClass(0) : typeof Wrapped
Expand Down Expand Up @@ -88,8 +88,8 @@ export class TimestampedUser extends Timestamped(User) {
> : ^^^^^^^^^^^^^^^
>Timestamped(User) : Timestamped<typeof User>.(Anonymous class) & User
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>Timestamped : <TBase extends import("wrapClass").Constructor<{}>>(Base: TBase) => { new (...args: any[]): (Anonymous class); prototype: Timestamped<any>.(Anonymous class); } & TBase
> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^^^^^^^^^^^^^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>Timestamped : <TBase extends import("wrapClass").Constructor>(Base: TBase) => { new (...args: any[]): (Anonymous class); prototype: Timestamped<any>.(Anonymous class); } & TBase
> : ^ ^^^^^^^^^ ^^^^^^^^^^^ ^^^^^^^^^^^^^ ^^ ^^^^^^^^^^^^^^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>User : typeof User
> : ^^^^^^^^^^^

Expand Down
2 changes: 1 addition & 1 deletion tests/baselines/reference/anyAssignableToEveryType.types
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ var q: String = a;

function foo<T, U /*extends T*/, V extends Date>(x: T, y: U, z: V) {
>foo : <T, U, V extends Date>(x: T, y: U, z: V) => void
> : ^ ^^ ^^ ^^^^^^^^^^^^^^^ ^^ ^^ ^^ ^^ ^^ ^^^^^^^^^
> : ^ ^^ ^^ ^^^^^^^^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^^^^^^^^
>x : T
> : ^
>y : U
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,11 @@ const debuglog = function() {
>format.apply(null, arguments) : string
> : ^^^^^^
>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; }
> : ^^^ ^^ ^^ ^^ ^^ ^^ ^^^^^^^ ^^ ^^^^^^^^^^^^^^^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^^^^^^
> : ^^^ ^^ ^^ ^^ ^^ ^^ ^^^^^^^ ^^ ^^^^^^^^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^^^^^^
>format : (f: any, ...args: any[]) => string
> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>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; }
> : ^^^ ^^ ^^ ^^ ^^ ^^ ^^^^^^^ ^^ ^^^^^^^^^^^^^^^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^^^^^^
> : ^^^ ^^ ^^ ^^ ^^ ^^ ^^^^^^^ ^^ ^^^^^^^^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^^^^^^
>arguments : IArguments
> : ^^^^^^^^^^

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ declare const itNum: Iterable<number>

declare function fn1<const T extends readonly unknown[]>(...args: T): T;
>fn1 : <const T extends readonly unknown[]>(...args: T) => T
> : ^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^^^^
> : ^^^^^^^ ^^^^^^^^^ ^^^^^ ^^ ^^^^^
>args : T
> : ^

Expand All @@ -69,7 +69,7 @@ const res1 = fn1(..."hello");
>fn1(..."hello") : readonly any[]
> : ^^^^^^^^^^^^^^
>fn1 : <const T extends readonly unknown[]>(...args: T) => T
> : ^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^^^^^
> : ^^^^^^^ ^^^^^^^^^ ^^^^^ ^^ ^^^^^^
>..."hello" : any
> : ^^^
>"hello" : "hello"
Expand All @@ -81,7 +81,7 @@ const res2 = fn1(...itNum);
>fn1(...itNum) : Iterable<number>
> : ^^^^^^^^^^^^^^^^
>fn1 : <const T extends readonly unknown[]>(...args: T) => T
> : ^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^^^^^
> : ^^^^^^^ ^^^^^^^^^ ^^^^^ ^^ ^^^^^^
>...itNum : Iterable<number>
> : ^^^^^^^^^^^^^^^^
>itNum : Iterable<number>
Expand All @@ -93,7 +93,7 @@ const res3 = fn1(true, ..."hello");
>fn1(true, ..."hello") : readonly [true, ...any[]]
> : ^^^^^^^^^^^^^^^^^^^^^^^^^
>fn1 : <const T extends readonly unknown[]>(...args: T) => T
> : ^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^^^^^
> : ^^^^^^^ ^^^^^^^^^ ^^^^^ ^^ ^^^^^^
>true : true
> : ^^^^
>..."hello" : any
Expand All @@ -107,7 +107,7 @@ const res4 = fn1(true, ...itNum);
>fn1(true, ...itNum) : readonly [true, ...Iterable<number>[]]
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>fn1 : <const T extends readonly unknown[]>(...args: T) => T
> : ^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^^^^^
> : ^^^^^^^ ^^^^^^^^^ ^^^^^ ^^ ^^^^^^
>true : true
> : ^^^^
>...itNum : Iterable<number>
Expand All @@ -118,7 +118,7 @@ const res4 = fn1(true, ...itNum);
// repro from #52781
declare function foo<T extends unknown[]>(...args: T): T;
>foo : <T extends unknown[]>(...args: T) => T
> : ^ ^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^^^^
> : ^ ^^^^^^^^^ ^^^^^ ^^ ^^^^^
>args : T
> : ^

Expand All @@ -128,7 +128,7 @@ const p1 = foo(..."hello");
>foo(..."hello") : any[]
> : ^^^^^
>foo : <T extends unknown[]>(...args: T) => T
> : ^ ^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^^^^^
> : ^ ^^^^^^^^^ ^^^^^ ^^ ^^^^^^
>..."hello" : any
> : ^^^
>"hello" : "hello"
Expand All @@ -140,7 +140,7 @@ const p2 = foo(...itNum);
>foo(...itNum) : Iterable<number>
> : ^^^^^^^^^^^^^^^^
>foo : <T extends unknown[]>(...args: T) => T
> : ^ ^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^^^^^
> : ^ ^^^^^^^^^ ^^^^^ ^^ ^^^^^^
>...itNum : Iterable<number>
> : ^^^^^^^^^^^^^^^^
>itNum : Iterable<number>
Expand All @@ -152,7 +152,7 @@ const p3 = foo(true, ..."hello");
>foo(true, ..."hello") : [boolean, ...any[]]
> : ^^^^^^^^^^^^^^^^^^^
>foo : <T extends unknown[]>(...args: T) => T
> : ^ ^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^^^^^
> : ^ ^^^^^^^^^ ^^^^^ ^^ ^^^^^^
>true : true
> : ^^^^
>..."hello" : any
Expand All @@ -166,7 +166,7 @@ const p4 = foo(true, ...itNum);
>foo(true, ...itNum) : [boolean, ...Iterable<number>[]]
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>foo : <T extends unknown[]>(...args: T) => T
> : ^ ^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^^^^^
> : ^ ^^^^^^^^^ ^^^^^ ^^ ^^^^^^
>true : true
> : ^^^^
>...itNum : Iterable<number>
Expand Down
Loading