chore: 🏷️ Aggiornati tipi di dato del componente base

This commit is contained in:
Maicol Battistini 2021-08-03 23:12:53 +02:00
parent fd4b756bcb
commit 43ceb11755
No known key found for this signature in database
GPG Key ID: 4FDB0F87CDB1D34A
1 changed files with 8 additions and 11 deletions

View File

@ -53,46 +53,43 @@ export default class Component implements ComponentAttrs {
* @inheritdoc * @inheritdoc
* @abstract * @abstract
*/ */
view(vnode: Mithril.vnode) {} view(vnode: Mithril.Vnode): Mithril.Children {}
/** /**
* @inheritdoc * @inheritdoc
*/ */
oninit(vnode: Mithril.vnode) { oninit(vnode: Mithril.Vnode) {
this.setAttrs(vnode.attrs); this.setAttrs(vnode.attrs);
} }
/** /**
* @inheritdoc * @inheritdoc
*/ */
oncreate(vnode: Mithril.vnode) { oncreate(vnode: Mithril.VnodeDOM) {
this.element = vnode.dom; this.element = vnode.dom;
} }
/** /**
* @inheritdoc * @inheritdoc
*/ */
onbeforeupdate(vnode: Mithril.vnode) { onbeforeupdate(vnode: Mithril.VnodeDOM) {
this.setAttrs(vnode.attrs); this.setAttrs(vnode.attrs);
} }
/** /**
* @inheritdoc * @inheritdoc
*/ */
onupdate(vnode: Mithril.vnode) { onupdate(vnode: Mithril.VnodeDOM) {}
}
/** /**
* @inheritdoc * @inheritdoc
*/ */
onbeforeremove(vnode: Mithril.vnode) { onbeforeremove(vnode: Mithril.VnodeDOM) {}
}
/** /**
* @inheritdoc * @inheritdoc
*/ */
onremove(vnode: Mithril.vnode) { onremove(vnode: Mithril.VnodeDOM) {}
}
/** /**
* Returns a jQuery object for this component's element. If you pass in a * Returns a jQuery object for this component's element. If you pass in a
@ -120,7 +117,7 @@ export default class Component implements ComponentAttrs {
* *
* @see https://mithril.js.org/hyperscript.html#mselector,-attributes,-children * @see https://mithril.js.org/hyperscript.html#mselector,-attributes,-children
*/ */
static component(attrs = {}, children = null): Mithril.vnode { static component(attrs = {}, children = null): Mithril.Vnode {
const componentAttrs: Record<string, unknown> = { ...attrs}; const componentAttrs: Record<string, unknown> = { ...attrs};
return Mithril.m(this, componentAttrs, children); return Mithril.m(this, componentAttrs, children);