结构:
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进行变动