{"action":"opened","issue":{"url":"https://api.github.com/repos/coderhaoxin/redux-action/issues/12","repository_url":"https://api.github.com/repos/coderhaoxin/redux-action","labels_url":"https://api.github.com/repos/coderhaoxin/redux-action/issues/12/labels{/name}","comments_url":"https://api.github.com/repos/coderhaoxin/redux-action/issues/12/comments","events_url":"https://api.github.com/repos/coderhaoxin/redux-action/issues/12/events","html_url":"https://github.com/coderhaoxin/redux-action/issues/12","id":192517717,"number":12,"title":"Support for Auto-Generated Type","user":{"login":"varHarrie","id":14304201,"avatar_url":"https://avatars.githubusercontent.com/u/14304201?v=3","gravatar_id":"","url":"https://api.github.com/users/varHarrie","html_url":"https://github.com/varHarrie","followers_url":"https://api.github.com/users/varHarrie/followers","following_url":"https://api.github.com/users/varHarrie/following{/other_user}","gists_url":"https://api.github.com/users/varHarrie/gists{/gist_id}","starred_url":"https://api.github.com/users/varHarrie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/varHarrie/subscriptions","organizations_url":"https://api.github.com/users/varHarrie/orgs","repos_url":"https://api.github.com/users/varHarrie/repos","events_url":"https://api.github.com/users/varHarrie/events{/privacy}","received_events_url":"https://api.github.com/users/varHarrie/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-11-30T09:38:49Z","updated_at":"2016-11-30T09:38:49Z","closed_at":null,"body":"It would be awesome if `createAction` can generate a unique type, when no pass any string in the first argument, like:\r\n\r\n```javascript\r\nconst increate = createAction()   // auto-generated type => `[1]`\r\nconst decreate = createAction(() => return something)  // auto-generated type => `[2]`\r\n```\r\n\r\nFor convenient,  we can override the `toString` function in action to return `type`\r\n```\r\nexport default function createAction(type, payloadCreator, metaCreator) {\r\n  const fn = (...args) => {\r\n    ......\r\n  }\r\n\r\n  fn.type = type\r\n\r\n  fn.toString = () => type    // <----------------  added\r\n\r\n  return fn\r\n}\r\n```\r\nTherefore,\r\n```\r\nconst reducer = createReducer(defaultState, {\r\n  [increment]: (payload, state, action) => {\r\n  },\r\n\r\n  [decrement]: (payload, state, action) => {\r\n  }\r\n})\r\n```\r\n\r\nHere is my vuex version: [vuex-action](https://github.com/varHarrie/vuex-action)"}}
{"actor":{"display_login":"varHarrie"}}