Last active
February 1, 2020 11:08
-
-
Save johanbaaij/df038472c7a14a0d5ec1ce02db4911a5 to your computer and use it in GitHub Desktop.
composition-api TypeError
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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