Meteor-Community-Packages / meteor-roles

Authorization package for Meteor, compatible with built-in accounts packages
http://meteor-community-packages.github.io/meteor-roles/
MIT License
921 stars 167 forks source link

Property 'roles' does not exist on type 'typeof Meteor' #214

Closed epezhman closed 4 years ago

epezhman commented 8 years ago

Hi, I'm developing a Meteor v1.4.1 andAngular 2 rc.5 app and I'm trying to use the meteor-role, the package works alright but there is a problem with typings.

I installed the typings from meteor-typings/alanning-roles but it didn't fix all the messages, when I run the meteor I get messages like this: Property 'roles' does not exist on type 'typeof Meteor', which comes from here in my publications:

Meteor.publish(null, function () {
    return Meteor.roles.find({})
});

Any idea how to fix this? thanks

rodrilink commented 7 years ago

I've solved by installing the type definition: sudo npm i @types/meteor-roles --save-dev

Slavrix commented 7 years ago

ive got @types/meteor-roles installed and referenced in my tsconfig file and i still get this error.

srokatonie commented 7 years ago

Same problem as @Slavrix ...

medisoft commented 6 years ago

I have the same problem

Property 'roles' does not exist on type 'typeof Meteor'.

I installed with this:

typings install github:meteor-typings/alanning-roles#9960894dba03dbaf0b2a03986ed8d041e6d629e0 --global

alanning commented 6 years ago

Sorry everyone, I don't use typescript so don't know what's going on there. Meteor.roles is a MongoDB collection that is just set on the Meteor object if that helps. Perhaps you could define your own "type definition" for that property on the Meteor object?

Alternatively, you could copy the roles package into your local app/packages directory and remove this part from the code:

Meteor.publish(null, function () {
    return Meteor.roles.find({})
});

All that's doing is making sure that the roles collection is published by default. But its not necessary.

mitar commented 4 years ago

I think this issue belongs to https://github.com/meteor-typings/alanning-roles?