Skip to content

Instantly share code, notes, and snippets.

@johanbaaij
Last active February 1, 2020 11:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johanbaaij/df038472c7a14a0d5ec1ce02db4911a5 to your computer and use it in GitHub Desktop.
Save johanbaaij/df038472c7a14a0d5ec1ce02db4911a5 to your computer and use it in GitHub Desktop.
composition-api TypeError
import "./setup";
// Dependencies
import Vuetify from "vuetify";
import VueCompositionApi from "@vue/composition-api";
import i18n from "@/plugins/i18n";
import store from "@/store";
// Components
import Home from "../../src/views/Home.vue";
// Utilities
import { mount, createLocalVue } from "@vue/test-utils";
const localVue = createLocalVue();
localVue.use(VueCompositionApi);
describe("Home.vue", () => {
let vuetify: any;
beforeEach(() => {
vuetify = new Vuetify();
});
it("should match snapshot", () => {
const wrapper = mount(Home, {
localVue,
vuetify,
i18n,
store
});
expect(wrapper.html()).toMatchSnapshot();
});
});
<template>
<v-container fluid>
<v-row justify="center">
<v-col cols="auto">
<h1 class="text-center">
{{ $t("app.title") }}
</h1>
<h2 class="text-center">
{{ $t("app.subtitle") }}
</h2>
</v-col>
</v-row>
<v-row justify="center">
<v-col md="6" lg="4" sm="8">
<find-collection-widget />
</v-col>
</v-row>
</v-container>
</template>
<script lang="ts">
import store from "@/store";
import router from "@/router";
import FindCollectionWidget from "@/components/FindCollectionWidget.vue";
import i18n from "@/plugins/i18n";
import metaInfo from "vue-meta";
import { createComponent, onBeforeMount } from "@vue/composition-api";
export default createComponent({
name: "home",
components: {
FindCollectionWidget
},
metaInfo() {
return {
title: i18n.t("Home.title") as string
};
},
setup() {
onBeforeMount(() => {
if (store.state.user.username !== null) {
router.replace({ name: "tracks" });
}
});
return {};
}
});
</script>
<style lang="sass"></style>
ERROR in /home/johan/Apps/bpmbox/frontend/tests/unit/Home.spec.ts(26,27):
26:27 No overload matches this call.
Overload 1 of 3, '(component: VueClass<Vue>, options?: ThisTypedMountOptions<Vue> | undefined): Wrapper<Vue>', gave the following error.
Argument of type 'VueProxy<ComponentPropsOptions<Data>, void>' is not assignable to parameter of type 'VueClass<Vue>'.
Type 'VueProxy<ComponentPropsOptions<Data>, void>' is not assignable to type 'new (...args: any[]) => Vue'.
Type 'ComponentRenderProxy<ExtractPropTypes<ComponentPropsOptions<Data>, true>, void, ExtractPropTypes<ComponentPropsOptions<Data>, false>>' is missing the following properties from type 'Vue': $el, $options, $children, $scopedSlots, and 29 more.
Overload 2 of 3, '(component: ComponentOptions<Vue, DefaultData<Vue>, DefaultMethods<Vue>, DefaultComputed, PropsDefinition<Record<string, any>>, Record<...>>, options?: ThisTypedMountOptions<...> | undefined): Wrapper<...>', gave the following error.
Argument of type 'VueProxy<ComponentPropsOptions<Data>, void>' is not assignable to parameter of type 'ComponentOptions<Vue, DefaultData<Vue>, DefaultMethods<Vue>, DefaultComputed, PropsDefinition<Record<string, any>>, Record<...>>'.
Types of property 'data' are incompatible.
Type 'void | undefined' is not assignable to type 'object | ((this: Vue) => object) | undefined'.
Type 'void' is not assignable to type 'object | ((this: Vue) => object) | undefined'.
Overload 3 of 3, '(component: FunctionalComponentOptions<Record<string, any>, PropsDefinition<Record<string, any>>>, options?: MountOptions<Vue> | undefined): Wrapper<...>', gave the following error.
Argument of type 'VueProxy<ComponentPropsOptions<Data>, void>' is not assignable to parameter of type 'FunctionalComponentOptions<Record<string, any>, PropsDefinition<Record<string, any>>>'.
Property 'functional' is missing in type 'ComponentOptions<Vue, void, never, never, ComponentPropsOptions<Data>, ExtractPropTypes<ComponentPropsOptions<Data>, false>> & VueConstructorProxy<...>' but required in type 'FunctionalComponentOptions<Record<string, any>, PropsDefinition<Record<string, any>>>'.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment