-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
Fake up value declaration for synthetic jsx children symbol so they get excess property checked #29359
Fake up value declaration for synthetic jsx children symbol so they get excess property checked #29359
Conversation
…et excess property checked
@@ -82,4 +83,7 @@ tests/cases/conformance/jsx/file.tsx(35,29): error TS2322: Type 'string' is not | |||
!!! error TS2322: Type 'string' is not assignable to type 'boolean'. | |||
!!! related TS6500 tests/cases/conformance/jsx/file.tsx:30:38: The expected type comes from property 'y1' which is declared here on type 'IntrinsicAttributes & { y1: boolean; y2?: number; y3: boolean; }' | |||
const e4 = <TestingOptional y1="hello" y2={1000}>Hi</TestingOptional> | |||
~~ | |||
!!! error TS2322: Type 'string' is not assignable to type 'boolean'. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You might be thinking "why is there a new error here?" well, because the signature this was compatible with is now eliminated by the excess child prop, and a string
child prop isn't compatible with any of the other signatures~
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, wow, bonus bugfix 😄
The error is definitely confusing, though, but such is how overload resolution goes... it's always on the last overload, not on the "almost, but not quite, more specific"
* origin/master: (64 commits) Fix resolution of properties from prototype assignment in JS (microsoft#29302) Include all flow nodes made within `try` blocks as antecedents for `catch` or `finally` blocks (microsoft#29466) Don't treat interfaces as implementations Make the relationship between partial mapped types and the empty object not apply for subtype relationship (microsoft#29384) Add missing arity check on second inference pass (microsoft#29386) renames add missing type annotation PR feedback Illustrate a case that isn't handled correctly Add fourslash tests Consider JSX namespace imports when moving statements between files Fix gulp builds not building some targets Update user baselines (microsoft#29444) Add opt-in user preference for prefix and suffix text on renames (microsoft#29314) Fake up value declaration for synthetic jsx children symbol so they get excess property checked (microsoft#29359) Add regression test. (microsoft#29433) Elaborate jsx children elementwise (microsoft#29264) Add regression test PR feedback Fix trailing whitespace ...
* origin/master: (64 commits) Fix resolution of properties from prototype assignment in JS (microsoft#29302) Include all flow nodes made within `try` blocks as antecedents for `catch` or `finally` blocks (microsoft#29466) Don't treat interfaces as implementations Make the relationship between partial mapped types and the empty object not apply for subtype relationship (microsoft#29384) Add missing arity check on second inference pass (microsoft#29386) renames add missing type annotation PR feedback Illustrate a case that isn't handled correctly Add fourslash tests Consider JSX namespace imports when moving statements between files Fix gulp builds not building some targets Update user baselines (microsoft#29444) Add opt-in user preference for prefix and suffix text on renames (microsoft#29314) Fake up value declaration for synthetic jsx children symbol so they get excess property checked (microsoft#29359) Add regression test. (microsoft#29433) Elaborate jsx children elementwise (microsoft#29264) Add regression test PR feedback Fix trailing whitespace ...
Fixes this comment