TypeScript-Node-Starter icon indicating copy to clipboard operation
TypeScript-Node-Starter copied to clipboard

feat(Root): Development mode using nodemon with custom type loading

Open derian-cordoba opened this issue 3 years ago • 2 comments
trafficstars

Implementation to run in development mode using nodemon loading custom types in order to prevent errors when running the server in development mode.

The error that is being prevented by loading the express-session-types type is the following:

Property 'returnTo' does not exist on type 'Session & Partial<SessionData>'.
req.session.returnTo = req.path;

Which is avoided by importing the following line into the app.ts file:

import * as sessionTypes from "./types/express-session-types";

With this we achieve the execution in development mode with the command npm run dev.

derian-cordoba avatar Jan 24 '22 00:01 derian-cordoba

CLA assistant check
All CLA requirements met.

Hey, thanks for pr, but it won't work as part of the example, as the direct TS workflow does not work in current setup for non-TS (non-javasript) assets, like images and styles. So the page starts, allow development, but there is no support for other assets. This is why existing nodemon usage support is based on serving content from dist directory

peterblazejewicz avatar Jan 24 '22 19:01 peterblazejewicz