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

Unbound type parameter in declaration files for accessors with divergent types. #61391

Closed
dragomirtitian opened this issue Mar 10, 2025 · 0 comments Β· Fixed by #61392
Closed

Unbound type parameter in declaration files for accessors with divergent types. #61391

dragomirtitian opened this issue Mar 10, 2025 · 0 comments Β· Fixed by #61392

Comments

@dragomirtitian
Copy link
Contributor

πŸ”Ž Search Terms

type parameter accessor declaration different types

πŸ•— Version & Regression Information

  • This changed between versions 5.2 and 5.3

⏯ Playground Link

Playground Link

πŸ’» Code

function makeV() {
  type X<T> = { get done(): false | T; set done(v: T | null) }
  return null! as X<number>
}
export const v = makeV();

πŸ™ Actual behavior

Correct declaration files are generated for accessors that have divergent read/write types.

πŸ™‚ Expected behavior

d.ts keeps type parameter in type for v:

export declare const v: {
    get done(): false | T;
    set done(v: T | null);
};

Additional information about the issue

Seems to have not worked since 5.3 when divergent property types were first preserved in declaration files. Discovered while investigating #60864

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant