diff --git a/crates/bindings-typescript/src/server/views.ts b/crates/bindings-typescript/src/server/views.ts index accd0c92563..c81cad2b1f7 100644 --- a/crates/bindings-typescript/src/server/views.ts +++ b/crates/bindings-typescript/src/server/views.ts @@ -18,7 +18,11 @@ import { } from '../lib/type_builders'; import { bsatnBaseSize, toPascalCase } from '../lib/util'; import type { ReadonlyDbView } from './db_view'; -import { type QueryBuilder, type RowTypedQuery } from './query'; +import { + isRowTypedQuery, + type QueryBuilder, + type RowTypedQuery, +} from './query'; import { exportContext, registerExport, @@ -178,7 +182,7 @@ export function registerView< const originalFn = fn; fn = ((ctx: ViewCtx, args: InferTypeOfRow) => { const ret = originalFn(ctx, args); - return ret == null ? [] : [ret]; + return isRowTypedQuery(ret) ? ret : ret == null ? [] : [ret]; }) as any; returnType = AlgebraicType.Array( returnType.value.variants[0].algebraicType