You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Type Merging between extends and intersection #8606
That FooBarA would work instead of throwing an error.
Actual behavior:
FooBarA complains Interface 'FooBarA' cannot simultaneously extend types 'Foo' and 'Bar'. Named property 'on' of types 'Foo' and 'Bar' are not identical.
While that is true in the strictest sense, the "base" override matches, which means in theory the string literal types could be merged and the error should only occur if there is a conflict between a specific string literal type.
Using the intersection type works perfectly fine and the resulting type mirrors the runtime behaviour. Using the "reimplement all methods" (FooBarB) gets really tedious really quickly when you are trying to do something like model event listeners like the above.
Proposed fix: When we consider signatures, after flattening the list of all signatures, we should then stable-sort, placing signatures with the more string literal types before those with fewer.
Activity
RyanCavanaugh commentedon May 16, 2016
Proposed fix: When we consider signatures, after flattening the list of all signatures, we should then stable-sort, placing signatures with the more string literal types before those with fewer.
kitsonk commentedon Nov 4, 2016
I am going to try to tackle this.
rjamesnw commentedon May 24, 2017
I just ran into something similar also.
(https://goo.gl/Yo4LJA)
Actually, I was surprised it even cares to pull in private members to a public interface.
Kingwl commentedon Dec 6, 2017
ping Ryan Cavanaugh (@RyanCavanaugh)
i don't understand why sort the signatures can solve this issue....
Can you explain it for me? 😄
HolgerJeromin commentedon Mar 23, 2018
My usecase was this: