属性类型与函数类型的混合,可以同时定义形参、返回值、函数的属性
interface MyInterface {( params: type ): type;property: type;method(): type;}
- 使用该接口时,赋值的函数必须有规定的属性
示例
interface MyInterface {(): number;count: number;}const countFunc = (): MyInterface => {const c = (): number => { ++c.count }c.count = 0return c}const addCount: MyInterface = addCount()
