Decorators should work with standard decorators. #1988
justinfagnani
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Lit 3.0 added support for standard decorators. While, the choice between TypeScript experimental decorators and standard decorators is a local choice - components and libraries built with one work with the other - it is impossible to mix decorator types in a single compilation unit. One component has to use all experimental or all standard decorators.
This means that someone can't mix
@watch()
,@debounce()
, or@defaultValue()
with standard decorators. It also means that those decorators might be written in a way that difficult to port to standard decorators due to its more restrictive API with regards to class access and mutation. Making the decorators work with both specs could then be good future-proofing to limit breaking changes.In Lit we made the same decorators work with both specs by duck-typing the arguments to the decorator functions, and tested by having two tsconfigs for the tests. This should be doable within your build script.
Beta Was this translation helpful? Give feedback.
All reactions