Skip to content

Unrelated interface causes assignability to change Β #56099

Open
@dragomirtitian

Description

@dragomirtitian

πŸ”Ž Search Terms

5.3 regression

πŸ•— Version & Regression Information

  • This changed between versions 5.3.0-dev.20230823 and 5.3.0-dev.20230824

⏯ Playground Link

Playground Link

πŸ’» Code

export { }
interface Map<V> extends Collection<V> {
    flatMap<VM>(): Map<VM>;
}

interface Collection<V> {
    value: V; // sprinkle some covariance
    map: Map<V>;
    concat(): Collection<unknown>;
    flatMap(): Collection<V>;
    flatMap<VM>(): Collection<VM>;
}

// Comment out and it works like in 5.2
interface Keyed extends Collection<number> {
    concat(): Keyed;
}

type R = Map<never> extends Collection<infer V> ? V : "NO";

const r = null! as R;
const t: "NO" = r;

πŸ™ Actual behavior

R is unknown. Removing Keyed makes R "NO", even though Keyed is unused otherwise.

πŸ™‚ Expected behavior

Not really sure. I'd settle for the stable 5.2 behavior, which is for R to be "NO" although that also seems wrong (Why doesn't Map<never> extends Collection? If we remove flatMap(): Collection<V> from Collection then Map<never> extends Collection. This seems like the correct behavior.)

Additional information about the issue

No response

Metadata

Metadata

Assignees

Labels

Needs InvestigationThis issue needs a team member to investigate its status.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions