Fortunately (or unfortunately), the backend can still include many improvements for better adherence to type safety. For example, there may be certain instances where we do not want to return certain attributes (such as passwords). While the hacky way now is to label as undefined, nestJS actually offers serialisation which helps to format response objects before sending back to the client. This way, it ensures structured and consistent response.
Refer to: NestJs Serialisation
Feature: Serialisation
Description
Fortunately (or unfortunately), the backend can still include many improvements for better adherence to type safety. For example, there may be certain instances where we do not want to return certain attributes (such as passwords). While the hacky way now is to label as undefined, nestJS actually offers serialisation which helps to format response objects before sending back to the client. This way, it ensures structured and consistent response. Refer to: NestJs Serialisation