Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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 join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants