-
Notifications
You must be signed in to change notification settings - Fork 71
Description
Since adding typescript support to the project, all javascript are gradually being converted to typescript to give us the benefits of type safety! As of the time of this post we are currently sitting at 73% TS to 18% JS, which is already huge! To help keep this number increasing, we require all new files to be written in typescript instead of javascript.
There still are a few lingering javascript files, though. For a while I've just been converting certain ones when it's convenient to do so, such as if I'm making a change to it, or if another typescript file I'm working on needs to reference it. However, focusing directly on targeting these remaining files can get us much quicker towards the entire repo being in typescript.
This task may be split up too, any PRs don't have to have converted ALL files to typescript, even just one file conversion is fine to PR!
Note that not EVERY javascript file may be converted into typescript. This would include [build.js, src/client/scripts/cjs/game/htmlscript.js].
Obviously try to adopt professional typescript practice, we don't toler the use of "any" or "//@ts-ignore"s (with one exception) or casts with "as" (rare exceptions). The goal is to obtain maximum benefit from type safety, not get the conversions over with :) Also, all newly added types or interfaces should have jsdoc info, even if it's brief, this allows Intellisense to give us useful info when hovering over references to the type! Also, when you convert a file to typescript, you may experience ts errors if it imports some still-in-javascript files, for those it is fine to stick a "// @ts-ignore" above the import line to avoid the error. After all, when all files are eventually finished being converted, those ignore lines won't be needed anymore.