# Bug 3503: `Row` helper doesn't work with query having `one()`

- Status: closed
- Project: Zero
- Creator: @aboodman
- Created: 2025-02-05T01:36:10Z
- Modified: 2025-02-05T02:17:03Z
- URL: https://bugs.rocicorp.dev/p/zero/issue/3503

## Description

Cannot figure this out:

```ts
function foo(z: Zero<Schema>) {
  return z.query.issue.one();
}

type Foo = Row<ReturnType<typeof foo>>;
```

Yields a huge pile of gibberish:

```
Type 'Query<{ version: number; tables: { readonly user: { name: "user"; columns: { readonly id: { type: "string"; optional: false; customType: T; }; readonly login: { type: "string"; optional: false; customType: T; }; readonly name: Omit<...> & { ...; }; readonly avatar: { ...; }; readonly role: { ...; }; }; primaryKey: r...' does not satisfy the constraint 'TableSchema | Query<Schema, string, PullRow<string, Schema>>'.
  Type 'Query<{ version: number; tables: { readonly user: { name: "user"; columns: { readonly id: { type: "string"; optional: false; customType: T; }; readonly login: { type: "string"; optional: false; customType: T; }; readonly name: Omit<...> & { ...; }; readonly avatar: { ...; }; readonly role: { ...; }; }; primaryKey: r...' is not assignable to type 'Query<Schema, string, PullRow<string, Schema>>'.
    The types returned by 'related(...).related(...).materialize()' are incompatible between these types.
      Type 'TypedView<{ readonly [x: string]: PullRow<unknown, { version: number; tables: { readonly user: { name: "user"; columns: { readonly id: { type: "string"; optional: false; customType: T; }; readonly login: { type: "string"; optional: false; customType: T; }; readonly name: Omit<...> & { ...; }; readonly avatar: { ...;...' is not assignable to type 'TypedView<{ readonly [x: string]: any; }[]>'.
        Type '{ readonly [x: string]: PullRow<unknown, { version: number; tables: { readonly user: { name: "user"; columns: { readonly id: { type: "string"; optional: false; customType: T; }; readonly login: { type: "string"; optional: false; customType: T; }; readonly name: Omit<...> & { ...; }; readonly avatar: { ...; }; readon...' is not assignable to type '{ readonly [x: string]: any; }[]'.
          Type 'undefined' is not assignable to type '{ readonly [x: string]: any; }[]'.
```

## Comments (2)

### @aboodman — 2025-02-05T01:58:08Z

I'm actually confused by first line. I don't understand why `Row` param is being required to fulfill:

```
TableSchema | Query<Schema, string, PullRow<string, Schema>>
```

Seems like it should allow any `TReturn`.

### @aboodman — 2025-02-05T02:07:20Z

....and matt figured it out: https://github.com/rocicorp/mono/pull/3707
