microsoft / microsoft/TypeScript
Unrelated interface causes assignability to change
Abierto
@ahejlsberg ya está trabajando en esto.
Desde el 16/10/2023.
Needs Investigation
- Lenguaje dominante
- Go
- Estrellas
- 111k
- Forks
- 14.4k
- Merge medio
- 1 d 19 h
- PR fusionados (30 d)
- 117
Descripción
🔎 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
💻 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
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Evaluación
Este issue todavía no se ha evaluado.