mithril.d.ts
mithril.d.ts copied to clipboard
Cannot access ClassComponent members through vnode.state
In this case:
class C1 implements ClassComponent<{}> {
foo = 1;
view() {
return m('p', 'foo = ' + this.foo);
}
}
class C2 implements ClassComponent<{}> {
view() {
return m(C1, {
onremove(vnode) {
const n: number = vnode.state.foo; // <-- thinks state type is {}
}
});
}
}
The bug still exists for Mithril 2.0.4 and Mithril.d.ts 2.0.7, forcing me using Vnode instead of CVnode for Class components.