apache / apache/couchdb-nano

Exposing Types for TypeScript

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

Description

Typings for Nano are not exposed or able to import through TypeScript

## Expected Behavior
being able to define types and add Nano.ServerScope as a typings to my objects and functions
`const NanoInstances = new Map();`

## Current Behavior
instead, we have to create a dummy instance to localhost and extract the reference as follows
```ts
const nanoInstance = Nano('http://localhost:5894');
type NanoType = typeof nanoInstance;

// Now you can use NanoType to reference the typings
const NanoServers = new Map();

function findDoc (instance: NanoType, doc: string){
//...
}
```

## Possible Solution
just need to expose the types through an entry point or export them directly

## Context
I am building a modular platform that allows multiple Nano instances to be present and are configured dynamically.
since we are using strict type safety, its better to use the correct typing's vs `any` or `unknown`

## Your Environment
* Version used: "nano": "^10.1.3",
* Browser Name and version: node v18.17.0

Contributor guide

Open the contributing guide

Research direction

No file or test is named in the issue. Start by locating the package's existing TypeScript declarations and public export entry point, then verify that ServerScope can be imported without creating a Nano instance; add or update focused type/export coverage if the repository has it.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs, typescript
Domain
developer-experience
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.