UNPKG

template-ivan

Version:
26 lines (19 loc) 552 B
// @flow // 对于Symbol类型的primitive types value,flow无法检测,定义变量时直接标注为any越过检测 const HTTP_API: any = Symbol('request JSON') type Params<A, B, C, D> = { +options?: Object, +url: string, +types: [A, B, C, D], } type HttpRequest<A, B, C, D> = { type: (A | B | C | D), +HTTP_API: Params<A, B, C, D>, } export type HttpApi = {| [HTTP_API]: Params<string, string, string, string>, |} export type HttpMiddleware = | HttpApi | HttpRequest<string, string, string, string> export default HTTP_API