Can you define generics with safe types, as you can with c#?
E.g.
public bool Foo<T>() where T : struct { /* */ }
Typescript now has generics, but can I perform a similar action?
Thanks.
Ok it seems you can do this:
Foo<T extends IBar>() { /* */ }
And that seems to make all calls require the T to implement IBar.
extends keyword is used to constrain to either an interface or a class.extends keyword rather than the implements on. For example Foo<T extends IBar>.