{"action":"created","issue":{"url":"https://api.github.com/repos/ant-design/ant-design/issues/4324","repository_url":"https://api.github.com/repos/ant-design/ant-design","labels_url":"https://api.github.com/repos/ant-design/ant-design/issues/4324/labels{/name}","comments_url":"https://api.github.com/repos/ant-design/ant-design/issues/4324/comments","events_url":"https://api.github.com/repos/ant-design/ant-design/issues/4324/events","html_url":"https://github.com/ant-design/ant-design/issues/4324","id":196862972,"number":4324,"title":"Export Column as component to leverage generic types similarly as in Tables","user":{"login":"piotrwitek","id":739075,"avatar_url":"https://avatars.githubusercontent.com/u/739075?v=3","gravatar_id":"","url":"https://api.github.com/users/piotrwitek","html_url":"https://github.com/piotrwitek","followers_url":"https://api.github.com/users/piotrwitek/followers","following_url":"https://api.github.com/users/piotrwitek/following{/other_user}","gists_url":"https://api.github.com/users/piotrwitek/gists{/gist_id}","starred_url":"https://api.github.com/users/piotrwitek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/piotrwitek/subscriptions","organizations_url":"https://api.github.com/users/piotrwitek/orgs","repos_url":"https://api.github.com/users/piotrwitek/repos","events_url":"https://api.github.com/users/piotrwitek/events{/privacy}","received_events_url":"https://api.github.com/users/piotrwitek/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2016-12-21T07:16:19Z","updated_at":"2016-12-23T08:43:29Z","closed_at":"2016-12-22T06:57:09Z","body":"Change proposal:\r\nIn Table class you are declaring Column as static prop, thus it cannot be consumed as generic.\r\nBut Column Class is generic and should infer the type from Table (to be able to leverage type inference for records in render method)\r\n\r\nFor instance when I try to consume the library in TypeScript I want to extend Table as a generic type like for instance: `class UserTable extends Table<User> { };`, then I can leverage typed record object.\r\nI want to do the exactly the same for Column but I cannot, because I'm forced to use this static Column property from Table Class, like this: `const Column = UserTable.Column;`\r\n\r\nMy proposal is to export Column Class as Component so I can import it like Table and extend using generics the same way as with Table: `class UserColumn extends Column<User> { };`, then I could leverage typing like this:\r\n```\r\nimport { Column } from 'antd';\r\nclass UserColumn extends Column<User> { };\r\n<UserColumn key=\"user\" render={(text, record) => {\r\n        return <UserItem user={record} />; // <- with my change the record will have type User, now it is abstract type T ;/ \r\n      } }\r\n/>\r\n```\r\n\r\nPlease tell me if you are accepting PRs, maybe I can look into this in my free time.\r\n\r\nColumn declaration in Table:\r\nhttps://github.com/ant-design/ant-design/blob/master/components/table/Table.tsx#L87\r\nColumn Class:\r\nhttps://github.com/ant-design/ant-design/blob/master/components/table/Column.tsx#L22\r\n \r\n"},"comment":{"url":"https://api.github.com/repos/ant-design/ant-design/issues/comments/268957728","html_url":"https://github.com/ant-design/ant-design/issues/4324#issuecomment-268957728","issue_url":"https://api.github.com/repos/ant-design/ant-design/issues/4324","id":268957728,"user":{"login":"piotrwitek","id":739075,"avatar_url":"https://avatars.githubusercontent.com/u/739075?v=3","gravatar_id":"","url":"https://api.github.com/users/piotrwitek","html_url":"https://github.com/piotrwitek","followers_url":"https://api.github.com/users/piotrwitek/followers","following_url":"https://api.github.com/users/piotrwitek/following{/other_user}","gists_url":"https://api.github.com/users/piotrwitek/gists{/gist_id}","starred_url":"https://api.github.com/users/piotrwitek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/piotrwitek/subscriptions","organizations_url":"https://api.github.com/users/piotrwitek/orgs","repos_url":"https://api.github.com/users/piotrwitek/repos","events_url":"https://api.github.com/users/piotrwitek/events{/privacy}","received_events_url":"https://api.github.com/users/piotrwitek/received_events","type":"User","site_admin":false},"created_at":"2016-12-23T08:43:29Z","updated_at":"2016-12-23T08:43:29Z","body":"@benjycui @bang88 @afc163  Thanks for trying to help, but could you please elaborate a little bit more with some alternatives/solutions to the problem, I'm trying to figure out a nice convention on how to use your library in a elegant typed manner.\r\n\r\nIf I'm not able to extend Column with generic type then I believe your library is not designed correctly from consumer perspective as it should be possible to do so, especially because you library is written in TypeScript.\r\n\r\nCould you please tell me what is your solution to this problem, should I open another issue addressing this problem specifically? "}}
{"actor":{"display_login":"piotrwitek"}}