The key in DocumentViewResponse type has only string type
- Dominant language
- JavaScript
- Stars
- 689
- Forks
- 167
- Avg merge
- 1h
- Merged PRs (30d)
- 1
Description
## 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`
Contributor guide
Research direction
Start by locating the DocumentViewResponse type and the db.view response typings in the repository. Update the key type so interfaces can use array or numeric keys, then verify that the example interface type-checks without an error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- nodejs, typescript
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 58/100