结构:
new <T>(executor: (resolve: (value?: T | PromiseLike<T>) => void, reject: (reason?: any) => void) => void): Promise<T>;
可行方案:
- new Promise<classType>(resolve, reject);
- new Promise(resolve(classType)=>void, reject);
两种写法根据结构来讲实现都一样,不会对reject进行变动
结构:
new <T>(executor: (resolve: (value?: T | PromiseLike<T>) => void, reject: (reason?: any) => void) => void): Promise<T>;
可行方案:
两种写法根据结构来讲实现都一样,不会对reject进行变动
本文标题:确定promise返回类型
本文链接:https://www.haomeiwen.com/subject/ezfohqtx.html
网友评论