addTestの中のaddSelectの処理でtestEntitiesにjsonの値を表示したいのですが下記のエラーになってしまいます。
解決方法がわかる人いましたらご教授お願いしたいです。
Type 'TestEntity' is missing the following properties from type 'TestEntity[]': length, pop, push, concat, and 28 more.ts(2740)
import { VuexModule, Module, Mutation, Action } from 'vuex-module-decorators' import { NuxtAxiosInstance } from '@nuxtjs/axios' import {Test, Selections } from '../domain/test'; import test from '@/test/test.json' export class TestEntity { totalCount: number = 0 selections: selectSatuses[] = [] constructor(test: Test) { this.totalCount = test.total_count this.selections = this.addSelections(test.select_statuses[0].selections) } private addSelections(selections: Selections[]) { let select: any = [] selections.forEach((selection) => { select = selection }) return select } } export interface ITestState { testEntities: TestEntity[] } @Module({ stateFactory: true, namespaced: true, name: 'test' }) export default class Test extends VuexModule implements ITestState { testEntities: TestEntity[] = [] @Mutation addSelect(selections: any) { this.testEntities = new TestEntity(selections) } @Action async loadTest(axios: NuxtAxiosInstance) { this.addSelect(test) } }
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。