Я получаю ошибку:
"Элемент 'someMutation' неявно имеет тип 'any'.".
Эта ошибка появляется в моем компоненте Vue в файле Component.ts
для мутации, полученной из магазина Vuex.
У меня есть следующий код в Component.ts
:
@WithRender
@Component({
components: { SomeChildComponent },
})
export default class Component extends Vue {
constructor() {
super();
this.someFunc(this.someComponentMethod);
// ... some logic
}
@Mutation public someMutation;
private someComponentMethod(str: string) {
this.someMutation();
}
}
Код в хранилище для мутаций:
const mutations: MutationTree<State> = {
someMutation(state, name: string): void {
state.prop = state.prop.filter((el: IEl): boolean => el.name !== name);
},
};
const c = {
state,
getters,
mutations,
};
const store = new Vuex.Store(c);
Я пробовал несколько вариантов, таких как @Mutation public someMutation: void;
или @Mutation public someMutation(s: string): void;
, но безуспешно.
Мое намерение - решить проблему, а не просто отключить правило NoImplicitAny
в tslint.json
файле.