{"action":"created","issue":{"url":"https://api.github.com/repos/mobxjs/mobx-state-tree/issues/705","repository_url":"https://api.github.com/repos/mobxjs/mobx-state-tree","labels_url":"https://api.github.com/repos/mobxjs/mobx-state-tree/issues/705/labels{/name}","comments_url":"https://api.github.com/repos/mobxjs/mobx-state-tree/issues/705/comments","events_url":"https://api.github.com/repos/mobxjs/mobx-state-tree/issues/705/events","html_url":"https://github.com/mobxjs/mobx-state-tree/issues/705","id":305599825,"node_id":"MDU6SXNzdWUzMDU1OTk4MjU=","number":705,"title":"Improve typing with Typescript 2.8 Conditional Types","user":{"login":"benjaminjackman","id":62048,"node_id":"MDQ6VXNlcjYyMDQ4","avatar_url":"https://avatars2.githubusercontent.com/u/62048?v=4","gravatar_id":"","url":"https://api.github.com/users/benjaminjackman","html_url":"https://github.com/benjaminjackman","followers_url":"https://api.github.com/users/benjaminjackman/followers","following_url":"https://api.github.com/users/benjaminjackman/following{/other_user}","gists_url":"https://api.github.com/users/benjaminjackman/gists{/gist_id}","starred_url":"https://api.github.com/users/benjaminjackman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benjaminjackman/subscriptions","organizations_url":"https://api.github.com/users/benjaminjackman/orgs","repos_url":"https://api.github.com/users/benjaminjackman/repos","events_url":"https://api.github.com/users/benjaminjackman/events{/privacy}","received_events_url":"https://api.github.com/users/benjaminjackman/received_events","type":"User","site_admin":false},"labels":[{"id":436545882,"node_id":"MDU6TGFiZWw0MzY1NDU4ODI=","url":"https://api.github.com/repos/mobxjs/mobx-state-tree/labels/enhancement","name":"enhancement","color":"84b6eb","default":true},{"id":861959895,"node_id":"MDU6TGFiZWw4NjE5NTk4OTU=","url":"https://api.github.com/repos/mobxjs/mobx-state-tree/labels/has%20PR","name":"has PR","color":"057070","default":false},{"id":805426182,"node_id":"MDU6TGFiZWw4MDU0MjYxODI=","url":"https://api.github.com/repos/mobxjs/mobx-state-tree/labels/help/PR%20welcome","name":"help/PR welcome","color":"a2d12b","default":false}],"state":"open","locked":false,"assignee":{"login":"mweststrate","id":1820292,"node_id":"MDQ6VXNlcjE4MjAyOTI=","avatar_url":"https://avatars0.githubusercontent.com/u/1820292?v=4","gravatar_id":"","url":"https://api.github.com/users/mweststrate","html_url":"https://github.com/mweststrate","followers_url":"https://api.github.com/users/mweststrate/followers","following_url":"https://api.github.com/users/mweststrate/following{/other_user}","gists_url":"https://api.github.com/users/mweststrate/gists{/gist_id}","starred_url":"https://api.github.com/users/mweststrate/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mweststrate/subscriptions","organizations_url":"https://api.github.com/users/mweststrate/orgs","repos_url":"https://api.github.com/users/mweststrate/repos","events_url":"https://api.github.com/users/mweststrate/events{/privacy}","received_events_url":"https://api.github.com/users/mweststrate/received_events","type":"User","site_admin":false},"assignees":[{"login":"mweststrate","id":1820292,"node_id":"MDQ6VXNlcjE4MjAyOTI=","avatar_url":"https://avatars0.githubusercontent.com/u/1820292?v=4","gravatar_id":"","url":"https://api.github.com/users/mweststrate","html_url":"https://github.com/mweststrate","followers_url":"https://api.github.com/users/mweststrate/followers","following_url":"https://api.github.com/users/mweststrate/following{/other_user}","gists_url":"https://api.github.com/users/mweststrate/gists{/gist_id}","starred_url":"https://api.github.com/users/mweststrate/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mweststrate/subscriptions","organizations_url":"https://api.github.com/users/mweststrate/orgs","repos_url":"https://api.github.com/users/mweststrate/repos","events_url":"https://api.github.com/users/mweststrate/events{/privacy}","received_events_url":"https://api.github.com/users/mweststrate/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/mobxjs/mobx-state-tree/milestones/3","html_url":"https://github.com/mobxjs/mobx-state-tree/milestone/3","labels_url":"https://api.github.com/repos/mobxjs/mobx-state-tree/milestones/3/labels","id":3334007,"node_id":"MDk6TWlsZXN0b25lMzMzNDAwNw==","number":3,"title":"3.0","description":null,"creator":{"login":"mweststrate","id":1820292,"node_id":"MDQ6VXNlcjE4MjAyOTI=","avatar_url":"https://avatars0.githubusercontent.com/u/1820292?v=4","gravatar_id":"","url":"https://api.github.com/users/mweststrate","html_url":"https://github.com/mweststrate","followers_url":"https://api.github.com/users/mweststrate/followers","following_url":"https://api.github.com/users/mweststrate/following{/other_user}","gists_url":"https://api.github.com/users/mweststrate/gists{/gist_id}","starred_url":"https://api.github.com/users/mweststrate/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mweststrate/subscriptions","organizations_url":"https://api.github.com/users/mweststrate/orgs","repos_url":"https://api.github.com/users/mweststrate/repos","events_url":"https://api.github.com/users/mweststrate/events{/privacy}","received_events_url":"https://api.github.com/users/mweststrate/received_events","type":"User","site_admin":false},"open_issues":3,"closed_issues":16,"state":"open","created_at":"2018-05-09T18:23:30Z","updated_at":"2018-08-18T10:27:59Z","due_on":null,"closed_at":null},"comments":16,"created_at":"2018-03-15T15:25:16Z","updated_at":"2018-10-20T20:58:22Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"I don't see any open issues on this so I wanted to create an issue to track progress on using the upcoming Typescript 2.8 conditional types feature to provide stronger type guarantees for MST.\r\n\r\nI have a very rough draft that I am experimenting with in a couple of projects and so far it looks very promising!\r\n\r\nI will try to refine it into something that is intelligible enough to be shared. Currently since the conditional types stuff is so new I had to learn as I went, and so there is a lot of commented out and dead ends in the code.\r\n\r\nA couple of quick notes on my implementation:\r\n1. I implemented it as a hand written .d.ts file that provided most of the functionality I was using but is not exhaustive.\r\n\r\n2. I used 3 distinct types for the factories: \r\n a. Creation Type: This is a value that is legal to be passed into create and which has all the fields correctly marked as required / optional.\r\n b. Snapshot Type: This is what is emitted from toJSON / getSnapshot\r\n c. Runtime Type (which I just call Type): This is what is returned create is called.\r\n\r\nAlso, I have experimented with a deep readonly implementation for enforcing protected trees that should not be modified outside of an action. I had some success with it and think ultimately it could work, though I am not sure how to deal uniformly exposing types for unprotected trees.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/mobxjs/mobx-state-tree/issues/comments/431617502","html_url":"https://github.com/mobxjs/mobx-state-tree/issues/705#issuecomment-431617502","issue_url":"https://api.github.com/repos/mobxjs/mobx-state-tree/issues/705","id":431617502,"node_id":"MDEyOklzc3VlQ29tbWVudDQzMTYxNzUwMg==","user":{"login":"xaviergonz","id":6306796,"node_id":"MDQ6VXNlcjYzMDY3OTY=","avatar_url":"https://avatars2.githubusercontent.com/u/6306796?v=4","gravatar_id":"","url":"https://api.github.com/users/xaviergonz","html_url":"https://github.com/xaviergonz","followers_url":"https://api.github.com/users/xaviergonz/followers","following_url":"https://api.github.com/users/xaviergonz/following{/other_user}","gists_url":"https://api.github.com/users/xaviergonz/gists{/gist_id}","starred_url":"https://api.github.com/users/xaviergonz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xaviergonz/subscriptions","organizations_url":"https://api.github.com/users/xaviergonz/orgs","repos_url":"https://api.github.com/users/xaviergonz/repos","events_url":"https://api.github.com/users/xaviergonz/events{/privacy}","received_events_url":"https://api.github.com/users/xaviergonz/received_events","type":"User","site_admin":false},"created_at":"2018-10-20T20:58:22Z","updated_at":"2018-10-20T20:58:22Z","author_association":"CONTRIBUTOR","body":"@mweststrate can this one be closed?"}}
{"actor":{"display_login":"xaviergonz"}}