/**
 * Convertire il seguente codice in stile funzionale
 */ interface User { readonly name : string ; } declare function getUsersByPage ( page ) ; async function getAllUsers ( ) { let currentUsers = [ ] ; let totalUsers = [ ] ; let page = 0 ; do { currentUsers = await getUsersByPage ( page ) ; totalUsers = totalUsers . concat ( currentUsers ) ; page ++ ; } while ( currentUsers . length > 0 ) ; return totalUsers ; } import * as assert from 'assert' ; import * as E from 'fp-ts/Either' ; async function test ( ) { assert . deepStrictEqual ( await getAllUsers ( ) , E . right ( [ 'a' , 'b' , 'a' , 'b' , 'a' , 'b' ] ) ) ; } test ( ) ;