-
Notifications
You must be signed in to change notification settings - Fork 382
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
Component constructors cannot be new-ed #2970
Comments
This issue has been linked to a new work item: W-11533536 |
Updated the description, I was wrong about |
I think it may be intentional but I'm not 100% sure. @caridy might know. |
It is intentional. Basically, what should be the result of |
@caridy Thanks, that makes sense. I guess in my head, I was thinking that I'm not totally convinced this is something we need to support, though. That's why we have |
Exactly, you don't do |
Probably a different aspect of the same issue: you can manually create an element called |
Well, with #2724 that's not longer observable... so creating x-foo that was claimed by LWC via a pivot is not visible to user-land code, so for them creating that element will NOT upgrade it and will not give you any hint that it is indeed already registered, and a definition after that will in fact upgrade the manually created element. |
Pivots are still observable, just not 100% observable. If you do |
|
My point is that if we do this:
So in that sense, the pivots are "observable." |
I see! maybe we can make it a class considering that in IE11 that's the case anyways... so we can target the path of patching to use a class instead of an actual function. What do you think? |
@caridy I'm not sure I understand. We already do use a class, not a function:
We can discuss offline if it's easier. 🙂 |
This is a duplicate of #3202 |
Description
Maybe this is working as designed, but it seems a bit surprising (at least to me).
Steps to Reproduce
new Component()
throwsIllegal constructor
fromLightningElement
Expected Results
No error thrown
Actual Results
Version
LWC 2.21.1
Possible Solution
Use
lwc.createElement
instead.The text was updated successfully, but these errors were encountered: