Search code examples
node.jstypescriptcouchdbpouchdbnode-modules

How do I use pouchdb with typescript?


I am trying to use pouchdb with Typescript. I cannot link to the pouchdb module.

import { PouchDB } from "pouchdb"

reports that it cannot find module pouchdb, even though it is in node_modules.

I also cannot find the appropriate typings for pouchdb.


Solution

  • I managed to get the module recognised by using

    declare function require(a)
    
    var PouchDB = require("pouchdb")
    

    I have given up type checking, but at least I can make progress.