对函数的规范,定义了形参与返回值的类型
interface MyInterface {
(p1: type, p2: type, ...): type
}
- 括号中的是参数结构,括号后的是返回值类型,与定义函数时的书写方式相同
- 时候后,定义函数不需要再次声明参数与返回值类型
示例
interface FullName {
( first: string, last: string ): string
}
const fullName: FullName = ( first, last ) => first + '' + last