我正在尝试连接到PouchDB数据库,我收到了错误
Typescript Cannot use 'new' with an expression whose type lacks a call or construct signature
以下是我的代码: -
var PouchDB = require("pouchdb");
@Injectable()
export class PouchDBService {
private isInstantiated: boolean;
private database: any;
public constructor(private http: Http) {
if(!this.isInstantiated) {
this.database = new PouchDB("db_name"); <--error at this line
this.isInstantiated = true;
}
答案 0 :(得分:0)
@types/pouchdb可能会有所帮助。
答案 1 :(得分:0)
您可能需要pouchdb,如下所示:
import * as PouchDB from "pouchdb";
然后可以做到:
this.database = new PouchDB("db_name"); //should work