apache / apache/couchdb-nano

Typescript definitions and views with composite keys

Open
#182 2 comments 2 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
689
Forks
167
Avg merge
1h
Merged PRs (30d)
1

Description

When accessing a view with a composite key (e.g. something like `['This', 'is', 'a', 'key', 123]`, the key type in the `DocumentViewResponse.rows` field is statically defined as `string`. I can cast it to `unknown` and then to `any[]` (which would be correct in my case), but that seems to be cumbersome to me. Am I using the interface wrong or is this type definition insufficient.

Something rather odd as a side note: my nano version is 8.1.0, but when opening the type definition file, it says "// Type definitions for nano 6.4" at the top. This is a fresh, clean install into a new project.

Contributor guide

Open the contributing guide

Research direction

Locate the TypeScript definition file and inspect DocumentViewResponse.rows, then compare its declared key type with the composite-key example in the report. Confirm the corrected type with a type-checking example and verify that the definition header matches the installed nano 8.1.0 version.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.