Answer the question
In order to leave comments, you need to log in
Vue + Typescript name collision for action / getter from different namespaces, or how to solve Duplicate identifier?
const namespaceRegister = `${FORMS}/${FORM_REGISTER}`;
const namespaceVerifyCode = `${FORMS}/${FORM_VERIFY_CODE}`;
export default class RegisterForm extends Vue implements IRegistrationForm, IVerifyCodeForm {
@namespace(namespaceVerifyCode).Getter
isSending!: boolean;
@namespace(namespaceRegister).Getter
isSending!: boolean;
import state from './state';
import mutations from './mutations';
import actions from './actions';
import getters from './getters';
export default {
namespaced: true,
state,
getters,
mutations,
actions,
};
[tsl] ERROR in /var/www/test/src/components/public/not_secured/partials/forms/register/RegisterForm.ts(67,5)
TS2300: Duplicate identifier 'isSending'.
isSending as isVerifyCodeSending!: boolean;
Answer the question
In order to leave comments, you need to log in
Decorators decorate an already finished object, after its creation, and not in the process.
Your code, if it worked, is logically equivalent to this:
export default class RegisterForm extends Vue implements IRegistrationForm, IVerifyCodeForm {
@namespace(namespaceRegister).Getter
@namespace(namespaceVerifyCode).Getter
isSending!: boolean;
@namespace(<vuex-path>).Getter
isSending!: boolean;
isSending
we request the field from vuex at the address <vuex-path>
, when we set the field isSending
, we commit the field in vuex at the address <vuex-path>
. mutation
and xs, is such a game provided for by this either. If it must be two separate meanings, then HOW do you imagine it?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question