Automattic / Automattic/mongoose

Export types to be able to extend from the Mongoose class

Open
#12,456 1 comment 0 reactions 0 assignees View on GitHub
typescript
Dominant language
JavaScript
Stars
27.5k
Forks
4k
Avg merge
2d 7h
Merged PRs (30d)
35

Description

### Prerequisites

- [X] I have written a descriptive issue title
- [X] I have searched existing issues to ensure the bug has not already been reported

### Mongoose version

6.6.1

### Node.js version

18.x

### MongoDB server version

5.x

### Description

Currently the type definitions only export ``mongoose`` as module but don't allow to import the actual ``Mongoose`` class so that we can extend in TS from.

### Steps to Reproduce

``` typescript
import {Mongoose} from 'mongoose'

export class Database extends Mongoose {
....

public async connect(): Promise {
...

await supper.connect(...);
return true;
}
}
```

### Expected Behavior

I'm able to extend the base Mongoose class within TypeScript.

Contributor guide

Open the contributing guide

Research direction

Start by locating the TypeScript type definitions and the exported module entry point for Mongoose. Check how the Mongoose class is currently declared and exported, then verify that `import { Mongoose } from 'mongoose'` can be extended by a TypeScript class and that the resulting type definitions compile.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.