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

316
Views
Secuela: ¿cómo puedo anular el método de un modelo de un modal definido?

Estoy tratando de lograr lo siguiente:

 class User extends Model { // Specifically this override toJSON() { return { ...this.get(), id: undefined }; } } User.init({ // Attributes here }, {sequelize});

El código anterior usa la extensión de clase Modal para anular el método toJSON; sin embargo, estoy trabajando en un proyecto donde definí la mayoría de mis modales usando sequelize.define de la siguiente manera:

 const User = sequelize.define('User', { // Attributes });

En lugar de refactorizar todos mis modelos para extender la clase Modal , ¿es posible anular mis métodos modales?

Intenté usar getterMethods así

 getterMethods: { get: () => { return {...this.get(), id: undefined } } }

Lamentablemente, estoy usando TypeScript que no pudo compilar este código ya que el Object is possibly 'undefined'. ts(2532) . Gracias por tu tiempo.

about 4 years ago · Santiago Trujillo
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!