[英]What type represents a type in typescript?
so given 所以给
class Foo {
}
interface TypeProvider() {
type(): ? ;
}
class Bar implements TypeProvider {
type(): ? {
return (Foo);
}
}
class Baz implements TypeProvider {
type(): ? {
return (Bar);
}
}
Foo
is a class but if I'm returning a class from a method, what type do I assign the method signature? Foo
是一个类,但是如果我要从方法返回一个类,我应该为方法分配什么类型的签名?
as an aside is return (Foo)
and return Foo
the same thing? 顺带一提的是
return (Foo)
和return Foo
是同一件事吗? if they're different I'm not certain I don't want the latter. 如果他们不同,我不确定我不要后者。
It should be the Foo
constructor: 应该是
Foo
构造函数:
class Bar {
type(): { new(): Foo } {
return (Foo);
}
}
Or: 要么:
interface FooConstructor {
new(): Foo;
}
class Bar {
type(): FooConstructor {
return (Foo);
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.