假设我正在定义一个模块,并且我有一些这样的函数定义:
export function bodyParser(options?:any):
(req: ExpressServerRequest, res: ExpressServerResponse, next) =>void;
export function errorHandler(opts?:any):
(req: ExpressServerRequest, res: ExpressServerResponse, next) =>void;
export function methodOverride():
(req: ExpressServerRequest, res: ExpressServerResponse, next) =>void;
export function favicon(url: string, opts? ):
(req: ExpressServerRequest, res: ExpressServerResponse, next) =>void;
export function logger(type: string, opts? ):
(req: ExpressServerRequest, res: ExpressServerResponse, next) =>void;
我反复使用这个返回类型注释:
(req: ExpressServerRequest, res: ExpressServerResponse, next) =>void
有没有办法定义那个类型,给它一个名字,然后只引用这个名字而不是重复同样的事情?