Skip to content

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 👍

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.

3 participants