From a5c8e8845f92a02e24c77f2793c2fde31e56b010 Mon Sep 17 00:00:00 2001 From: Sam Rose Date: Wed, 13 Mar 2024 13:38:08 +0000 Subject: [PATCH] Implement Adri's type guard suggestion. --- packages/server/src/integrations/base/sql.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/server/src/integrations/base/sql.ts b/packages/server/src/integrations/base/sql.ts index e6b9f047b9..8342c45fd7 100644 --- a/packages/server/src/integrations/base/sql.ts +++ b/packages/server/src/integrations/base/sql.ts @@ -4,9 +4,11 @@ import { QueryOptions } from "../../definitions/datasource" import { isIsoDateString, SqlClient, isValidFilter } from "../utils" import SqlTableQueryBuilder from "./sqlTable" import { + BBReferenceFieldMetadata, FieldSchema, FieldSubtype, FieldType, + JsonFieldMetadata, Operation, QueryJson, RelationshipsJson, @@ -716,7 +718,9 @@ class SqlQueryBuilder extends SqlTableQueryBuilder { return results } - _isJsonColumn(field: FieldSchema) { + _isJsonColumn( + field: FieldSchema + ): field is JsonFieldMetadata | BBReferenceFieldMetadata { return ( field.type === FieldType.JSON || (field.type === FieldType.BB_REFERENCE &&