How to use Typescript with Angular CLI and Express / Node in the same project?

I am creating a skeleton MEAN project using the Angular CLI. The following is an example of the folder structure and tsconfig.json file.

enter image description here

Currently, the server code in the server directory is written in JavaScript, and I would like to write it in TypeScript.

In development, I usually run the following commands:

nodemon server.js
ng build --watch

, , TypeScript? tsconfig.json - , Angular tsconfig.json? 2 ? ? , , Gulp, NPM.

+4
1

. tsconfig , tsconfig-server.json. :

enter image description here

, NPM script, :

"start": "ng build -watch | tsc -p tsconfig-server.json -watch | nodemon server.js"
+2

Source: https://habr.com/ru/post/1677781/


All Articles