添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

I am using Vue3 , type script , composition and vee-validate4 and Pinia store all together

this is user register from.

views/register

const schema = yup.object({
  email: yup.string().required().email("لطفا ! ایمیل معتبر وارد کنید ."),
  password: yup.string().required().min(8, "کلمه عبور باید حداقل هشت کاراکتر باشد ."),
const { errors, handleSubmit } = useForm({
  validationSchema: schema,
const { value: email } = useField('email');
const { value: password } = useField('password');

and i have a method here for register

views/register

async function add() {
  try {
    const res = await useAuthStore().register({email,password})
      } catch (err: any) {}

But , here I have a typescript error .

and my Pinia store is like this

actions: {
    register( user:ICreateUser) {
      return AuthService.create(user).then(
        response => {
          this.status.loggedIn = false;
          return Promise.resolve(response.data);
        error => {
          this.status.loggedIn = false;
          return Promise.reject(error);

How cam I fix Typescript errors ?

@kevin Ref<string> means that you should pass email.value rather just email to register; register({ email: email.value, password: password.value }). – Фарид Ахмедов May 12, 2022 at 15:49

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.