I am trying to install pouchdb in a typescript (ionic) application. The types don't work
npm install --save pouchdb
npm install --save-dev @types/pouchdb
When I try to use it (import Pouchdb from 'pouchdb'), I get this error
ERROR in src/app/services/pouchdb.service.ts(3,8): error TS1192: Module '"C:/Users/User/PROG/toto/node_modules/@types/pouchdb/index"' has no default export.
I tried
import * as Pouchdb from 'pouchdb'
The error disappears here, but appears after, I still can't use the pouchdb functions.
Is there a solution?
export = ...
), so you need to enable theesModuleInterop
compiler option if you wantimport PouchDB from 'pouchdb'
to work. IfesModuleInterop
is disabled, then the second approach should have worked (althoughimport Pouchdb = require('pouchdb')
would be better practice); if you'd like help with it, please post the exact error you got and the code it occurred in. – Matt McCutchen