{"action":"created","issue":{"url":"https://api.github.com/repos/sinonjs/sinon/issues/1380","repository_url":"https://api.github.com/repos/sinonjs/sinon","labels_url":"https://api.github.com/repos/sinonjs/sinon/issues/1380/labels{/name}","comments_url":"https://api.github.com/repos/sinonjs/sinon/issues/1380/comments","events_url":"https://api.github.com/repos/sinonjs/sinon/issues/1380/events","html_url":"https://github.com/sinonjs/sinon/pull/1380","id":221894398,"number":1380,"title":"🚀 Hello TypeScript","user":{"login":"jonnyreeves","id":200185,"avatar_url":"https://avatars0.githubusercontent.com/u/200185?v=3","gravatar_id":"","url":"https://api.github.com/users/jonnyreeves","html_url":"https://github.com/jonnyreeves","followers_url":"https://api.github.com/users/jonnyreeves/followers","following_url":"https://api.github.com/users/jonnyreeves/following{/other_user}","gists_url":"https://api.github.com/users/jonnyreeves/gists{/gist_id}","starred_url":"https://api.github.com/users/jonnyreeves/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jonnyreeves/subscriptions","organizations_url":"https://api.github.com/users/jonnyreeves/orgs","repos_url":"https://api.github.com/users/jonnyreeves/repos","events_url":"https://api.github.com/users/jonnyreeves/events{/privacy}","received_events_url":"https://api.github.com/users/jonnyreeves/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-04-14T21:24:47Z","updated_at":"2017-04-14T22:04:53Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/sinonjs/sinon/pulls/1380","html_url":"https://github.com/sinonjs/sinon/pull/1380","diff_url":"https://github.com/sinonjs/sinon/pull/1380.diff","patch_url":"https://github.com/sinonjs/sinon/pull/1380.patch"},"body":"#### Purpose (TL;DR) - mandatory\r\nAdds support for *gradually* migrating the sinon codebase over to TypeScript including the migration of a single utility and its test (`times-in-words`)\r\n\r\n#### Background (Problem in detail)  - optional\r\nWell seeing as it only took us the best part of 18 months to migrate to commonJS; I thought it would be worth a shot a migrating to TypeScript ;)  In all seriousness, I've found TypeScript to have provided a massive benefit to the projects that I've been working on making code written by other developers easier to reason about - in addition, using TypeScript allows us to make use of ES6+ features whilst still targeting ES5 browsers (heck, we can even target ES3!).  The other benefit is that once all source files are TypeScript (`.ts`, as opposed to `.js`), we can autogenerate the TypeScript definition files (`.d.ts`) which provides typehints to users of sinon - something will with be greatly appreciated by some in the community.\r\n\r\nObviously migrating the codebase to TypeScript is a pretty massive shift (and, ultimately to some degree, boils down to a personal preference) - hence why I've done an absolute MVP here in this case: however I'm keen to explore what the 'guts' of sinon will look like typed.\r\n\r\nFinally, for those new to the TypeScript eco-system the ES5 code generated by the TypeScript compiler is very clean (and can easily be mistaken for hand-written ES5 once formatted) - so a migration back to plan javascript in the future would be reasonably trivial (ie: minimal sunk cost).\r\n\r\n#### Solution  - optional\r\n- Add typescript and tslint; use a sensible `tsconfig.json` which allows interop with the existing javascript source\r\n- Move all sinon source code in `src/` and transpile it into the `lib` folder at build time.\r\n- Run `tsc` before each test suite - this is incredibly inefficient, however compilation speed is very fast at this stage and I didn't want to mess around too much for the MVP: this can easily be optimised later if we wish to invest in this approach.\r\n\r\n#### How to verify - mandatory\r\n1. Check out this branch (see github instructions below)\r\n2. `npm install`\r\n3. npm test\r\n"},"comment":{"url":"https://api.github.com/repos/sinonjs/sinon/issues/comments/294245465","html_url":"https://github.com/sinonjs/sinon/pull/1380#issuecomment-294245465","issue_url":"https://api.github.com/repos/sinonjs/sinon/issues/1380","id":294245465,"user":{"login":"fearphage","id":23887,"avatar_url":"https://avatars2.githubusercontent.com/u/23887?v=3","gravatar_id":"","url":"https://api.github.com/users/fearphage","html_url":"https://github.com/fearphage","followers_url":"https://api.github.com/users/fearphage/followers","following_url":"https://api.github.com/users/fearphage/following{/other_user}","gists_url":"https://api.github.com/users/fearphage/gists{/gist_id}","starred_url":"https://api.github.com/users/fearphage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fearphage/subscriptions","organizations_url":"https://api.github.com/users/fearphage/orgs","repos_url":"https://api.github.com/users/fearphage/repos","events_url":"https://api.github.com/users/fearphage/events{/privacy}","received_events_url":"https://api.github.com/users/fearphage/received_events","type":"User","site_admin":false},"created_at":"2017-04-14T22:04:53Z","updated_at":"2017-04-14T22:04:53Z","body":"Can you generate the typescript bindings from javascript? I personally enjoy writing javascript myself. I'm not sure about everyone else. If we were planning to write it in not-js, I would suggest something with more benefits than typescript honestly (elm, clojurescript, etc)."}}
{"actor":{"display_login":"fearphage"}}