Skip to content
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

react-error-overlay fails to parse typescript errors #7082

Open
kaykayehnn opened this issue May 18, 2019 · 3 comments · May be fixed by #7091
Open

react-error-overlay fails to parse typescript errors #7082

kaykayehnn opened this issue May 18, 2019 · 3 comments · May be fixed by #7091

Comments

@kaykayehnn
Copy link

Is this a bug report?

yes

Which terms did you search for in User Guide?

react-error-overlay

Environment

Environment

System:
OS: macOS 10.14.5
CPU: (4) x64 Intel(R) Core(TM) i5-3210M CPU @ 2.50GHz
Binaries:
Node: 12.2.0 - /usr/local/bin/node
Yarn: 1.13.0 - /usr/local/bin/yarn
npm: 6.9.0 - /usr/local/bin/npm
Browsers:
Chrome: 74.0.3729.157
Firefox: 66.0.5
Safari: 12.1.1
npmPackages:
react: ^16.8.6 => 16.8.6
react-dom: ^16.8.6 => 16.8.6
react-scripts: 3.0.1 => 3.0.1
npmGlobalPackages:
create-react-app: 3.0.0

Steps to Reproduce

In a create-react-app typescript project:

  1. Start the development server
  2. Make a typescript error in any file (let a: string = 0 for example).
  3. The error overlay displays the error, however clicking on the exception does not navigate to the file in the text editor as with other webpack errors.

Expected Behavior

Clicking on the error overlay navigates to the file in a text editor.

Actual Behavior

The error overlay isn't clickable.

Details

React-error-overlay tries parsing the exception by looking for a filepath in the error message. This is handled in parseCompileError.js, where the filepath regex matches only relative paths:

const filePathRegex = /^\.(\/[^/\n ]+)+\.[^/\n ]+$/;

whereas typescript errors use absolute paths. As discussed in #6502 (comment) making the paths relative has some drawbacks so it would be best to keep them absolute.
Also TS error locations are specified like (line,colon) so we would need to add that format to the lineNumberRegexes array.

I can submit a PR for this if that's okay.

@heyimalex
Copy link
Contributor

Sounds good to me!

@kaykayehnn kaykayehnn linked a pull request May 21, 2019 that will close this issue
@stale
Copy link

stale bot commented Jun 19, 2019

This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs.

@stale stale bot added the stale label Jun 19, 2019
@bugzpodder bugzpodder removed the stale label Jun 19, 2019
@stale
Copy link

stale bot commented Jul 19, 2019

This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs.

@stale stale bot added the stale label Jul 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants