{"action":"reopened","issue":{"url":"https://api.github.com/repos/thebrodmann/deox/issues/122","repository_url":"https://api.github.com/repos/thebrodmann/deox","labels_url":"https://api.github.com/repos/thebrodmann/deox/issues/122/labels{/name}","comments_url":"https://api.github.com/repos/thebrodmann/deox/issues/122/comments","events_url":"https://api.github.com/repos/thebrodmann/deox/issues/122/events","html_url":"https://github.com/thebrodmann/deox/issues/122","id":492370043,"node_id":"MDU6SXNzdWU0OTIzNzAwNDM=","number":122,"title":"Make createActionCreator simpler by remove `resolve` callback from executor argument","user":{"login":"thebrodmann","id":20781126,"node_id":"MDQ6VXNlcjIwNzgxMTI2","avatar_url":"https://avatars3.githubusercontent.com/u/20781126?v=4","gravatar_id":"","url":"https://api.github.com/users/thebrodmann","html_url":"https://github.com/thebrodmann","followers_url":"https://api.github.com/users/thebrodmann/followers","following_url":"https://api.github.com/users/thebrodmann/following{/other_user}","gists_url":"https://api.github.com/users/thebrodmann/gists{/gist_id}","starred_url":"https://api.github.com/users/thebrodmann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thebrodmann/subscriptions","organizations_url":"https://api.github.com/users/thebrodmann/orgs","repos_url":"https://api.github.com/users/thebrodmann/repos","events_url":"https://api.github.com/users/thebrodmann/events{/privacy}","received_events_url":"https://api.github.com/users/thebrodmann/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2019-09-11T17:30:00Z","updated_at":"2019-09-11T18:05:57Z","closed_at":null,"author_association":"OWNER","body":"From [TypeScript 3.0](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-0.html#generic-rest-parameters) we are able to infer function's parameters with their names. So now we can remove `resolve` callback from `executor` in `createActionCreator` to make the API simpler.\r\n\r\n**Example**:\r\n```ts\r\n// (name: string) => { type: \"FETCH_TODOS\"; }\r\ncreateActionCreator(\"FETCH_TODOS\");\r\n\r\n// (name: string) => { type: \"ADD_TODO\"; payload: string; }\r\ncreateActionCreator(\"ADD_TODO\", (name: string) => ({ payload: name }));\r\n```\r\n\r\nThere is one caveat point that has been encountered in #108 and that's `type` property in return type of callable (2nd argument of proposed `createActionCreator`). One possible solution for the mentioned problem which I think is ideal is to set the type of `type` property to `undefiend`.\r\n\r\n```ts\r\n// Types of property 'type' are incompatible.\r\n// Type 'string' is not assignable to type 'undefined'.ts(2345)\r\ncreateActionCreator(\"ADD_TODO\", (name: string) => ({ type: 'MISTAKE', payload: name }));\r\n```\r\n\r\nWe can call the callable's return type `TypelessAction` as it's type should be undefined."}}
{"actor":{"display_login":"thebrodmann"}}