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

323
Vistas
NestJS, Schema @Prop decorator can't take more than 1 argument?

Below I have two Properties on my GraphQL Schema. They are both of types number, however I'm quite sure you have to explicitly set them to () => Int. This works in my second @Prop scene_description, as it's only 1 argument. However for the top @Prop tvshow_episode, it doesn't let me both explicitly declare an Int, and have options like unique and index. Can someone explain the difference to me here and what is the best practice?

import { Int } from '@nestjs/graphql';
import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
import { Document } from 'mongoose';

export type SongToEpisodeDocument = SongToEpisode & Document;

@Schema({
  timestamps: true,
})
export class SongToEpisode {
  @Prop(() => Int, { unique: true, index: true })
  tvshow_episode: number;

  @Prop(() => Int)
  scene_description: number;
}

The error it gives is Expected 0-1 arguments, but got 2.ts(2554)

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