-
Notifications
You must be signed in to change notification settings - Fork 47
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
Support gentle fallback for codebases that cannot use emitDecoratorMetadata #369
Comments
For example, for my project, I hacked together some sugar. Let me know if you want me to post the implementation (or want a PR). For example, suppose you have an entity that is defined with decorators like this:
If you didn't have decorators you could express it instead as...
Obviously, it's not as elegant being able to use decorators and you lose some type safety, but it's still worth it for me compared to the alternative, which is abandoning TypeDorm altogether and working directly with the AWS SDK. Also, I could probably modify this sugar to make it even more slick (I just hacked it together). |
The decorators in TypeDORM are a nice sugar for defining the behavior of your entities, but ultimately there are going to be many codebases that are tied to ESBuild, which has no plans of supporting decorators. If you're using Vite, you can configure it to use SWC instead of ESBuild. In my case, I'm stuck with ESBuild when compiling lambda handlers in SST.
I'm currently hacking around this by manually calling functions on
MetadataManager
(eg.addRawAttribute
), but it'd be nice if typedorm explicitly supported this. Maybe this just means mentioning this workaround in the readme. And maybe it means adding some helper functions to make this manual process a little prettier.The text was updated successfully, but these errors were encountered: