Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let config = {
- connA: {
- host: 'abc123',
- user: 'abc123',
- password: 'abc123',
- database: 'abc123',
- },
- connB: {
- host: 'abc123',
- user: 'abc123',
- password: 'abc123',
- database: 'abc123',
- }
- }
- export interface DatabaseConnection {
- host: string
- user: string
- password: string
- database: string
- }
- export type DatabaseConnections<T> = {
- [P in keyof T]: T[P]
- }
- public static connect(config: DatabaseConnections<DatabaseConnection>) {
- for (let db in config) {
- // Do something with the config
- }
Add Comment
Please, Sign In to add comment