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
classFoo{bar(): 1;bar(): 2;bar(): number{return1;}}interfaceWithBar<R>{bar(): R;}functiontest<R>(a: WithBar<R>): R{returna.bar();}constfoo=newFoo();constn1=foo.bar();// Has type 1constn2=test(foo);// Has type 2
Expected behavior: n1 and n2 have the same type, namely 1.
Actual behavior: n2 gets the incorrect type 2. It seems that R is taken from the last matching overload, rather than the first.
I don't know if there's some detailed spec doc somewhere that I could use to confirm that this is a bug rather than a weird design, but it's definitely undesirable to me.
The text was updated successfully, but these errors were encountered:
Automatically closing this issue for housekeeping purposes. The issue labels indicate that it is unactionable at the moment or has already been addressed.
TypeScript Version: 2.7.0-dev.20171124
Code
Expected behavior:
n1
andn2
have the same type, namely1
.Actual behavior:
n2
gets the incorrect type2
. It seems thatR
is taken from the last matching overload, rather than the first.I don't know if there's some detailed spec doc somewhere that I could use to confirm that this is a bug rather than a weird design, but it's definitely undesirable to me.
The text was updated successfully, but these errors were encountered: