I have an AuthModule with a Role enum being exported in auth/index.ts. I also have an Authorized decorator saying which roles are allowed being exported in auth/auth.decorator.ts.
When I try to use the enum or the decorator to protect routes in the UserController in the UserModule, I get undefined compilation errors such Role has no property ADMIN.
Ability to use the decorator and enum outside of the auth module.
Nest version: 6.2.4
I can't find this behavior mentioned in the docs at all.
Don't use export * from './somefile.whatever.ts' and also the relative import will not work there, you need the full path, at least where the file is located.
I didn't know if that's a must, but when i face that issue and the DI goes crazy, i just use the full path, and it works.
Also i should mention that it only happens with guards and interceptors ?!
I think it's a bug in Typescript it self? IDK to be honest.
By the way, if it's a bug in Typescript, i think the docs should have a note about that.
Is there a bug in the TS repository I can refer to? Otherwise I will open one
Is there a bug in the TS repository ...
As i said I'm not sure of that 馃槄, I'm just guessing 馃槼
Alright. I am gonna open one then and see what happens. Thanks for your help. Your advice fixed my problem.
This could be related to a common issue in NodeJS where it caches module references as they get loaded.
@kowsheek is there a bug in the nodejs or v8 repos that I could refer to?
If I understand the issue correctly, it's not a bug in NodeJS, but rather a documented "feature". There's an open issue on TS about it.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Most helpful comment
If I understand the issue correctly, it's not a bug in NodeJS, but rather a documented "feature". There's an open issue on TS about it.