Skip to content
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

useDefineForClassFields in TS 3.7+ breaks class field decorators (@property, @query) #855

Closed
6 tasks done
mzeiher opened this issue Nov 19, 2019 · 2 comments
Closed
6 tasks done
Assignees
Labels
Needs Discussion This issues needs further discussion by the team Severity: High

Comments

@mzeiher
Copy link

mzeiher commented Nov 19, 2019

Description

new "useDefineForClassFields" feature in typesccript (which will be default in 3.8.0) breaks class field decorators

This is mainly a bug for visibility/reach, here is the corresponding bug entry in the typescript project:
microsoft/TypeScript#35081

Live Demo

Repository to reproduce:
https://github.com/mzeiher/litelement-decorator-ts-define-break

Steps to Reproduce

  • yarn install
  • yarn rollup -c
  • npx http-static
  • navigate to http://127.0.0.1:3333 -> property is beeing reflected, change detection triggers
  • un-comment useDefineForClassFields in tsconfig.json
  • yarn rollup -c
  • navigate to http://127.0.0.1:3333 -> property is NOT being reflected, change detection does not trigger

Expected Results

change detection and reflection works with new [[Define]] TS semantic

Actual Results

TS [[Define]] breaks property augmentation by decorators. Babel works (they pass the propertyDescriptor of the class field into the decorator, TS just overwrites the property defined by the decorator)

Browsers Affected

  • Chrome
  • Firefox
  • Edge
  • Safari 11
  • Safari 10
  • IE 11

Versions

  • lit-element: v2.2.1
@justinfagnani
Copy link
Contributor

Thanks for bringing this up. I'll dig into it more.

cc @rictic

@sorvell
Copy link
Member

sorvell commented Nov 21, 2020

Closing as dup of https://github.com/Polymer/lit-element/issues/1030.

@sorvell sorvell closed this as completed Nov 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Discussion This issues needs further discussion by the team Severity: High
Projects
None yet
Development

No branches or pull requests

4 participants