Typescript debugging - variables undefined in TS but work in compiled JS 关注
I am debugging a node app written in typescript. Breakpoints in the TS are hit, but most variables are undefined. However, those same variables ARE defined when I set a breakpoint in the compiled JS.
Any idea what is going on here? Running Webstorm 2018.1. This is my tsconfig.json:
Usually such issues occur when the generated name doesn't match the original one, and no name mappings are provided in sourcemaps
Okay, any suggestions? I tried deleting the source maps and recompiling -- to no avail.
If a tool you are using for generating sourcemaps doesn't support name mappings (
"names": is missing or empty) , re-generating sourcemaps won't help
Debugging previously worked fine on this project; did something change with Webstorm 2018? I am using TS 2.7.2 and the Webstorm TS service. I generated the sourcemaps simply by compiling at the command line with tsc. I tried adding "inlineSources": true to tsconfig.json. Didn't help.
"names": is definitely empty in each of my map files, but according to this issue - https://github.com/Microsoft/TypeScript/issues/9627 - TS doesn't support this feature anyway. So I think they've always been empty. I took a look at other people's map files; their "names": are empty too.
>did something change with Webstorm 2018?
there are no issues I'm aware of.
Can you provide a project that can be used for recreating the issue?