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

fix(Menu): fix typings for Menu.Item #1235

Merged
merged 2 commits into from
Jan 28, 2017

Conversation

shanehyde
Copy link
Contributor

The typings are missing a correct definition for onClick on Menu.Item to add the props as the 2nd parameter.

The typings for Button are correct, so this is a copy of the onClick definition from there for Menu.Item

@codecov-io
Copy link

codecov-io commented Jan 27, 2017

Current coverage is 95.89% (diff: 100%)

Merging #1235 into master will not change coverage

@@             master      #1235   diff @@
==========================================
  Files           880        880          
  Lines          4901       4901          
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
  Hits           4700       4700          
  Misses          201        201          
  Partials          0          0          

Powered by Codecov. Last update d3b1acd...c4734e1

* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {object} data - All props.
*/
onClick?: (event: React.MouseEvent<HTMLElement>, data?:MenuItemProps) => void;
Copy link
Contributor

Choose a reason for hiding this comment

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

there should be space between data?: and MenuItemProps

Copy link
Member

Choose a reason for hiding this comment

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

data will be always passed.

-onClick?: (event: React.MouseEvent<HTMLElement>, data?:MenuItemProps) => void;
+onClick?: (event: React.MouseEvent<HTMLElement>, data: MenuItemProps) => void;

@layershifter layershifter changed the title Fix typings for Menu.Item onClick Handler fix(Menu): fix typings for Menu.Item Jan 27, 2017
@shanehyde
Copy link
Contributor Author

I have made both those changes and added them to the PR

@levithomason levithomason merged commit 6c36b91 into Semantic-Org:master Jan 28, 2017
@levithomason
Copy link
Member

Released in semantic-ui-react@0.64.5.

@tilor
Copy link

tilor commented Jan 31, 2017

Menu.Item throws a compiler error in 0.64.5 (this error did not happen in 0.64.0):

error TS2430: Interface 'MenuItemProps' incorrectly extends interface 'ReactMouseEvents'.
Types of property 'onClick' are incompatible.
Type '(event: MouseEvent, data: MenuItemProps) => void' is not assignable to type 'EventHandler<MouseEvent>'.

@dylankiss
Copy link
Contributor

I get the same error when using 0.64.5.

@levithomason
Copy link
Member

@layershifter ?

@layershifter
Copy link
Member

I've forget to make a response there, it was fixed in #1264.

harel pushed a commit to harel/Semantic-UI-React that referenced this pull request Feb 18, 2017
* Fix typings for Menu.Item onClink Handler

* Fix spacing and make data non-optional
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.

7 participants