Skip to content
This repository has been archived by the owner on Sep 2, 2024. It is now read-only.

Cannot access ClassComponent members through vnode.state #21

Open
spacejack opened this issue May 6, 2017 · 1 comment
Open

Cannot access ClassComponent members through vnode.state #21

spacejack opened this issue May 6, 2017 · 1 comment
Labels

Comments

@spacejack
Copy link
Collaborator

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 {}
                    }
                });
	}
}
@idlist
Copy link

idlist commented May 30, 2021

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants