-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Closed
Labels
Design LimitationConstraints of the existing architecture prevent this from being fixedConstraints of the existing architecture prevent this from being fixed
Description
TypeScript Version: master
Expected behavior:
interface SVGElementTagNameMap {
'a': SVGAElement;
}
interface ElementTagNameMap extends HTMLElementTagNameMap, SVGElementTagNameMap {
}But deriving from both HTMLElementTagNameMap and SVGElementTagNameMap still throw an error by conflicts. To resolve this, ElementTagNameMap has to be defined using Diff type as follows.
interface ElementTagNameMap extends HTMLElementTagNameMap, Diff<SVGElementTagNameMap, HTMLElementTagNameMap> {
}
type Diff<T, U> = Pick<T, DiffKey<keyof T, keyof U>>;
type DiffKey<T extends string, U extends string> = (
& { [P in T]: P; }
& { [P in U]: never; }
& { [x: string]: never; }
)[T];However, defining ElementTagNameMap is originally wrong. It should be removed later.
Actual behavior:
interface ElementTagNameMap {
'a': SVGAElement; // error, conflicts with 'a': HTMLAnchorElement;
}Metadata
Metadata
Assignees
Labels
Design LimitationConstraints of the existing architecture prevent this from being fixedConstraints of the existing architecture prevent this from being fixed