Skip to content

Types for wrapper.vm when using child component #2058

@Swoox

Description

@Swoox

Describe the bug
If try to access a variable of an hook with a child component, the vue-tsc give an error. wrapper.vm does not have a stateForm property, because wrapper.vm is typed as ComponentPublicInstance.

To Reproduce
https://stackblitz.com/edit/vitest-dev-vitest-ztd6bn

Expected behavior
No error.

Related information:
See #972
Tested with #2026

Workaround

const childComp = wrapper.findComponent(ChildComp);
const childWrapper = mount(childComp);
expect(childWrapper.vm.stateForm.length).toBe(undefined);

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions