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

190
Views
Problem with Yup and custom validation Module

I want to present you this problem I have searched all over google but I can't find a solution, I want to create a custom validation to yup, I follow the guides and in react when I save the validation it works fine, but when I press f5 I get this error.

error

These are the files that I use to create the validation

Fragment:CrearGenero

const schema = yup.object({
    nombre: yup.string().required().primeraLetraMayuscula()
})

File:Global.d.ts

// eslint-disable-next-line @typescript-eslint/no-unused-vars
import { StringSchema } from "yup";

declare module 'yup'{
    interface StringSchema {
       primeraLetraMayuscula(): this   
    }
   
}

File:Validations.ts

import * as yup from 'yup'


export default function configurarValidaciones() {

    yup.addMethod(yup.string, 'primeraLetraMayuscula', function () {
        return this.test('primeramayuscula', 'La primera letra debe ser mayuscula',

            function (valor) {

                if (valor && valor.length > 0) {
                    const primeraLetra = valor.substring(0, 1);
                    return primeraLetra === primeraLetra.toUpperCase();

                }
                return true;
            }
        )
    })
}

Thanks

about 4 years ago · Juan Pablo Isaza
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!