-
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
create-react-app TypeScript @property decorator not creating accessors correctly #878
Comments
The accessor looks to be correctly added to the prototype but somehow it's being overridden again on the instance with a standard JS property. This is why deleting it allows the decorated accessors to kick-in |
Is create-react-app using the |
Assuming this is a duplicate of #855 since we haven't heard otherwise. |
Hey @justinfagnani, just happened to stumble upon this issue while Googling, and thought I'd just add color while I'm here: create-react-app uses babel, so this issue likely refers to an issue with Babel (and maybe Babel's Typescript transform), and not Typescript itself. That said, this issue could be in the neighborhood of #855 in terms of output (I haven't compared the two in detail), but it would relate to Babel, not Typescript. |
Ok, thanks for the detail @emilio-martinez! |
I finally got to the bottom of this issue so just want to share here in case other people encountered it. Recently I need to integrate a web application written by Then I created a minimum replication with Took me a while before I realised what's going on here. The issue is caused by As you can see from the babel script that It is set to Also for Nrwl/nx based monorepo projects, it's the same situation: After overriding this setting from Someone also mentioned this issue here with |
@owen26 how, exactly, did you get this to work with |
Description
When using the default TypeScript settings in
create-react-app
it seems that the@property
decorator isn't creating the accessors correctly. Strangle running a delete (delete this.text
) on the property fixes the accessors.Workaround
To get the accessors working for the moment just run a delete on the property you created in the constructor.
Demo
https://github.com/karlbennett/litelement-property-bug
Steps to Reproduce
Example:
my-element
text
property tomy-element
with the@property
decorator.my-element
tag in some HTML.my-element
tag instance.text
property (myElement.text = 'some new text.';
).Expected Results
A property update should trigger update events/methods (
update
,updated
);Actual Results
The events/methods are not triggered on a property update.
Browsers Affected
Versions
The text was updated successfully, but these errors were encountered: