TypeScript声明回调函数类型

2019-07-268203次阅读TypeScript

TypeScript声明回调函数类型,例如:

event.on('change', function() {});

声明一个专用的函数类型就可以了:

type Cb = () => void;

on(type: string, cb: Cb);

 

上一篇: iOS下键盘弹起收起  下一篇: !important的权重  

TypeScript声明回调函数类型相关文章