Within my Nuxt + TS App, I have a method that attempts to call a function:
nextPage(paginationName: string): void {
this[`${paginationName}Data`].pagination
.nextPage()
.then((newPage: number) => {
this.getData(paginationName, newPage);
});
},
I am trying to access my computed property using 'this', but the compiler is throwing an error stating
Element implicitly has an 'any' type because expression of type 'string' can't be used to index type
. While using @ts-ignore
resolves the issue, I want to find a better solution. Here is the computed property in question:
soonData(): ISoonData {
const soonData = this.$store.getters['soonData'];
const pagination = new Pagination(
Number(soonData.currentPage),
soonData.maxPage
);
return new soonData(soonData, pagination, 'soon');
},
My components are declared using Options-api with export default Vue.extend({})