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

Bug: There is a type mismatch between the slot parameter inside the mount object and MountingOptions #2457

Closed
Khalifa1997 opened this issue Jun 16, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@Khalifa1997
Copy link

Describe the bug
There is a type mismatch between the slot parameter inside the mount method and the MountingOptions type

To Reproduce
I would use it like this

const createWrapper = (
  options: MountingOptions<typeof HelloWorld.props> = {}
) =>
  mount(HelloWorld, {
    props: {
      modelValue: false,
      ...options.props,
    },
    slots: {
      ...options.slots,
    },
   // OR slots: options.slots,
  });

Here is a link but it seems that the slot parameter would accept anything being sent to here.. 🤔
https://stackblitz.com/edit/github-budly4?file=src%2Fcomponents%2F__tests__%2FHelloWorld.spec.ts

Expected behavior
There should be a no type mismasmatch, however there is

Related information:

  System:
    OS: Linux 5.15 Ubuntu 22.04.4 LTS 22.04.4 LTS (Jammy Jellyfish)
    CPU: (16) x64 AMD Ryzen 7 5800H with Radeon Graphics
    Memory: 8.45 GB / 15.47 GB
    Container: Yes
    Shell: 5.1.16 - /bin/bash
  npmPackages:
    @vue/test-utils: ^2.3.2 => 2.4.6 
    vitest: ^1.6.0 => 1.6.0 
    vue: ^3.4.21 => 3.4.27 
@Khalifa1997 Khalifa1997 added the bug Something isn't working label Jun 16, 2024
@cexbrayat
Copy link
Member

Hi @Khalifa1997 , sorry for the delay, I missed this issue.

The proper way to type the mounting options is to use:

const createWrapper = (
  options: ComponentMountingOptions<typeof HelloWorld, typeof HelloWorld.props> = {}

And I think your type error should go away.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants