Skip to content
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

@tsed/di overrides native metadata from 'reflect-metadata' #2399

Closed
omermorad opened this issue Aug 1, 2023 · 6 comments · Fixed by #2400
Closed

@tsed/di overrides native metadata from 'reflect-metadata' #2399

omermorad opened this issue Aug 1, 2023 · 6 comments · Fixed by #2400

Comments

@omermorad
Copy link
Contributor

Description

I have been actively working on integrating the Automock library (https://github.com/automock/automock) with various DI frameworks, including Ts.ED 🎉 . During the exploration of @tsed/di metadata mechanism, I came across a potential limitation concerning the @Inject decorator.

Presently, when using the @Inject decorator, it overrides the native metadata key of the parameter see here. This behavior can have unintended consequences, particularly when integrating with external libraries like Automock, which heavily relies on accurate metadata to automatically mock class dependencies. See:

Metadata.setParamTypes(target, propertyKey!, paramTypes);

To address this concern and ensure seamless integration with any library, I propose the addition of an extra metadata key, named original:paramtypes, in the @tsed/di infrastructure. This new key will store the original parameter types before applying any decorator modifications. By preserving the original metadata, the @Inject decorator can continue to function as intended, while also enabling 3rd party libraries to access the unaltered parameter types when needed.

@omermorad omermorad changed the title @tsed/di overrides some native metadata from 'reflect-metadata' @tsed/di overrides native metadata from 'reflect-metadata' Aug 1, 2023
omermorad added a commit to omermorad/tsed that referenced this issue Aug 1, 2023
Romakita pushed a commit to omermorad/tsed that referenced this issue Aug 11, 2023
Romakita pushed a commit to omermorad/tsed that referenced this issue Aug 15, 2023
Romakita pushed a commit to omermorad/tsed that referenced this issue Aug 15, 2023
Romakita pushed a commit to omermorad/tsed that referenced this issue Aug 15, 2023
@github-actions
Copy link

🎉 Are you happy?

If you appreciated the support, know that it is free and is carried out on personal time ;)

A support, even a little bit makes a difference for me and continues to bring you answers!

github opencollective

@Romakita
Copy link
Collaborator

🎉 This issue has been resolved in version 7.34.4 🎉

The release is available on:

Your semantic-release bot 📦🚀

@Romakita
Copy link
Collaborator

Romakita commented Sep 6, 2023

🎉 This issue has been resolved in version 7.35.0-beta.5 🎉

The release is available on:

Your semantic-release bot 📦🚀

@Romakita
Copy link
Collaborator

Romakita commented Sep 7, 2023

🎉 This issue has been resolved in version 7.35.0-rc.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@Romakita
Copy link
Collaborator

🎉 This issue has been resolved in version 7.36.0-rc.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@Romakita
Copy link
Collaborator

🎉 This issue has been resolved in version 7.36.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants