According to the Aurelia documentation, @customElement
takes an “name” property. The usage in the documentation implies that this property is optional:
import {useView, customElement} from 'aurelia-templating';
import {IconButton} from './icon-button';
@useView('./icon-button.html')
@customElement()
export class AddButton extends IconButton {
constructor(){
super();
this.icon = 'plus';
this.onClick = this.add;
}
add(){
alert('Base add button');
}
}
Typescript doesn’t like that, though, and requires that you have an element name defined:
@customElement("add-button")
I ask because of component inheritance requires @customElement
to be defined on the subclass when other Aurelia properties exist on the superclass, such as @bindable
properties. See github PR and this question.
Is the documentation wrong, or the Typescript type definition?