[Typescript] Construct Signatures

Construct signatures are similar to call signatures, except they describe what should happen with the new keyword.

interface DateConstructor {
  new (value: number): Date
}
 
let MyDateConstructor: DateConstructor = Date
const d = new MyDateConstructor()

 

posted @ 2022-07-28 15:46  Zhentiw  阅读(82)  评论(0编辑  收藏  举报