typestack / typedi

Simple yet powerful dependency injection tool for JavaScript and TypeScript.
https://docs.typestack.community/typedi/v/develop/01-getting-started
MIT License
3.99k stars 166 forks source link

Question: Service Injection working incorrectly #1196

Open jdeal391890293 opened 10 months ago

jdeal391890293 commented 10 months ago

Objective: I aimed to share the same dependency injection container between an Apollo GraphQL API and a REST API. Both APIs employ constructor-based service injection, and I intended to reuse the declared service in this shared container.

Issue Encountered: While the constructor-based service injection works seamlessly within the GraphQL API, an issue arises when attempting to utilize the same services in the REST API. Upon doing so, the GraphQL API begins to malfunction, logging all services as undefined.

Request for Assistance: I'd appreciate any guidance or advice on resolving this issue. It's imperative for both APIs to cohesively share the same services without compromising functionality.

attilaorosz commented 10 months ago

Could you provide a basic reproduction code? Never heard of something like this before.