Skip to content

Handle typescript errors in react-error-overlay #7091

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Handle typescript errors in react-error-overlay #7091

wants to merge 1 commit into from

Conversation

kaykayehnn
Copy link

Closes #7082

@@ -7,7 +7,7 @@ export type ErrorLocation = {|
colNumber?: number,
|};

const filePathRegex = /^\.(\/[^/\n ]+)+\.[^/\n ]+$/;
const filePathRegex = /^(?:\.|[A-Z]:)?(\/[^/\n ]+)+\.[^/\n ]+$/;
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This regex should match both relative and absolute paths on all platforms.
(?:\.|[A-Z]:)? defines an optional non-capturing group which may contain either a period (for matching relative paths) or a Windows drive letter for matching absolute paths. I verified that Windows does not support drive letters after Z.
Unix absolute paths (/path/to/folder) are also matched correctly as the first group is optional.

Copy link
Contributor

@Timer Timer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just leaving this review since I saw it in my pending requests! Best of luck with the PR! Seems to be a GitHub bug since I no longer have rights.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

react-error-overlay fails to parse typescript errors
6 participants