• Empleos
  • Sobre nosotros
  • profesionales
    • Inicio
    • Empleos
    • Cursos y retos
  • empresas
    • Inicio
    • Publicar vacante
    • Nuestro proceso
    • Precios
    • Evaluaciones
    • Nómina
    • Blog
    • Comercial
    • Calculadora de salario

0

186
Vistas
how can I use decorator for method variable inside class in nestjs?
import {isNotEmpty} from "class-validator";

export Service   {

create(createdto)
{
const {name,age} = createdto;

@isNotEmpty()
name          //using decorator to check whether name is null or 
undefined
} 
}

Since, the decorator is only useful to class methods, I cannot use it inside method variables. How can it validate the method variables?

about 3 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 Nuestro proceso Comercial
Legal
Términos y condiciones Política de privacidad
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recomiéndame algunas ofertas
Necesito ayuda