Add typescript to a node project
To add typescript to your node project, run the following commands within your node project’s root directory.
npm install typescript --save-dev npm install @types/node --save-dev touch tsconfig.json
Open tsconfi.json created from the last command above, and add the following basic typescript configs.
{ "compilerOptions": { "module": "commonjs", "esModuleInterop": true, "target": "es6", "moduleResolution": "node", "sourceMap": true, "outDir": "dist" }, "lib": ["es6"] }
To add type support for a library if the library supports typescript, run the following command to add it, replace “libraryname” with the actual library name.
npm install @types/libraryname --save-dev
Search within Codexpedia
Custom Search
Search the entire web
Custom Search
Related Posts