Skip to content

Conversation

@trusktr
Copy link
Member

@trusktr trusktr commented Sep 15, 2024

This keeps the type of static observedAttributes clean and aligned with the DOM spec, while the new static observedAttributeHandlers has the type definition for the library-specific feature. Plus this prevents type issues downstream because the @element decorator (callable as a function when not using decorators) coerces the object format into the standard array format, yet the object type will still sppear in subclasses despite that it is never an object in subclasses.

  • deprecation: static observedAttributes = {} is deprecated, and only the standard static observedAttributes = [] should be used. The object format will be removed in a breaking version bump.

  • infra: Unrestrict the typescript version so we can keep it updated with other packages in the lume repo.

…s a map of attribute names to attribute handlers for non-decorator users, and instead create a new `static observedAttributeHandlers` for that purpose. This keeps the type of `static observedAttributes` clean and aligned with the DOM spec, while the new `static observedAttributeHandlers` has the type definition for the library-specific feature. Plus this prevents type issues downstream because the `@element` decorator (callable as a function when not using decorators) coerces the object format into the standard array format, yet the object type will still sppear in subclasses despite that it is never an object in subclasses.

    - deprecation: `static observedAttributes = {}` is deprecated, and only the standard `static observedAttributes = []` should be used. The object format will be removed in a breaking version bump.
- infra: Unrestrict the `typescript` version so we can keep it updated with other packages in the lume repo.
@trusktr trusktr merged commit 8287981 into main Sep 15, 2024
@trusktr trusktr deleted the improve-observedAttributes-type branch September 15, 2024 07:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants