У меня выводится консольное предупреждение о том, что "свойство 'Collection' не существует для типа 'typeof Mongo'". при составлении метеора. Мне интересно, сталкивался ли кто-нибудь из вас с этим и как вы это решили.
Я использую метеор / реагирую
Код моего машинописного класса:
import { Mongo } from 'meteor/mongo';
import MongoCollection from '../../lib/MongoCollection';
class entries extends MongoCollection {
public collection: any;
constructor() {
super();
this.collection = new Mongo.Collection('entries');
}
}
export let Entries = new entries();
MongoColection.ts - это
import * as _ from 'lodash';
import * as moment from 'moment-timezone';
interface commonSchema {
_id: string;
createdAt?: string;
updatedAt?: string;
}
class MongoCollection {
collection: any;
aggregate = (selector: object = {}, options: object = {}) => {
return this.collection.aggregate(selector, options);
}
find = (selector: object = {}, options: object = {}) => {
return this.collection.find(selector, options);
}
first = (selector: object = {}, options:object = {}) => {
return this.collection.findOne(selector, options);
}
where = (selector: object = {}, options: object = {}) => {
return this.find(selector, options).fetch();
}
count = (selector: object = {}, options: object = {}) => {
return this.find(selector, options).count();
}
beforeInsert = (doc: commonSchema, beforeInsertAttrs: object): object => {
const { createdAt } = doc;
if (typeof createdAt === 'undefined') {
doc.createdAt = moment().tz('America/New_York').format();
}
doc.updatedAt = moment().tz('America/New_York').format();
_.extend(doc, beforeInsertAttrs);
return doc;
}
insert = (doc, beforeInsertAttrs): string => {
let newDoc: object = this.beforeInsert(doc, beforeInsertAttrs);
const _id: string = this.collection.insert(newDoc);
return _id;
}
update = () => {}
}
export default MongoCollection;
и консольное предупреждение
Property 'Collection' does not exist on type 'typeof Mongo'.
любая помощь приветствуется. спасибо!