2016-06-04 13 views

risposta

21
const fn = <T>(array: Array<T>): Promise<T> => Promise.resolve(array[0]); 

documentazione pertinente: https://flow.org/en/docs/types/generics/

+0

Purtroppo un [tipo distinto] (https://stackoverflow.com/q/46596235/4228942) non funziona :( – norbertpy

+1

come sarebbe un async funzione freccia? –

+0

@norbertpy ora c'è una risposta sulla domanda collegata che mostra come fare questo con un tipo separato –