79396827

Date: 2025-01-29 13:11:46
Score: 0.5
Natty:
Report link

Finally, I found a solution that seems to work. Just need to add these few lines to the Global class:

class Global {
    // --------------Add this lines-------------- //
    @Expose({ name: 'APP_TAG' })
    @Transform(({ obj }) =>
        plainToInstance(Server, obj, { excludeExtraneousValues: true }),
    )
    // ------------------------------------------ //
    @Type(() => Server)
    server?: Server

    // --------------Add this lines-------------- //
    @Expose({ name: 'DATABASE_NAME' })
    @Transform(({ obj }) =>
        plainToInstance(Database, obj, { excludeExtraneousValues: true }),
    )
    // ------------------------------------------ //
    @Type(() => Database)
    database?: Database
}
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: 8naf