[英]What type represents a type in typescript?
所以給
class Foo {
}
interface TypeProvider() {
type(): ? ;
}
class Bar implements TypeProvider {
type(): ? {
return (Foo);
}
}
class Baz implements TypeProvider {
type(): ? {
return (Bar);
}
}
Foo
是一個類,但是如果我要從方法返回一個類,我應該為方法分配什么類型的簽名?
順帶一提的是return (Foo)
和return Foo
是同一件事嗎? 如果他們不同,我不確定我不要后者。
應該是Foo
構造函數:
class Bar {
type(): { new(): Foo } {
return (Foo);
}
}
要么:
interface FooConstructor {
new(): Foo;
}
class Bar {
type(): FooConstructor {
return (Foo);
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.