[Typescript] Problem with alanning:roles package

Hello, I’m with a Typescript problem involving alanning:roles package. I followed the steps:

  • installed the package (meteor add alanning:roles)
  • installed the @types/meteor-roles ( meteor npm install --save-dev @types/meteor-roles)
  • included the type on tsconfig file: "types": ["node", "mocha","@types/meteor-roles"]

Now I can import the Roles module perfectly, but when I try to publish the role-assignments automatically (following the package docs), the editor complains:

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

Looks like the roleAssignment property, wich refers to the Mongo Collection created by the package, is not solved/added/extended by @types/meteor-roles on the Meteor type.

Did someone experience that? if yes, could share the solution?

I searched on the internet and in the Forum but I don’t found nothing about.


> Meteor version 2.7.3
> accounts-base           2.2.4  
> accounts-password       2.3.1  
> alanning:roles          3.4.0  
> ecmascript              0.16.2  
> es5-shim                4.8.0  
> hot-module-replacement  0.5.1  
> meteor-base             1.5.1  
> mobile-experience       1.1.0  
> mongo                   1.15.0  
> react-meteor-data       2.5.1  
> reactive-var            1.0.11  
> shell-server            0.5.0  
> standard-minifier-css   1.8.1* 
> standard-minifier-js    2.8.0* 
> static-html             1.3.2  
> typescript              4.5.4  
> underscore              1.0.10  
1 Like

I think I found the same issue about this and it seems to have a workaround Problem with Meteor.roleAssignment and typescript · Issue #338 · Meteor-Community-Packages/meteor-roles · GitHub


hey @hschmaiske I really didn’t find that post you mentioned, thanks for your help. As you mentioned, it’s a workaround, but I think it’s better that just ignore it with //@ts-ignore

I will keep this suggestion until a final solution emerges.