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

export ComponentMountingOptions to resolve type definetions in testing script by user #2009

Merged
merged 1 commit into from Mar 20, 2023

Conversation

jason-chang
Copy link
Contributor

@jason-chang jason-chang commented Mar 18, 2023

export ComponentMountingOptions to resolve type definetions in testing script by user.

demo like bllow

import { mount, ComponentMountingOptions } from '@vue/test-utils';
import Tree from '../src/Tree.vue'; // Tree is a component.

type MountingOptionsTree = ComponentMountingOptions<typeof Tree>;  // Note this line

function getTreeWrap(
  props: MountingOptionsTree['props'] = {},
  options: MountingOptionsTree = {}
) {
  return mount(Tree, {
    props: {
      count: 1,
      ...props,
    },
    attachTo: 'body',
    ...options,
  })
}

@netlify
Copy link

netlify bot commented Mar 18, 2023

Deploy Preview for vue-test-utils-docs ready!

Name Link
🔨 Latest commit 1ecc99f
🔍 Latest deploy log https://app.netlify.com/sites/vue-test-utils-docs/deploys/641566cec5921d0008f27245
😎 Deploy Preview https://deploy-preview-2009--vue-test-utils-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

Copy link
Collaborator

@freakzlike freakzlike left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like it 👍

@lmiller1990 lmiller1990 merged commit 7eda375 into vuejs:main Mar 20, 2023
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants