【问题标题】:how do i use pouch db with typescript for cordova applications我如何将 pouch db 与 typescript 一起用于 cordova 应用程序
【发布时间】:2018-07-01 15:10:29
【问题描述】:
import * as PouchDB from 'pouchdb';
import PouchCdvAdapter from "pouchdb-adapter-cordova-sqlite";

从 Nodejs 导入 PouchDb 正在工作

var db = new PouchDB('mydb.db', {adapter: 'cordova-sqlite'});

得到类似 PouchDB is not a constructor 上述代码的错误

【问题讨论】:

    标签: cordova typescript pouchdb angular6


    【解决方案1】:

    按照docs 中的说明进行操作。

    1. npm install pouchdb @types/pouchdb

    2. 在您的"compilerOptions" 中添加"allowSyntheticDefaultImports": true tsconfig.json

    3. import * as PouchDB from 'pouchdb'; 替换为import PouchDB from 'pouchdb';

    希望对你有帮助。

    【讨论】:

      猜你喜欢
      • 2016-01-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-05-12
      相关资源
      最近更新 更多