Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

192
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda