-
-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to put interfaces into each own files? #135
Comments
By default, no. However, by careful manipulation of the object definition you can extract each table and save them as files manually. I can imagine this won't work with enums as it requires linkage between definitions which will now be broken. This effectively goes through each table of each schema and creates a database that contains only that table. Then it builds a TypeScript file with that database. It uses the 2.0 syntax. const asObject = await Client
.fromConfig(config)
.fetchDatabase(db)
.toObject()
const tablesAsDatabases = asObject.schemas.flatMap(schema => {
return schema.tables.map(table => {
return {
...schema,
tables: [table]
}
})
})
.map(schema => {
return {
schemas: [schema]
}
})
for (const database of tablesAsDatabases) {
const ts = await Client.fromObject(database, config).toTypescript()
await fs.writeFile(`./${database.schemas[0].tables[0].name}.ts`, ts)
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is it possible to have exported interfaces separated by files with the rule "one table - one
.ts
file"?The text was updated successfully, but these errors were encountered: