Skip to content

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

Closed
@dragomirtitian

Description

@dragomirtitian

πŸ”Ž 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions