-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Closed
Labels
Design LimitationConstraints of the existing architecture prevent this from being fixedConstraints of the existing architecture prevent this from being fixed
Description
Hi. Before I start I want to emphasize that I googled a lot for that problem and found nothing. That being said, my problem seems to be so simple, that I am sure it was discussed before. If that is the case forgive me for spam. I would be just grateful for some link to the explanation of why TS works here the way it works.
I use TypeScript 1.8.10
So... this does not compile (which is good):
function id <A> (a : A) : A {
return "string";
}This however DOES (which for me seems super bad):
const id :<A>(a : A) => A = a => "string";
var x : number = id<number>(5); // compiler does not complain at all :(Metadata
Metadata
Assignees
Labels
Design LimitationConstraints of the existing architecture prevent this from being fixedConstraints of the existing architecture prevent this from being fixed