{"action":"created","issue":{"url":"https://api.github.com/repos/techfort/LokiJS/issues/268","labels_url":"https://api.github.com/repos/techfort/LokiJS/issues/268/labels{/name}","comments_url":"https://api.github.com/repos/techfort/LokiJS/issues/268/comments","events_url":"https://api.github.com/repos/techfort/LokiJS/issues/268/events","html_url":"https://github.com/techfort/LokiJS/issues/268","id":114718129,"number":268,"title":"Moving LokiJS To TypeScript?","user":{"login":"TeamworkGuy2","id":890595,"avatar_url":"https://avatars.githubusercontent.com/u/890595?v=3","gravatar_id":"","url":"https://api.github.com/users/TeamworkGuy2","html_url":"https://github.com/TeamworkGuy2","followers_url":"https://api.github.com/users/TeamworkGuy2/followers","following_url":"https://api.github.com/users/TeamworkGuy2/following{/other_user}","gists_url":"https://api.github.com/users/TeamworkGuy2/gists{/gist_id}","starred_url":"https://api.github.com/users/TeamworkGuy2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TeamworkGuy2/subscriptions","organizations_url":"https://api.github.com/users/TeamworkGuy2/orgs","repos_url":"https://api.github.com/users/TeamworkGuy2/repos","events_url":"https://api.github.com/users/TeamworkGuy2/events{/privacy}","received_events_url":"https://api.github.com/users/TeamworkGuy2/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-11-03T00:46:50Z","updated_at":"2015-11-05T01:53:16Z","closed_at":null,"body":"Title makes this sound extreme, but there are some solid reasons to switch.\r\n\r\nMy viewpoint after writing the definition file for LokiJS (see https://github.com/techfort/LokiJS/issues/167) is that there's no obvious downsides to TypeScript for an OOP JS library like LokiJS, the code doesn't doing anything crazy with prototypes or function argument and makes an excellent target for TypeScript. \r\n\r\nSince all javascript code is valid typescript, file extensions can be changed to .ts to move a project to TypeScript.  Types can be added when contributer's have the time/desire.  There's a dozen tools and IDEs to compile .ts to .js when you save a file or as part of a build process, keeping side-by-side .ts and .js files in the LokiJS /src directory wouldn't take much effort. \r\n\r\nTypeScript has the obvious advantage of providing compile time error checking, it has great refactoring support (VS2015's TS tooling is pretty awesome! Check it out if you haven't) and the TS module syntax, shorthand lambdas, classes, etc. (which can all be compiled away into standard JS) merges very cleanly with ES6 making the upgrade easy in future. \r\n\r\nWhat are your, the major contributors to LokiJS, thoughts on upgrading Loki to typescript and pros/cons from your viewpoint? \r\n\r\n(based on my experience over the last 6 months working on a large business web app using VS2015 + TypeScript + LokiJS + lokijs.d.ts file linked in https://github.com/techfort/LokiJS/issues/167)"},"comment":{"url":"https://api.github.com/repos/techfort/LokiJS/issues/comments/153928517","html_url":"https://github.com/techfort/LokiJS/issues/268#issuecomment-153928517","issue_url":"https://api.github.com/repos/techfort/LokiJS/issues/268","id":153928517,"user":{"login":"TeamworkGuy2","id":890595,"avatar_url":"https://avatars.githubusercontent.com/u/890595?v=3","gravatar_id":"","url":"https://api.github.com/users/TeamworkGuy2","html_url":"https://github.com/TeamworkGuy2","followers_url":"https://api.github.com/users/TeamworkGuy2/followers","following_url":"https://api.github.com/users/TeamworkGuy2/following{/other_user}","gists_url":"https://api.github.com/users/TeamworkGuy2/gists{/gist_id}","starred_url":"https://api.github.com/users/TeamworkGuy2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TeamworkGuy2/subscriptions","organizations_url":"https://api.github.com/users/TeamworkGuy2/orgs","repos_url":"https://api.github.com/users/TeamworkGuy2/repos","events_url":"https://api.github.com/users/TeamworkGuy2/events{/privacy}","received_events_url":"https://api.github.com/users/TeamworkGuy2/received_events","type":"User","site_admin":false},"created_at":"2015-11-05T01:53:16Z","updated_at":"2015-11-05T01:53:16Z","body":"Thanks for your input obeliskos, TypeScript isn't pure javascript, that's true, but it is a superset of javascript, which means LokiJS core level methods could remain unchanged and higher level methods like resultset and dynamic view could have types added to their function parameters and return types. \r\n\r\nYes, the central repository for definitions is DefinitelyTyped.  I was thinking I might not always be available or remember to keep the definition over there updated as LokiJS continues to evolve, which was one of the reasons I asked this question. "}}