How do I write flowtype for the following code?
The function argument is an array of generic type.
const fn = (array) => Promise.resolve(array[0]);
const fn = <T>(array: Array<T>): Promise<T> => Promise.resolve(array[0]);
Relevant documentation: https://flow.org/en/docs/types/generics/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With