• Public
  • Public/Protected
  • All

Interface PropertyDeclaration<Type, TypeHint>

Defines options for a property accessor.

Type parameters

  • Type

  • TypeHint


  • PropertyDeclaration



Optional attribute

attribute: boolean | string

Indicates how and whether the property becomes an observed attribute. If the value is false, the property is not added to observedAttributes. If true or absent, the lowercased property name is observed (e.g. fooBar becomes foobar). If a string, the string value is observed (e.g attribute: 'foo-bar').

Optional converter

converter: AttributeConverter<Type, TypeHint>

Indicates how to convert the attribute to/from a property. If this value is a function, it is used to convert the attribute value a the property value. If it's an object, it can have keys for fromAttribute and toAttribute. If no toAttribute function is provided and reflect is set to true, the property value is set directly to the attribute. A default converter is used if none is provided; it supports Boolean, String, Number, Object, and Array. Note, when a property changes and the converter is used to update the attribute, the property is never updated again as a result of the attribute changing, and vice versa.

Optional noAccessor

noAccessor: undefined | false | true

Indicates whether an accessor will be created for this property. By default, an accessor will be generated for this property that requests an update when set. If this flag is true, no accessor will be created, and it will be the user's responsibility to call this.requestUpdate(propertyName, oldValue) to request an update when the property changes.

Optional reflect

reflect: undefined | false | true

Indicates if the property should reflect to an attribute. If true, when the property is set, the attribute is set using the attribute name determined according to the rules for the attribute property option and the value of the property converted using the rules from the converter property option.

Optional type

type: TypeHint

Indicates the type of the property. This is used only as a hint for the converter to determine how to convert the attribute to/from a property.


Optional hasChanged

  • hasChanged(value: Type, oldValue: Type): boolean
  • A function that indicates if a property should be considered changed when it is set. The function should take the newValue and oldValue and return true if an update should be requested.


    • value: Type
    • oldValue: Type

    Returns boolean

Generated using TypeDoc