-
-
Notifications
You must be signed in to change notification settings - Fork 536
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SourceMap does not work on multi-line chained function call. #325
Comments
I'm honestly not sure if there's anything I can fix or do different in this package. The source map comes from TypeScript and the node support for source maps comes from |
Possibly, ts-node can generate a new source-map for every line based on the source-map from typescript... But, I'm not sure whether this is the best solution... |
What would the difference be from the source map TypeScript gives me? If there's a bug, it would need to be fixed in TypeScript (once we verify it's from there and not some other issue). |
Let's say, TypeScript gives source map for line number 1,3,5. But, the source-map npm requires for all lines(1,2,3,4,5,6), and returns "null" for line number 2,4,6, if ts-node provides information only for line number 1,3,5. (But, I'm not sure why source-map npm does not accept in this case...) |
I've confirmed that the behavior described in this ticket no longer occurs. The line number is correct. |
SourceMap does not work well if the error happens on chained function call.
I just made a simple project like below.
index.js:
foo.ts:
tsconfig.js generation (default)
And, I got error message like below:
The message says, the error happens on line 4, column5.
But, the "foo.ts" does not have line 4, column 5. (The file is 3 lines).
The error does not happens if I set "strict: false" on tsconfig.json.
And, the error does not happens if the foo.js is like below(no multi-line chained call).
I dig into the issue, and found that the issue looks happens when "originalPositionFor" of source-map npm returns null. "originalPositionFor" looks assuming source map contains for all lines' column 0. But ts-node may not have source map for all the lines.
https://github.com/mozilla/source-map/blob/75663e0187002920ad98ed1de21e54cb85114609/lib/source-map-consumer.js#L616
The text was updated successfully, but these errors were encountered: