From 295fc9a551251d97b997b68e5301c6275f99998d Mon Sep 17 00:00:00 2001 From: "Visal .In" Date: Wed, 27 Nov 2024 09:46:16 +0700 Subject: [PATCH] fixing typecheck --- src/drivers/postgres/postgres-driver.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/drivers/postgres/postgres-driver.ts b/src/drivers/postgres/postgres-driver.ts index a75a758..d751618 100644 --- a/src/drivers/postgres/postgres-driver.ts +++ b/src/drivers/postgres/postgres-driver.ts @@ -178,8 +178,9 @@ WHERE const tableKey = column.table_schema + "." + column.table_name; - if (tableRecord[tableKey]?.tableSchema) { - tableRecord[tableKey].tableSchema.columns.push(columnItem); + const tableSchema = tableRecord[tableKey].tableSchema; + if (tableSchema) { + tableSchema.columns.push(columnItem); } } @@ -218,8 +219,9 @@ WHERE } constraintRecord[constraintKey] = constraintItem; - if (tableRecord[tableKey].tableSchema) { - tableRecord[tableKey].tableSchema.constraints = [ + const tableSchema = tableRecord[tableKey]?.tableSchema; + if (tableSchema) { + tableSchema.constraints = [ ...(tableRecord[tableKey].tableSchema?.constraints ?? []), constraintItem, ];