import fs from 'fs' ; export interface CrossTypeHost { readFile ( fileName ) : string ; writeFile ( fileName , data ) : void ; readFiles ( fileNames ) : Map < string , string > ; writeFiles ( files ) : void ; fileExists ( fileName ) : boolean ; } export function createCrossTypeHost ( ) { return { readFile : ( fileName ) => fs . readFileSync ( fileName , 'utf8' ) , writeFile : ( fileName , data ) => fs . writeFileSync ( fileName , data ) , fileExists : ( fileName ) => fs . existsSync ( fileName ) , readFiles ( this , filesNames ) { return new Map < string , string > ( filesNames . map ( f => [ f , this . readFile ( f ) ] ) ) ; } , writeFiles ( this , files ) { Object . entries ( files ) . forEach ( f => this . writeFile ( f [ 0 ] , f [ 1 ] ) ) ; } } ; }