Skip to content

Report errors in JSX properties on the failing prop or the tag name #23148

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

Merged
merged 1 commit into from
Apr 4, 2018

Conversation

weswigham
Copy link
Member

@weswigham weswigham commented Apr 4, 2018

Instead of the entire attributes or the entire tag. This works similarly to how base-class assignability errors are reported.

Fixes #23116.
Fixes #23117.

@@ -49,27 +39,25 @@ tests/cases/conformance/jsx/file.tsx(36,29): error TS2322: Type '{ children: str

// Error
const c0 = <OneThing extraProp />; // extra property;
~~~~~~~~~
Copy link
Contributor

Choose a reason for hiding this comment

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

Should the span still be on extraProp here since it's the failing prop?

Copy link
Contributor

Choose a reason for hiding this comment

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

+1

Copy link
Member Author

Choose a reason for hiding this comment

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

I mean, before it was on the attributes as a whole (it just happens there's only one attribute in this example, so it happens to look the same).

Copy link
Member Author

Choose a reason for hiding this comment

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

Also, you may have misread the error: it's not the failing prop (yet - it would be an excess prop assuming it was otherwise compatible) - this example is missing both yy and yy1.

@mhegazy
Copy link
Contributor

mhegazy commented Apr 4, 2018

@DanielRosenwasser the type mismatch now looks much better. the missing required property and extra property ones still have the long drill down error messages.. thoughts about what we could do here?

@weswigham weswigham merged commit 355125d into microsoft:master Apr 4, 2018
@weswigham weswigham deleted the granular-jsx-error-bounds branch April 4, 2018 22:16
@microsoft microsoft locked and limited conversation to collaborators Jul 25, 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.

None yet

4 participants