From 2b0c32ea21744983ca219364d6b7433396552d39 Mon Sep 17 00:00:00 2001 From: 7ttp <117663341+7ttp@users.noreply.github.com> Date: Sat, 31 Jan 2026 13:16:10 +0530 Subject: [PATCH 1/3] fix: use Record for zero-arg functions to prevent computed field false positive --- src/server/templates/typescript.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/server/templates/typescript.ts b/src/server/templates/typescript.ts index 352c4ddc..124b13cd 100644 --- a/src/server/templates/typescript.ts +++ b/src/server/templates/typescript.ts @@ -410,7 +410,7 @@ export const apply = async ({ ) => { return fns .map(({ fn, inArgs }) => { - let argsType = 'never' + let argsType = 'Record' let returnType = getFunctionReturnType(schema, fn) // Check for specific error cases From 5a41d9e62acbf71a08581e83a3dc8338f862a131 Mon Sep 17 00:00:00 2001 From: 7ttp <117663341+7ttp@users.noreply.github.com> Date: Sat, 31 Jan 2026 13:31:28 +0530 Subject: [PATCH 2/3] fix: include scalar computed fields in table Row types --- src/server/templates/typescript.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/server/templates/typescript.ts b/src/server/templates/typescript.ts index 124b13cd..d6377a5f 100644 --- a/src/server/templates/typescript.ts +++ b/src/server/templates/typescript.ts @@ -63,13 +63,14 @@ export const apply = async ({ const columnsByTableId: Record = {} const tablesNamesByTableId: Record = {} const relationTypeByIds = new Map() - // group types by id for quicker lookup const typesById = new Map() const tablesLike = [...tables, ...foreignTables, ...views, ...materializedViews] + const tableAndViewNames = new Set() for (const tableLike of tablesLike) { columnsByTableId[tableLike.id] = [] tablesNamesByTableId[tableLike.id] = tableLike.name + tableAndViewNames.add(tableLike.name) } for (const column of columns) { if (column.table_id in columnsByTableId) { @@ -197,7 +198,9 @@ export const apply = async ({ getTableNameFromRelationId(func.return_type_relation_id, func.return_type_id)) || // OR if the function takes a table row but doesn't qualify as embedded (for error reporting) (relationTypeByIds.get(inArgs[0].type_id) && - !getTableNameFromRelationId(func.return_type_relation_id, func.return_type_id)))) + !getTableNameFromRelationId(func.return_type_relation_id, func.return_type_id)) || + // OR if the function takes a table/view row (computed field) + tableAndViewNames.has(func.argument_types))) ) { introspectionBySchema[func.schema].functions.push({ fn: func, inArgs }) } From 8b82c35a0190db86ca0cd154e6539f64e618b2d9 Mon Sep 17 00:00:00 2001 From: Vaibhav <117663341+7ttp@users.noreply.github.com> Date: Wed, 18 Feb 2026 16:22:15 +0530 Subject: [PATCH 3/3] Update src/server/templates/typescript.ts Co-authored-by: Andrew Valleteau --- src/server/templates/typescript.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/server/templates/typescript.ts b/src/server/templates/typescript.ts index d6377a5f..e064577a 100644 --- a/src/server/templates/typescript.ts +++ b/src/server/templates/typescript.ts @@ -63,6 +63,7 @@ export const apply = async ({ const columnsByTableId: Record = {} const tablesNamesByTableId: Record = {} const relationTypeByIds = new Map() + // group types by id for quicker lookup const typesById = new Map() const tablesLike = [...tables, ...foreignTables, ...views, ...materializedViews] const tableAndViewNames = new Set()