-
Notifications
You must be signed in to change notification settings - Fork 319
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
Add ability to override default converter and default getter/setter #891
Comments
You can already override Overriding the accessor creation is harder right now because |
I tried overriding the We've come up with a workaround for now, it's a function that we pass each class into that reads the existing static |
Typescript complains when you override
|
Closing this issue in favor of #911 where we're tracking this issue. |
Description
It would be great if it were possible to override the defaultConverter for attributes, and the default getter/setter for properties.
My team is converting our existing web components library over to lit-element. We made some not-so-great decisions in our components, but we want to keep the behavior for now for backwards compatibility reasons. The main bad decision is that we special case boolean attributes so that the string "false" is treated falsy (contrary to native boolean attributes which are a presence check). We also coerce properties, so setting a boolean property to the string "false" would convert it to boolean false. We have similar conversions for number, array, and object.
With the way lit is now, this means that every single boolean property requires us to set a custom converter, and we also need to define our own getter/setter. This is a lot of boiler plate for us, and really puts a damper on the development process. If we were able to override the defaultConverter & getters/setters, then we could simply subclass
LitElement
, override these to get our behavior, and that would be it.The text was updated successfully, but these errors were encountered: