-
Notifications
You must be signed in to change notification settings - Fork 30
Wrapper type correct? #3
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
Comments
Pass a Vue class type to the Wrapper type: import { shallowMount, Wrapper } from "@vue/test-utils";
import Vue from "vue";
let wrapper: Wrapper<Vue> You can see the full typings for Vue Test Utils in the @vue/test-utils source code |
Hey, this thread is very useful. However this type made me unable to access any of my component's property. Any idea how to fix this? |
@ClarissaAudrey Quoting user @ktsn (here):
If you don't mind not having intellisense for your component's properties, you can try to do it this way (suggested by user @3nuc):
|
Hi, i a real-world scenario I have the following class in my vue file (adapted to the example provided in this project):
My test is as follows:
I have typed the
wraper
asany
here because that works (i.e. does not give a red squiggly line in my editor), but theshallowMount
method returns aWrapper<Wrapper>
. Typing the wrapper asany
does not give me the benefits of code completion etc.As what type should I type the wrapper so that I can use the correct typing in the remainder of the test?
I tried
Wrapper
,Wrapper<Wrapper>
,Wrapper<HelloWorld>
but nothing worked.The text was updated successfully, but these errors were encountered: