Buffer type declaration from Node conflicts with the PouchDB one
- Dominant language
- JavaScript
- Stars
- 17.6k
- Forks
- 1.5k
- PR merge metrics
- No merged PRs in 30d
Description
Hi guys! I am new to both TypeScript (I have some JS background) and PouchDB. I found your site and the API exciting, managed to draft a few of examples in JS and thought I'd kick-start an experimental project using PouchDB and TypeScript. Unfortunately, I have run into the issue below while trying to compile a very simple script.
### Issue
When using the TypeScript compiler, I get an error saying that a Node (sic!) type declaration tries to export a non-local type (indeed, it's defined in the `@types/pouchdb-core`):

### Info
- Environment: Node 16.17.0
- Platform: not applicable
- Adapter: leveldb (really, not applicable)
- Server: not applicable
### Reproduce
I have created an [SSCCE repo](https://github.com/szubtsovskiy/pouchdb-typescript-issue-sscce). Just clone it, and run:
```
npm install
npx tsc
```
I was able to work around this by monkey-patching the type declarations, namely, wrapping `interface Buffer extends Uint8Array` in `@types/pouchdb-core/index.d.ts` in `declare module 'pouchdb-override' { ... }` . This resolved the compilation issue for me. I am not sure if it is the best way to address this, although I kinda see why it helped. If this solution is good, I am happy to raise a pull request, please guide me where to do it.
I do apologise if this repo was a wrong place to report this issue. If possible, please guide me to a proper repo then. Thank you very much.
Contributor guide
Assessment
This issue has not been assessed yet.