{"action":"created","issue":{"url":"https://api.github.com/repos/gcanti/tcomb/issues/146","labels_url":"https://api.github.com/repos/gcanti/tcomb/issues/146/labels{/name}","comments_url":"https://api.github.com/repos/gcanti/tcomb/issues/146/comments","events_url":"https://api.github.com/repos/gcanti/tcomb/issues/146/events","html_url":"https://github.com/gcanti/tcomb/issues/146","id":106840254,"number":146,"title":"Interface like support","user":{"login":"delaneyj","id":438252,"avatar_url":"https://avatars.githubusercontent.com/u/438252?v=3","gravatar_id":"","url":"https://api.github.com/users/delaneyj","html_url":"https://github.com/delaneyj","followers_url":"https://api.github.com/users/delaneyj/followers","following_url":"https://api.github.com/users/delaneyj/following{/other_user}","gists_url":"https://api.github.com/users/delaneyj/gists{/gist_id}","starred_url":"https://api.github.com/users/delaneyj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/delaneyj/subscriptions","organizations_url":"https://api.github.com/users/delaneyj/orgs","repos_url":"https://api.github.com/users/delaneyj/repos","events_url":"https://api.github.com/users/delaneyj/events{/privacy}","received_events_url":"https://api.github.com/users/delaneyj/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-09-16T19:04:58Z","updated_at":"2015-09-17T16:25:16Z","closed_at":"2015-09-17T16:25:16Z","body":"Hi, so given this code...\r\n```\r\nconst EventInterface = struct({\r\n  success: Boolean,\r\n  errror: maybe(String)\r\n});\r\n\r\nconst EventA = EventInterface.extend({\r\n  data: struct({\r\n    foo: String,\r\n    bar: String\r\n  })\r\n}, 'EventA');\r\n\r\nconst EventB = EventInterface.extend({\r\n  data: struct({\r\n    baz: Boolean\r\n  })\r\n}, 'EventB');\r\n\r\nconst eventA = EventA({success: true, data: {foo: `foo`, bar: `bar`}});\r\nconst eventB = EventB({success: true, data: {baz: false}});\r\nconst EventList = list(EventInterface, 'events');\r\nconst events = EventList([eventA,eventB]);\r\nconsole.log(JSON.stringify(events, null, 2));\r\n```\r\n\r\nthis is the output\r\n```\r\n[\r\n  {\r\n    \"success\": true,\r\n    \"errror\": null\r\n  },\r\n  {\r\n    \"success\": true,\r\n    \"errror\": null\r\n  }\r\n]\r\n```\r\n\r\nHowever if I changed the ```list``` to a union ala ```const EventList = list(union([EventA,EventB]), 'events');``` I get what I want.\r\n\r\n```\r\n[\r\n  {\r\n    \"success\": true,\r\n    \"errror\": null,\r\n    \"data\": {\r\n      \"foo\": \"foo\",\r\n      \"bar\": \"bar\"\r\n    }\r\n  },\r\n  {\r\n    \"success\": true,\r\n    \"errror\": null,\r\n    \"data\": {\r\n      \"baz\": false\r\n    }\r\n  }\r\n]\r\n```\r\n\r\nIt appears \r\n```\r\nconst EventInterface = struct({\r\n  success: Boolean,\r\n  errror: maybe(String)\r\n});\r\n\r\nconst EventA = EventInterface.extend({\r\n  data: struct({\r\n    foo: String,\r\n    bar: String\r\n  })\r\n}, 'EventA');\r\n\r\nconst EventB = EventInterface.extend({\r\n  data: struct({\r\n    baz: Boolean\r\n  })\r\n}, 'EventB');\r\n\r\nconst eventA = EventA({success: true, data: {foo: `foo`, bar: `bar`}});\r\nconst eventB = EventB({success: true, data: {baz: false}});\r\nconst EventList = list(EventInterface, 'events');\r\nconst events = EventList([eventA,eventB]);\r\nconsole.log(JSON.stringify(events, null, 2));\r\n```\r\n\r\nthis outputs \r\n```\r\n[\r\n  {\r\n    \"success\": true,\r\n    \"errror\": null\r\n  },\r\n  {\r\n    \"success\": true,\r\n    \"errror\": null\r\n  }\r\n]\r\n```\r\n\r\nHowever if I changed the ```list``` to a union ala ```const EventList = list(union([EventA,EventB]), 'events');``` I get what I want.\r\n\r\n```\r\n[\r\n  {\r\n    \"success\": true,\r\n    \"errror\": null,\r\n    \"data\": {\r\n      \"foo\": \"foo\",\r\n      \"bar\": \"bar\"\r\n    }\r\n  },\r\n  {\r\n    \"success\": true,\r\n    \"errror\": null,\r\n    \"data\": {\r\n      \"baz\": false\r\n    }\r\n  }\r\n]\r\n```\r\n\r\nIt appears that the non EventInterface keys are getting discarded (as explained in the docs).  Is there a way to basically either not discard the keys (like mixins ```override:true```) or a better approach than want I am currently doing?  I'd like to avoid having a union of every possible extension of EventInterface.  Thanks!"},"comment":{"url":"https://api.github.com/repos/gcanti/tcomb/issues/comments/141139666","html_url":"https://github.com/gcanti/tcomb/issues/146#issuecomment-141139666","issue_url":"https://api.github.com/repos/gcanti/tcomb/issues/146","id":141139666,"user":{"login":"delaneyj","id":438252,"avatar_url":"https://avatars.githubusercontent.com/u/438252?v=3","gravatar_id":"","url":"https://api.github.com/users/delaneyj","html_url":"https://github.com/delaneyj","followers_url":"https://api.github.com/users/delaneyj/followers","following_url":"https://api.github.com/users/delaneyj/following{/other_user}","gists_url":"https://api.github.com/users/delaneyj/gists{/gist_id}","starred_url":"https://api.github.com/users/delaneyj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/delaneyj/subscriptions","organizations_url":"https://api.github.com/users/delaneyj/orgs","repos_url":"https://api.github.com/users/delaneyj/repos","events_url":"https://api.github.com/users/delaneyj/events{/privacy}","received_events_url":"https://api.github.com/users/delaneyj/received_events","type":"User","site_admin":false},"created_at":"2015-09-17T16:25:16Z","updated_at":"2015-09-17T16:25:16Z","body":"That's what I figured, thanks for you quick response."}}