import * as fs from 'fs'; import { compile } from 'json-schema-to-typescript'; import { arrayToExclude } from '../utils/ExcludeItems'; export function saveInterface(name: any, schema: any) { const pathDestination = __dirname.replace('dist', 'src/models/events/'); const schemaJson = JSON.parse(schema); arrayToExclude.map(item => { delete schemaJson.properties[item]; }); compile(schemaJson, `${name}.ts`).then(ts => { fs.writeFileSync(`${pathDestination}${name}.ts`, ts); }); }