Open unlight opened 3 years ago
At least the typing needs to be fixed. RequestContext::get()
method return type should be T | undefined
as the docs says that getStore()
can return undefined
.
If called outside of an asynchronous context initialized by calling asyncLocalStorage.run() or asyncLocalStorage.enterWith(), it returns undefined.
I'm doing how it is described in readme. However, it does not work for services which created on application start. Only for scoped services, like controllers, graphql resolvers.
Is it possible to get it worked for singleton services?