更新时间:2022-12-23 14:33:55
从TypeScript 2.9开始,现在似乎可以使用TypeScript来约束模板参数(请参见
As of TypeScript 2.9 it seems constraining template parameters is now possible using TypeScript (see issue 24600). The above TypeScript declaration would therefor become:
/**
* @template T
* @typedef {new(...args: any[]) => T} Constructor
**/
/**
* @template {Constructor<{}>} T
* @param {T} Base
*/
function Tagged(Base) { … }