is there any reason to use @Injectable in custom repositories like you did in ProductsRepository? Will this work without adding it to the providers array?
Hi! My name Antonio, for friends Tony, I'm Full Stack Software Developer - Open Source enthusiast, TS/JS enthusiast, NestJS Contributor, passionate about NestJS, Fastify, Angular and React/Next.js
my writing error, thanks for the correct report, it works even without the @injectable decorator, I corrected the post, in fact at the beginning of the post I had written it correctly.
Yes, it does work without @Injectable it's happened to me when I did a tech test and it was pointed out to me at the interview. But I still don't know why, it shouldn't work?
is there any reason to use
@Injectable
in custom repositories like you did inProductsRepository
? Will this work without adding it to theproviders
array?nvm. I just tried this and confirm that we can't inject things on custom repository because they aren't controlled by Nest container.
More on this here: stackoverflow.com/a/65227341/5290447
my writing error, thanks for the correct report, it works even without the
@injectable
decorator, I corrected the post, in fact at the beginning of the post I had written it correctly.Yes, it does work without
@Injectable
it's happened to me when I did a tech test and it was pointed out to me at the interview. But I still don't know why, it shouldn't work?Btw, thanks for this post!! 🔥