Typescript关于获取Promise的实践
1. Typescript的函数定义
- 利用type
// 先定义一个接口的统一的类
export interface ICommonApiInterface<T> {
status: 200 | 404 | 500 | 301 | 302;
statusText: string;
data: T;
}
export type TGetPlotCurve = (
curveId: number
) => Promise<ICommonApiInterface<IPlotCurve>>;
2. 利用接口类interface进行函数重载的定义
export interface <