mirror of
https://github.com/flarum/core.git
synced 2025-08-06 08:27:42 +02:00
Fix typescript errors
This commit is contained in:
committed by
Franz Liedke
parent
27017b7181
commit
32767d6321
@@ -44,7 +44,7 @@ export default abstract class Component<T extends ComponentAttrs = any> implemen
|
|||||||
*
|
*
|
||||||
* @see https://mithril.js.org/components.html#passing-data-to-components
|
* @see https://mithril.js.org/components.html#passing-data-to-components
|
||||||
*/
|
*/
|
||||||
protected attrs: T;
|
protected attrs!: T;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
@@ -54,21 +54,21 @@ export default abstract class Component<T extends ComponentAttrs = any> implemen
|
|||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
protected oninit(vnode: Mithril.Vnode<T, this>) {
|
oninit(vnode: Mithril.Vnode<T, this>) {
|
||||||
this.setAttrs(vnode.attrs);
|
this.setAttrs(vnode.attrs);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
protected oncreate(vnode: Mithril.VnodeDOM<T, this>) {
|
oncreate(vnode: Mithril.VnodeDOM<T, this>) {
|
||||||
this.element = vnode.dom;
|
this.element = vnode.dom;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
protected onbeforeupdate(vnode: Mithril.VnodeDOM<T, this>) {
|
onbeforeupdate(vnode: Mithril.VnodeDOM<T, this>) {
|
||||||
this.setAttrs(vnode.attrs);
|
this.setAttrs(vnode.attrs);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -108,7 +108,7 @@ export default abstract class Component<T extends ComponentAttrs = any> implemen
|
|||||||
* and checking for common issues.
|
* and checking for common issues.
|
||||||
*/
|
*/
|
||||||
private setAttrs(attrs: T = {} as T): void {
|
private setAttrs(attrs: T = {} as T): void {
|
||||||
this.constructor.initAttrs(attrs);
|
(this.constructor as any).initAttrs(attrs);
|
||||||
|
|
||||||
if (attrs) {
|
if (attrs) {
|
||||||
if ('children' in attrs) {
|
if ('children' in attrs) {
|
||||||
|
Reference in New Issue
Block a user