{"action":"created","issue":{"url":"https://api.github.com/repos/benjamn/ast-types/issues/300","repository_url":"https://api.github.com/repos/benjamn/ast-types","labels_url":"https://api.github.com/repos/benjamn/ast-types/issues/300/labels{/name}","comments_url":"https://api.github.com/repos/benjamn/ast-types/issues/300/comments","events_url":"https://api.github.com/repos/benjamn/ast-types/issues/300/events","html_url":"https://github.com/benjamn/ast-types/pull/300","id":382375137,"node_id":"MDExOlB1bGxSZXF1ZXN0MjMyMDk3ODMw","number":300,"title":"Convert repo to TypeScript; Auto-generate types for defs","user":{"login":"brieb","id":723547,"node_id":"MDQ6VXNlcjcyMzU0Nw==","avatar_url":"https://avatars2.githubusercontent.com/u/723547?v=4","gravatar_id":"","url":"https://api.github.com/users/brieb","html_url":"https://github.com/brieb","followers_url":"https://api.github.com/users/brieb/followers","following_url":"https://api.github.com/users/brieb/following{/other_user}","gists_url":"https://api.github.com/users/brieb/gists{/gist_id}","starred_url":"https://api.github.com/users/brieb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brieb/subscriptions","organizations_url":"https://api.github.com/users/brieb/orgs","repos_url":"https://api.github.com/users/brieb/repos","events_url":"https://api.github.com/users/brieb/events{/privacy}","received_events_url":"https://api.github.com/users/brieb/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2018-11-19T20:12:42Z","updated_at":"2018-11-28T04:10:41Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/benjamn/ast-types/pulls/300","html_url":"https://github.com/benjamn/ast-types/pull/300","diff_url":"https://github.com/benjamn/ast-types/pull/300.diff","patch_url":"https://github.com/benjamn/ast-types/pull/300.patch"},"body":"Following up from our twitter thread: https://twitter.com/benjamn/status/1063979819149475841\r\n\r\nStarted down the path of making d.ts files, but in combing through the code to make sure the types were correct, I increasingly felt like I'd have more confidence if we just converted the code to TS. Sounded like you were open to this idea from your twitter comment.\r\n\r\nGoals:\r\n- Convert all files from JS to TS\r\n- Emit TypeScript declarations\r\n- Auto-generate types for types/builders/visitor, as exported from main\r\n- Preserve all runtime behavior / only modify the code in the type space\r\n- Backwards compatibility\r\n  - Keep folder structure for emitted JS, to not change import paths for users\r\n  - Keep `module.exports =` by using TypeScript's `export =`, so default export behavior doesn't change\r\n\r\nTODO:\r\n- The types are pretty loose (lots of `any`), but are at least correct. We'll want to narrow these types over time.\r\n\r\nThe results are pretty awesome!\r\n\r\n![image](https://user-images.githubusercontent.com/723547/48732342-43646280-ebf4-11e8-9da7-6e612412fa98.png)\r\n\r\nReviewers: @benjamn "},"comment":{"url":"https://api.github.com/repos/benjamn/ast-types/issues/comments/442312842","html_url":"https://github.com/benjamn/ast-types/pull/300#issuecomment-442312842","issue_url":"https://api.github.com/repos/benjamn/ast-types/issues/300","id":442312842,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0MjMxMjg0Mg==","user":{"login":"benjamn","id":5750,"node_id":"MDQ6VXNlcjU3NTA=","avatar_url":"https://avatars0.githubusercontent.com/u/5750?v=4","gravatar_id":"","url":"https://api.github.com/users/benjamn","html_url":"https://github.com/benjamn","followers_url":"https://api.github.com/users/benjamn/followers","following_url":"https://api.github.com/users/benjamn/following{/other_user}","gists_url":"https://api.github.com/users/benjamn/gists{/gist_id}","starred_url":"https://api.github.com/users/benjamn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benjamn/subscriptions","organizations_url":"https://api.github.com/users/benjamn/orgs","repos_url":"https://api.github.com/users/benjamn/repos","events_url":"https://api.github.com/users/benjamn/events{/privacy}","received_events_url":"https://api.github.com/users/benjamn/received_events","type":"User","site_admin":false},"created_at":"2018-11-28T04:10:41Z","updated_at":"2018-11-28T04:10:41Z","author_association":"OWNER","body":"I don't have any good ideas yet for generating specific types per def, but I'm mostly OK with the possibility of having too many fields on a type, or too many options in a union, as long as the types are correct for the default setup.\r\n\r\nI think I have a solution that allows `Type` to be an actual class, without triggering the error about private types. I was hoping to push that work tonight, but I still need to get a few tests to pass, and I've run out of time this evening. In the meantime, just be aware that changes are coming (especially in `lib/types.ts`), in case you wanted to push any other changes, though I'm happy to rebase if necessary."}}
{"actor":{"display_login":"benjamn"}}