We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
The following code shows a typescript error on the first mount call. It only seems to appear when adding a boolean prop.
import { mount } from '@vue/test-utils' import { defineComponent, h } from 'vue' const Foo = defineComponent({ name: 'Foo', props: { bar: Boolean, baz: String, }, setup () { return () => h('div', ['hello world']) } }) test('uses mounts', async () => { mount(Foo, { props: { baz: 'hello', } }) mount(Foo, { props: { bar: true, } }) })
No overload matches this call. The last overload gave the following error. Argument of type 'DefineComponent<{ bar: BooleanConstructor; baz: StringConstructor; }, () => VNode<RendererNode, RendererElement, { [key: string]: any; }>, ... 9 more ..., { ...; }>' is not assignable to parameter of type 'ComponentOptionsWithObjectProps<readonly string[] | Readonly<ComponentObjectPropsOptions<Record<string, unknown>>>, () => VNode<RendererNode, RendererElement, { ...; }>, ... 8 more ..., { ...; } | {}>'. Property 'props' is missing in type 'ComponentPublicInstanceConstructor<{ $: ComponentInternalInstance; $data: {}; $props: Partial<{ bar: boolean; }> & Pick<Readonly<{ bar: boolean; } & { baz?: string; }> & VNodeProps & AllowedComponentProps & ComponentCustomProps, "baz" | ... 9 more ... | "style">; ... 10 more ...; $watch(source: string | Function, cb...' but required in type '{ props: (readonly string[] & ThisType<void>) | (Readonly<ComponentObjectPropsOptions<Record<string, unknown>>> & ThisType<void>); }'.ts(2769)
Here are the versions I'm using
"@vue/test-utils": "^2.0.0-beta.8", "vue": "^3.0.2",
The text was updated successfully, but these errors were encountered:
Same as #194 I think 🤔
Sorry, something went wrong.
Seems to be a mismatch between JS Boolean and TS boolean. Casting it works (we should fix it, but work around + might help someone debug this).
Boolean
boolean
const Foo = defineComponent({ name: 'Foo', props: { bar: Boolean as () => boolean, baz: String, } })
I have absolutely no idea how to even start debugging this :(
Successfully merging a pull request may close this issue.
The following code shows a typescript error on the first mount call. It only seems to appear when adding a boolean prop.
Here are the versions I'm using
The text was updated successfully, but these errors were encountered: