Module '"@types/pouchdb/index"' has no default export

#1

I want to use pouchdb. It worked in my ionic3 version of the app, but when switching to v4, i get this problem.
From a blank app, I install pouchdb and its types :

npm install --save pouchdb
npm install --save @types/pouchdb

But then, if in home.ts I try (it worked before)

import PouchDB from 'pouchdb';

I get this error :

Module '"@types/pouchdb/index"' has no default export.

I tried the same from a blank v3 app, the issue is the same. I think there is something broken in the typings ?
Or do I miss something ?

1 Like
#2

facing same issue, in ionic4.

#3
const PouchDB = require('pouchdb').default;
const PouchDB_Plugin_Find = require('pouchdb-find').default;

instead of import… did the job for me
then

constructor(private storage:Storage) {
		PouchDB.plugin(PouchDB_Plugin_Find);
...}
#4

issue solved
add line "allowSyntheticDefaultImports": true to tsconfig.json file
Thanks,