[Vuejs]-Vue error Parameter 'value' implicitly has an 'any' type. typescript error

1👍

Just like you would type any other variable in TypeScript, using the variable: type syntax:

export default {
  data: () => ({
    firstName: '',
    firstNameRules: [
      (value: string)  => {
        if (value?.length > 3) return true
        return 'First name must be at least 3 characters.'
      },
    ],
  }),
}

Leave a comment