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

Broken test: declare props separate from usage for Button, MenuItem, ListItem #16315

Closed
wants to merge 2 commits into from

Conversation

rosskevin
Copy link
Member

@rosskevin rosskevin commented Jun 20, 2019

I've discovered a typescript issue when trying to migrate a 3.x codebase to 4.x

On the 4.x master, it seems that declaring/constructing props separate from usage, while it may be valid, fails to typecheck. A representative error is:

  Types of property 'button' are incompatible.
    Type 'boolean | undefined' is not assignable to type 'true | undefined'.
      Type 'false' is not assignable to type 'true | undefined'.

for

const MenuItemTest = () => {
  const p: MenuItemProps = {};
  return <MenuItem {...p} />;
};

@eps1lon @pelotom thoughts?

/issue MenuItem #16245
/issue ListItem #14971
/issue Button #15827

@@ -170,6 +172,20 @@ const BottomNavigationTest = () => {
);
};

const ButtonTest = () => {
const p: ButtonProps = {
Copy link
Member

Choose a reason for hiding this comment

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

Does

Suggested change
const p: ButtonProps = {
const p: ButtonProps<'span'> = {

work?

Copy link
Member Author

Choose a reason for hiding this comment

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

It doesn't.

@mui-pr-bot
Copy link

mui-pr-bot commented Jun 20, 2019

No bundle size changes comparing 0d4f1b1...29c47d1

Generated by 🚫 dangerJS against 29c47d1

@rosskevin
Copy link
Member Author

I found the MenuItem issue was already reported in #16245

@rosskevin rosskevin changed the title Broken test: declare props separate from usage for Button and MenuItem Broken test: declare props separate from usage for Button, MenuItem, ListItem Jun 20, 2019
@rosskevin
Copy link
Member Author

I have added a test for ListItem - this was reported in #14971

@rosskevin rosskevin mentioned this pull request Jun 21, 2019
2 tasks
@eps1lon
Copy link
Member

eps1lon commented Jul 10, 2019

Closing in favor of the existing issues.

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.

3 participants