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

Skip IntrinsicAttributes elaboration in JSX errors #24461

Merged
merged 3 commits into from
May 29, 2018

Conversation

sandersn
Copy link
Member

Do not issue an error message for a source type that comes from JSX attributes and a target type that is an intersection containing IntrinsicAttributes or IntrinsicClassAttributes. This will make error messages simpler and less confusing.

Note:

  1. There will always be elaboration under the skipped message, so this won't elide errors completely.
  2. Rarely (once in the tests) the intersection type will have more that one non-Intrinsic* member. However, these additional members don't provide useful information either, so it's fine to skip them.

Might fix all the confusion in #15643 that happened after the actual fix to that bug. Or at least help.

Do not issue an error message for a source type that comes from JSX
attributes and a target type that is an intersection containing
IntrinsicAttributes or IntrinsicClassAttributes. This will make error
messages simpler and less confusing.

Note:
1. There will always be elaboration under the skipped message, so this
won't elide errors completely.
2. Rarely (once in the tests) the intersection type will have more that
one non-Intrinsic* member. However, these additional members don't
provide useful information either, so it's fine to skip them.
Copy link
Member

@weswigham weswigham left a comment

Choose a reason for hiding this comment

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

Actually looks very good. Though is there a test of the error output when there's a conflict within the intrinsic attributes?

@sandersn
Copy link
Member Author

I don't think so. I'll go look up what is even in those types.

@weswigham
Copy link
Member

ref and key usually.

@sandersn
Copy link
Member Author

Yep, I forgot that they are customised via Special Name. Anyway, I added a test and that error message, too, looks better without the intersection.

Copy link
Member

@RyanCavanaugh RyanCavanaugh left a comment

Choose a reason for hiding this comment

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

Big fan

@sandersn sandersn merged commit 15bfaf1 into master May 29, 2018
@sandersn sandersn deleted the skip-intrinsicAttributes-in-jsx-errors branch May 29, 2018 21:00
@microsoft microsoft locked and limited conversation to collaborators Jul 31, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants