I am using TypeScript for my node.js backend development. Whenever I get an error in node.js it shows me the line number relating to the transpiled JavaScript (.js) files, not the TypeScript (.ts) files.
If you have used ionic, we get the error corresponding to the typescript file there.
Is there any way I get error line number relating to my typescript file? If yes please explain how and what changes I need to do to the config file.
It is a superset of JavaScript. In order to execute or run any typescript file, first you need to install node and using it install typescript globally in your local system. Procedure 1: This typescript file greet. ts will create a javascript file at runtime with the same name.
TypeScript is a typed superset of JavaScript that compiles to plain JavaScript. It offers classes, modules, and interfaces to help you build robust components.
Install source-map-support
package.
$ npm install --save-dev source-map-support
Add this line in the entry point of node.js
require('source-map-support').install();
In your tsconfig.json
,
{
"compilerOptions": {
"sourceMap": true
}
}
Ref: https://github.com/evanw/node-source-map-support#typescript-demo
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With