Skip to content

Commit 13aaef9

Browse files
author
Umutcan ÖNER
committed
fix: resolve TypeScript error in database constructor
1 parent 245e9c9 commit 13aaef9

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

packages/database/src/index.ts

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,17 @@
1-
// Database package
21
export interface DatabaseConfig {
3-
connectionString: string;
4-
poolSize?: number;
2+
host: string;
3+
port: number;
4+
database: string;
55
}
66

77
export class Database {
8-
constructor(private config: DatabaseConfig) {}
8+
private config: DatabaseConfig;
99

10-
async connect(): Promise<void> {
11-
console.log('Connecting to database...');
10+
constructor(config: DatabaseConfig) {
11+
this.config = config;
1212
}
1313

14-
async disconnect(): Promise<void> {
15-
console.log('Disconnecting from database...');
14+
connect(): void {
15+
console.log(`Connecting to ${this.config.host}:${this.config.port}/${this.config.database}`);
1616
}
17-
}
18-
19-
export default Database;
17+
}

0 commit comments

Comments
 (0)