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
Related Issues: I think this might be the same problem as issue #27027 but it is different in the sense that here I define an interface, not a function overload (though I guess it might be the same thing under the hood?)
I have the impression that this used to work at some point, but I might be wrong. Or maybe it used to be inferred as any and I never noticed?
The text was updated successfully, but these errors were encountered:
TypeScript Version: 3.1.2
Search Terms: function inference
Code
Expected behavior:
The
title
variable should be of typestring
Actual behavior:
The
title
variable ends up of typevoid
.Playground Link: https://www.typescriptlang.org/play/index.html#src=interface%20Prop%3CT%3E%20%7B%0D%0A%09()%3A%20T%0D%0A%09(v%3AT)%3A%20void%0D%0A%7D%0D%0Afunction%20cachedCast%3CI%2CO%3E(%0D%0A%20%20%20%20input%24%3A%20()%3D%3EI%2C%20%0D%0A%20%20%20%20convertInput%3A%20(i%3AI)%3D%3EO%0D%0A)%3A%20()%3D%3EO%20%7B%20%2F*%E2%80%A6*%2Freturn%20null%20as%20any%2F*%E2%80%A6*%2F%20%7D%0D%0A%0D%0Alet%20title%24%20%3A%20Prop%3Cstring%3E%0D%0Alet%20uppercase_title%24%20%3D%20cachedCast(title%24%2C%20title%3D%3Etitle.toUpperCase())%3B%20%2F%2F%20Error%3A%20%60void.toUpperCase%60%20is%20undefined
Related Issues: I think this might be the same problem as issue #27027 but it is different in the sense that here I define an interface, not a function overload (though I guess it might be the same thing under the hood?)
I have the impression that this used to work at some point, but I might be wrong. Or maybe it used to be inferred as
any
and I never noticed?The text was updated successfully, but these errors were encountered: