-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Proxied object has function type instead of object type #82
Comments
Hm, if I remember correctly, there was some issue with proxying functions instead of objects. If I remember correctly, JavaScript then complained, that the object's signature doesn't implement the The problem is, that we don't know the actual type before creating the proxy. It ts created at bootstrap, but the instance it proxies to is created on each request anew. And the Proxy cannot trap the Can you tell me what your use-case is? I will try to revisit if there's some way to get around this. |
@Papooch the usecase is using nestjs-cls with typeorm 0.3.17 (we used to use 0.2.34). After we upgraded to 0.3.17, then this line of code (where the usecase is switching on the typeorm |
I see, hmm. Your options are currently:
I'll try to think of some other way in the new version and add this information to the documentation. |
A fix has been merged and will be released in a future version ( |
Proxy is defined as
()=>null
at https://github.com/Papooch/nestjs-cls/blob/main/packages/core/src/lib/proxy-provider/proxy-provider-manager.ts#L95C20-L95C25Is there a specific reason for doing that instead of defining it as an empty object? It's causing object retrieved from cls has
typeof proxiedObject
equal to function instead of object.The text was updated successfully, but these errors were encountered: