-
-
Notifications
You must be signed in to change notification settings - Fork 5k

Description
So I have two components, one works with computed properties the other one does not. If I remove computed from the component vue-router will compile without an error.
Otherwise it throws the following error:
TS2345: Argument of type '{ routes: ({ name: string; path: string; components: { default: { name: string; props: string[]; ...' is not assignable to parameter of type 'RouterOptions | undefined'.
Type '{ routes: ({ name: string; path: string; components: { default: { name: string; props: string[]; ...' is not assignable to type 'RouterOptions'.
Types of property 'routes' are incompatible.
Type '({ name: string; path: string; components: { default: { name: string; props: string[]; methods: {...' is not assignable to type 'RouteConfig[] | undefined'.
Type '({ name: string; path: string; components: { default: { name: string; props: string[]; methods: {...' is not assignable to type 'RouteConfig[]'.
Type '{ name: string; path: string; components: { default: { name: string; props: string[]; methods: { ...' is not assignable to type 'RouteConfig'.
Type '{ name: string; path: string; components: { default: { name: string; props: string[]; methods: { ...' is not assignable to type 'RouteConfig'.
Types of property 'components' are incompatible.
Type '{ default: { name: string; props: string[]; methods: { [x: string]: ActionMethod | MutationMethod...' is not assignable to type 'Dictionary | undefined'.
Type '{ default: { name: string; props: string[]; methods: { [x: string]: ActionMethod | MutationMethod...' is not assignable to type 'Dictionary'.
Property 'default' is incompatible with index signature.
Type '{ name: string; props: string[]; methods: { [x: string]: ActionMethod | MutationMethod | Computed...' is not assignable to type 'Component'.
Type '{ name: string; props: string[]; methods: { [x: string]: ActionMethod | MutationMethod | Computed...' is not assignable to type 'AsyncComponent<DefaultData, DefaultMethods, DefaultComputed, Record<string, any>>'.
Type '{ name: string; props: string[]; methods: { [x: string]: ActionMethod | MutationMethod | Computed...' provides no match for the signature '(resolve: (component: Component<DefaultData, DefaultMethods, DefaultComputed, Record<string, any>>) => void, reject: (reason?: any) => void): void | Promise<VueConstructor | FunctionalComponentOptions<Record<string, any>, PropsDefinition<Record<string, any>>> | ComponentOptions<never, DefaultData, DefaultMethods, DefaultComputed, Record<string, any>, Record<string, any>> | EsModuleComponent>'.
**Router Code:
import designationSearchComponent from './modules/designation/designationSearch.vue';
import designationDetailComponent from './modules/designation/designationdetailcomponent.vue';
import givebuttonComponent from './modules/giving/givebutton.vue';
export const routes = [
{ name: 'fundabledetail', path: '/designationdetail/:id', components: { default: designationDetailComponent, givebutton: givebuttonComponent }, props: { default: true, givebutton: false } },
{ name: 'searchandbrowse', path: '/searchandbrowse', components: { default: designationSearchComponent, givebutton: givebuttonComponent } },
]
Component Code: DesignationDetailComponent.vue
<template>
<div id="myApplication">
<div v-if="loading===false">
<h1>Designation Detail Preview for {{id}}</h1>
<p></p>
</div>
</div>
</template>
<script lang="ts">
import { mapActions, mapGetters, mapMutations, mapState } from 'Vuex';
import { FundableDetail } from '../api/api';
import { IPage } from '../api/parents.ts';
import givebutton from '../giving/givebutton.vue';
import store from '../store/store';
export default {
name: 'designation-detail',
props: ['id'],
methods: {
...mapActions({
getServerDetail: 'designationDetail/getDesignation'
}),
...mapMutations({ setId: 'designationDetail/setId' }),
...mapState({
designation: state => store.state.designationDetail.designation,
designationId: state => store.state.designationDetail.id
}),
...mapGetters({
getData: 'designationDetail/designation'
})
},
computed: {
},
data: function() {
return {
photoUrl: '__PHOTOURL__',
loading: false
};
},
created() {
//this['setId'](this['id']);
//this['loading'] = true
//this['getServerDetail']().then(() => {
// console.log('this', this);
// this['loading'] = false;
//})
}
};
</script>
<style>
#app {
text-align: center;
color: #2c3e50;
margin-top: 60px;
}
</style>