in typescript, I am trying to overwrite the express's Response json object to be a specific type of object to always be used
for example, I want to enforce a interface type that would error out if the following format was not followed
return res.status(200).json({
data: ["a", {"a": "b"}],
success: true,
});
I attempted to use dts-gen --m express -f src/types/express.d.ts to create the declaration file to modify but it ended in failure.
is there a way to overwrite a specific type on an existing library or do I need to create a declaration file specific to my needs?
expressis notorious for being not that typeable. It's best to avoid using a lot of custom middleware and to keep well-typed code apart fromexpressrouting code, if you choose to keep using this library.