你能像用c#一样用安全类型定义泛型吗?
例如.
public bool Foo<T>() where T : struct { /* */ }
Typescript现在有泛型,但我可以执行类似的操作吗?
谢谢
你能像用c#一样用安全类型定义泛型吗?
例如.
public bool Foo<T>() where T : struct { /* */ }
Typescript现在有泛型,但我可以执行类似的操作吗?
谢谢
好吧,看来你能做到:
Foo<T extends IBar>() { /* */ }
这似乎使得所有的调用都需要T实现IBar
.