After inspecting the source code of jQTree, written in Typescript, available at https://github.com/mbraak/jqTree, I came across the following snippet:
export default class SimpleWidget{
protected static defaults = {};
public options:any
protected $el : JQuery
constructor(el:Element,options:any){
this.$el = $(el);
console.log(typeof SimpleWidget)
let defaults = (<typeof SimpleWidget>this.constructor).defaults;
console.log(defaults)
this.options = $.extend({},defaults,options);
}
}
Can you explain what (this.constructor) means? How does it access the static property after assertion?