如何使用泛型为箭头函数编写流类型
How to write a flowtype for arrow function with generic type
如何为以下代码编写流类型?
函数参数是泛型数组。
const fn = (array) => Promise.resolve(array[0]);
const fn = <T>(array: Array<T>): Promise<T> => Promise.resolve(array[0]);
如何为以下代码编写流类型?
函数参数是泛型数组。
const fn = (array) => Promise.resolve(array[0]);
const fn = <T>(array: Array<T>): Promise<T> => Promise.resolve(array[0]);