[Solved] Alanning / meteor-roles with Typescript

Hi,

I have some issues for using alanning/meteor-roles package, with Meteor + Angular + TypeScript.

When i import:
import { Roles } from ‘meteor/alanning:roles’;

I have an error “Cannot find module ‘meteor/alanning:roles’.”

I follow this post: https://stackoverflow.com/questions/36997134/how-can-i-import-meteor-roles-in-typescript
But that doesn’t solve the issue.

Do i really need to modified meteor.d.ts?

I need some help!
Thanks & Regards

Hi maitaior,

I don’t use Typescript but from the StackOverflow answer it seems that you have to define the type info for the Roles package. I don’t know if it has to be in “meteor.d.ts” or if you can name it something else but you will definitely need to declare your types so Typescript can statically check things for you.

The referenced answer seems to have the types already declared so I would expect just adding that should resolve the issue.

Hi alanning,

Thanks for your time.

I’m newbie and i don’t know how to define the type info for the Roles package.
I tried to check how to, with some keywords like “meteor define type info package” but i found nothing relevant for my issue.

How to define the type info for the Role package? or declared types?
Do you have an example or a tutorial?

Thanks again.