Type constraint in Generics

Topics: Language Specification
Apr 18, 2014 at 3:47 PM
Why can't TypeScript has C# styled type constraints?
The Extends keyword is not familiar with C# developers, but Java developers.

Apr 18, 2014 at 4:23 PM
The 'extends' keyword here refers to the shape of the type T. Structurally, we're saying that the given type T must be equal to or larger than the constraint. For this, in TypeScript, we use the 'extends' keyword. This is a different functionality than that of C#.

Said another way, TypeScript has a different set of semantics and constraints than C# has. Syntax that works better in the JavaScript/structural typing world may feel different than C#, but this change is intentional because of the different semantics.