-
Notifications
You must be signed in to change notification settings - Fork 434
fix: adds check forReflect.getOwnMetadataKeys #305
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
Conversation
Why is this change is needed even though we already check |
There are polyfils which implement I encountered this in the following context:
Then the error will be thrown. This can be solved by the developer importing I wrote in my initial comment that my change only works around the issue and does not address the root problem (an incomplete But then I saw that you are already checking for the existence of Either we throw an error if anything we need is not present or we also gracefully do nothing. |
Which polyfill is it? I'm suspect we should support such polyfills though as Metadata Proposal includes both API. https://rbuckton.github.io/reflect-metadata/
We should do nothing as metadata support is optional. |
It is the polyill which is part of Aurelia. Do you want me to find the actual code? |
I found the code in question: https://github.com/aurelia/polyfills/blob/master/src/reflect.js If you search for I think Aurelia wants only a partial implementation of the required Polyfills because that is how they define their minimal requirements.
Yeah. Then raising an error seems to be not an option. I was not 100% sure if metadata is required or not within the context of this project.
Isn't that just a consequence of using Polyfills in general? Polyfills already bloat the code because they introduce code that will hopefully become unnecessary in the future. While everything is still in flux, being extremely defensive when it comes to optional features introduced by polyfills may be warranted. But I am not sure and obviously you decide. :) The thing is that I ran into this issue while introducing Vue (class components) in an existing Aurelia project and it took me some time to realize what is going on. |
I'm not talking about bundled code size. I'm talking about more like maintainability. But I see your usecase and Aurelia's polyfill is reasonable as it is intended only to have minimal code they need. So this kind of change would make sense to me. Can we move |
533ce16
to
8edddee
Compare
8edddee
to
264fc08
Compare
@ktsn Done. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thank you!
To be honest: I am not 100% certain that this change is good because it may simply hide an incorrect configuration on the part of the developer. However since there is already a check in place for the existence of
Reflect
adding a check forReflect.getOwnMetadataKeys
may also be warranted.