From 4dc8959203e4b9dda50e7727ec46e7fbafa7750f Mon Sep 17 00:00:00 2001 From: braks <78412429+bcakmakoglu@users.noreply.github.com> Date: Thu, 25 Aug 2022 13:42:13 +0200 Subject: [PATCH] chore(gui-v2): narrow down types --- .../nc-gui-v2/utils/projectCreateUtils.ts | 32 ++++++++++++------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/packages/nc-gui-v2/utils/projectCreateUtils.ts b/packages/nc-gui-v2/utils/projectCreateUtils.ts index fa4a7eabcd..351256e248 100644 --- a/packages/nc-gui-v2/utils/projectCreateUtils.ts +++ b/packages/nc-gui-v2/utils/projectCreateUtils.ts @@ -69,35 +69,45 @@ export const clientTypes = [ ] const homeDir = '' -const sampleConnectionData: Record = { + +type ConnectionClientType = + | Exclude + | 'tidb' + | 'yugabyte' + | 'citusdb' + | 'cockroachdb' + | 'oracledb' + | 'greenplum' + +const sampleConnectionData: { [key in ConnectionClientType]: DefaultConnection } & { [ClientType.SQLITE]: SQLiteConnection } = { [ClientType.PG]: { host: defaultHost, port: '5432', user: 'postgres', password: 'password', database: '_test', - } as DefaultConnection, + }, [ClientType.MYSQL]: { host: defaultHost, port: '3306', user: 'root', password: 'password', database: '_test', - } as DefaultConnection, + }, [ClientType.VITESS]: { host: defaultHost, port: '15306', user: 'root', password: 'password', database: '_test', - } as DefaultConnection, + }, [ClientType.MSSQL]: { host: defaultHost, port: 1433, user: 'sa', password: 'Password123.', database: '_test', - } as DefaultConnection, + }, [ClientType.SQLITE]: { client: ClientType.SQLITE, database: homeDir, @@ -112,42 +122,42 @@ const sampleConnectionData: Record {