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
Deriving from object and intersection types problem #13732
Expected behavior:
no error Actual behavior:
line interface B<T> extends _A<T> { } is error // TS2312: An interface may only extend a class or another interface.
Now, we can deriving from object and intersection types by #13604.
But this is only for _A<T> is statically composed of object or intersection types.
I think we can solve this problem if we can delay type evaluation until actual type resolution at the line type TypedPerson = B<Person>;
or, we need generics type restriction like below?
the T is unknown. it would have been fine to extend from _A<{}>, but not from T. The reason is the compiler does not know what T is at the declaration site, and thus does not know how to check the extends relationship in the interface declaration.
Activity
mhegazy commentedon Jan 30, 2017
the
Tis unknown. it would have been fine to extend from_A<{}>, but not fromT. The reason is the compiler does not know whatTis at the declaration site, and thus does not know how to check theextendsrelationship in the interface declaration.consider using intersection types, as:
tamayika commentedon Jan 30, 2017
OK, thanks!!