我知道类型或接口可用于智能感知功能参数或内联@type
。但是,有什么方法可以使用类型/接口对整个函数或对象文字赋予智能感知?示例:
type TFunc = ( x: number ) => boolean;
/**
* @implements {TFunc}
*/
function isNumber ( x ) {
return typeof x === 'number';
}
@implements
不起作用。我想知道是否可以通过其他方式完成?
我会说:
使用@type
而不是@implements