Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • C create-react-app
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 1,547
    • Issues 1,547
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 417
    • Merge requests 417
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Meta
  • create-react-app
  • Issues
  • #7082
Closed
Open
Issue created May 18, 2019 by Administrator@rootContributor

react-error-overlay fails to parse typescript errors

Created by: kaykayehnn

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 https://github.com/facebook/create-react-app/pull/6502#discussion_r259686344 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.

Assignee
Assign to
Time tracking