使用 angular2-meteor 在 Mongo.Collection 上找不到 attachSchema 属性

Cannot find attachSchema property on Mongo.Collection with angular2-meteor

这是我的问题:

我想使用简单模式的强大功能来根据以下模式检查我的插入内容:

let UprocSchema = new SimpleSchema({
    "name": { type : String, label: "Nom Uproc" },
    "label": { type : String, label: "Libellé Uproc" },
    "status": { type : String, label: "Status UPR" }
});

出于某种原因我忽略了,即使 SimpleSchema 似乎实例化得很好,我也无法在 Mongo.Collection 上使用 attachSchema 属性。

这是我的代码:

let repo_collection = new Mongo.Collection('repository');
export const Repository = new MongoObservable.Collection<Uproc>('repo_collection');
repo_collection.attachSchema( UprocSchema );

这是我的错误信息:

Property 'attachSchema' does not exist on type 'Collection<{}>'.

TypeError: repo_collection.attachSchema is not a function

attachSchema[collection2][1] 包的一部分。

Documentation 状态:

Create one or more SimpleSchema instances and then use them to validate objects. By adding the aldeed:collection2 package to your app, you can attach them to collections to get automatic validation of your insert and update operations.