Skip to content

The key in DocumentViewResponse type has only string type #346

@moheb2000

Description

@moheb2000

Expected Behavior

If we want to create an interface and extends DocumentViewResponse for the result of db.view function, we can't provide other types other than string for key property of view. Suppose I use an array as my key like [date, tag] or a number as my key. So I need to define other types than string for my key in interface.

Current Behavior

This will not work:

interface IPostViewResponseByTag extends DocumentViewResponse<{ title: string }, Post> {
    rows: {
      id: string;
      key: string[]; // Error here
      value: { title: string };
    }[],
}

Possible Solution

Add other types to key like key: string | string[] | etc

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions