Closed christopheranderson closed 8 months ago
I'm having a hard time reproducing this. Are you able to craft a minimal repro that does not require imports/logic specific to your project? The repro I attempted to create seems to work fine when debugging and breakpoints are hit, and I've verified that the source maps in question properly line up with between the original sources and the generated outputs.
We have a repro in our botframework-cli project, but I'll try to craft a minimal one over the weekend. Thanks for pinging me on this, Ryan.
I resolved this issue by updating the target to es2022
or any version beyond.
Alternatively, you can simply choose esnext
, and the generated JavaScript file will use static methods without encountering this problem.
If someone has a concrete repro, please file a new issue with it. Thanks!
TypeScript Version: 3.8.0-dev.20191122 (also reproduced on @latest (3.7.2)
Search Terms: typescript sourcemaps not working with static properties
Code
This issue is specifically when trying to consume the generated sourcemaps in vscode.
From: https://github.com/microsoft/botframework-cli/blob/91881c3be6bf3888f97f86ff7d9b314871bf5d5b/packages/dialog/src/commands/dialog/verify.ts#L14-L29
If the below static properties are placed before other code in my class, then the sourcemap that's generated is off and debugging tools like VS code will have their breakpoints misplaced.
Additional debugging info (including full source for the file and generated content.
(If you attempt to build the project for a local repro, you'll need to look at the contributor guide. We use rush to orchestrate building the projects). launch.json snippet config for verify ```json { "type": "node", "request": "launch", "name": "Dialog Verify Tests", "program": "${workspaceFolder}/packages/dialog/node_modules/mocha/bin/_mocha", "cwd": "${workspaceFolder}/packages/dialog", "args": [ "--timeout", "999999", "--colors", "-g", ".*dialog:verify.*" ], "internalConsoleOptions": "openOnSessionStart", "sourceMaps": true, "outFiles": [ "./package/dialog/lib/**" ] }, ``` generated files: verify ts ```ts /*! * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. */ import { Command, flags } from '@microsoft/bf-cli-command'; import * as chalk from 'chalk'; import { Definition, DialogTracker, SchemaTracker } from '../../library/dialogTracker'; // import * as process from 'process'; export default class DialogVerify extends Command { static args = [ { name: 'glob1', required: true }, { name: 'glob2', required: false }, { name: 'glob3', required: false }, { name: 'glob4', required: false }, { name: 'glob5', required: false }, { name: 'glob6', required: false }, { name: 'glob7', required: false }, { name: 'glob8', required: false }, { name: 'glob9', required: false }, ] static flags: flags.InputExpected behavior:
When I set a breakpoint on line 37 & 42, I'd expect it to hit that.
Actual behavior:
It's off by 3 (40 and 45) & it actually thinks its somewhere deep in the execute method.
Workaround:
Move the static properties to the bottom of the class and everything works as expected.
Playground Link: N/A
Related Issues: N/A