- Notifications
You must be signed in to change notification settings - Fork 13.1k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptFixedA PR has been merged for this issueA PR has been merged for this issue
Milestone
Description
π Search Terms
.d.ts generation, TypeScript 5.7
π Version & Regression Information
- This changed between versions 5.6.3 and 5.7.1-rc
β― Playground Link
Note: look at the ".D.TS" tab in the playground
π» Code
export class FormControl<T> { value!: T; } export class FormGroup<T> { controls!: T; } class FormBuilder { group<T extends {}>( controls: T, ): FormGroup<{[K in keyof T]: FormControl<T[K]>}> { return null!; } } const fb = new FormBuilder(); export function getGroup() { return fb.group({ data: [] as string[] | null, }); }π Actual behavior
Given the code above, TypeScript 5.7 produces a .d.ts file that looks like this:
export declare function getGroup(fb: FormBuilder): FormGroup<{ data: string[] | null; // <----- Incorrect }>; π Expected behavior
It should produce something like this:
export declare function getGroup(fb: FormBuilder): FormGroup<{ data: FormControl<string[] | null>; }>; Additional information about the issue
Source code of Angular's FormBuilder: https://github.com/angular/angular/blob/main/packages/forms/src/form_builder.ts
kai-softr and imaksp
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptFixedA PR has been merged for this issueA PR has been merged for this issue