{"action":"closed","issue":{"url":"https://api.github.com/repos/mui-org/material-ui/issues/12670","repository_url":"https://api.github.com/repos/mui-org/material-ui","labels_url":"https://api.github.com/repos/mui-org/material-ui/issues/12670/labels{/name}","comments_url":"https://api.github.com/repos/mui-org/material-ui/issues/12670/comments","events_url":"https://api.github.com/repos/mui-org/material-ui/issues/12670/events","html_url":"https://github.com/mui-org/material-ui/issues/12670","id":354193100,"node_id":"MDU6SXNzdWUzNTQxOTMxMDA=","number":12670,"title":"[Typescript] Typescript 3.0 defaultProps ","user":{"login":"xiaoyu-tamu","id":33362998,"node_id":"MDQ6VXNlcjMzMzYyOTk4","avatar_url":"https://avatars3.githubusercontent.com/u/33362998?v=4","gravatar_id":"","url":"https://api.github.com/users/xiaoyu-tamu","html_url":"https://github.com/xiaoyu-tamu","followers_url":"https://api.github.com/users/xiaoyu-tamu/followers","following_url":"https://api.github.com/users/xiaoyu-tamu/following{/other_user}","gists_url":"https://api.github.com/users/xiaoyu-tamu/gists{/gist_id}","starred_url":"https://api.github.com/users/xiaoyu-tamu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xiaoyu-tamu/subscriptions","organizations_url":"https://api.github.com/users/xiaoyu-tamu/orgs","repos_url":"https://api.github.com/users/xiaoyu-tamu/repos","events_url":"https://api.github.com/users/xiaoyu-tamu/events{/privacy}","received_events_url":"https://api.github.com/users/xiaoyu-tamu/received_events","type":"User","site_admin":false},"labels":[{"id":672358040,"node_id":"MDU6TGFiZWw2NzIzNTgwNDA=","url":"https://api.github.com/repos/mui-org/material-ui/labels/typescript","name":"typescript","color":"006b75","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-08-27T06:16:55Z","updated_at":"2018-09-11T20:35:28Z","closed_at":"2018-09-11T20:35:28Z","author_association":"CONTRIBUTOR","body":"<!--- Provide a general summary of the feature in the Title above -->\r\nThe Typescript 3.0 support defaultProps but withStyles HOC doesn't work. The compiler throws this error:\r\nType '{}' is not assignable to type 'Readonly<Pick<Props, \"propWithDefault\">>'.\r\n  Property 'propWithDefault' is missing in type '{}'. \r\n<!--\r\n    Thank you very much for contributing to Material-UI by creating an issue! ❤️\r\n    To avoid duplicate issues we ask you to check off the following list.\r\n-->\r\n\r\n<!-- Checked checkbox should look like this: [x] -->\r\n- [x] This is a v1.x issue. <!-- (v0.x is no longer maintained) -->\r\n- [x] I have searched the [issues](https://github.com/mui-org/material-ui/issues) of this repository and believe that this is not a duplicate.\r\n\r\n\r\n```\r\n// FileA.tsx\r\nimport React, { Component } from 'react';\r\nimport { Button, createStyles, withStyles, WithStyles } from '@material-ui/core';\r\n\r\nexport interface Props {\r\n  withDefaultProps: number;\r\n}\r\n\r\nclass MyButton extends Component<Props & WithStyles<typeof styles>> {\r\n  static defaultProps = {\r\n    withDefaultProps: 0,\r\n  };\r\n\r\n  render() {\r\n    const { classes, withDefaultProps } = this.props;\r\n    return <Button className={classes.btn}>{withDefaultProps}</Button>;\r\n  }\r\n}\r\n\r\nconst styles = () =>\r\n  createStyles({\r\n    btn: {\r\n      color: 'red',\r\n    },\r\n  });\r\n\r\nexport default withStyles(styles)(MyButton);\r\n```\r\n\r\n\r\n## Expected Behavior\r\n<!---\r\n    Describe how it should work.\r\n-->\r\n\r\n```\r\n// FileB.tsx\r\nimport React from 'react';\r\nimport MyButton from '../FileA';\r\n\r\nexport default () =>  <MyButton />\r\n\r\n\r\n// It should not report error\r\n```\r\n## Current Behavior\r\n<!---\r\n    Explain the difference from current behavior.\r\n-->\r\n\r\n```\r\n// FileB.tsx\r\nimport React from 'react';\r\nimport MyButton from '../FileA';\r\n\r\nexport default () =>  <MyButton />\r\n\r\n// Error: Type '{}' is not assignable to type 'Pick<Pick<Props, \"withDefaultProps\">, \"withDefaultProps\">'. Property 'withDefaultProps' is missing in type '{}'\r\n```\r\n## Examples\r\n<!---\r\n    Provide a link to the Material design specification, other implementations, \r\n    or screenshots of the expected behavior.\r\n-->\r\n\r\n## Context\r\n<!---\r\n    What are you trying to accomplish? How has the lack of this feature affected you?\r\n    Providing context helps us come up with a solution that is most useful in the real world.\r\n-->\r\n\r\n\r\nPackage versions\r\n- typescript@3.0.1\r\n- react@16.4.2\r\n- @types/react@16.4.12\r\n- @material-ui/core @1.5.1\r\n\r\n"}}
{"actor":{"display_login":"pelotom"}}