deepkit / deepkit-framework

A new full-featured and high-performance TypeScript framework
https://deepkit.io/
MIT License
3.15k stars 118 forks source link

[injector] Throw when unscoped service has a scoped dependency #123

Closed marcj closed 2 years ago

marcj commented 2 years ago

Currently it's possible to inject HttpRequest into a non-http service. This works only when the service is instantiated during a http scope injector when the the frontInjector has HttpRequest available. For the next request, the frontInjector changed, but the non-http service is still alive basically keeping the initial HttpRequest forever. We need to make sure that it throws when a non-http service has http-scoped dependencies.

marcj commented 2 years ago

Fixed in https://github.com/deepkit/deepkit-framework/commit/401a0553c7b02519dec8d68ac99f21f660d8b890