Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

126
Views
Argument of type 'Ref<x>' is not assignable to parameter of type 'x'

Using the new Composition API I am trying to get data from an input and pass it to a function which expects a string. However, TypeScript is complaining the types don't match up because one is a Ref<>. What am I supposed to do here?

<script setup lang="ts">
import { ref } from 'vue'
import formHandler from '../utils/formHandler'

const name = ref('')
</script>

<template>
  <div class="form">
    <label for="name">Name:</label>
    <input name="name" v-model="name"/>
    <button @click="formHandler.validate(name)">Validate</button>
  </div>
</template>
about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

I found it out. You have to append .value to get the value itself.

const name = ref('')

name       // <-- Ref object
name.value // <-- string
about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!