freeCodeCamp / camperchan

Discord bot running in our freeCodeCamp Discord server
https://discord.gg/KVUmVXA
BSD 3-Clause "New" or "Revised" License
29 stars 26 forks source link

Refactor project to TypeScript #55

Closed bradtaniguchi closed 4 years ago

bradtaniguchi commented 4 years ago

Is your feature request related to a problem? Please describe. Currently the project is written in JS for lower barrier of entry, however discord.js already provides first party TS support via providing their own types.

Describe the solution you'd like We should migrate to TS which will make it slightly harder to develop, but make it easier to leverage discord features thru the provided types.

Describe alternatives you've considered We don't need TS, but I believe having it will prevent bugs down the line, and increase overall code quality.

Additional context Due to how the code is currently written, we should be able to make minimal changes to the existing code to get everything to work.

Twaha-Rahman commented 4 years ago

@bradtaniguchi FCC approved TS finally?😱

bradtaniguchi commented 4 years ago

more like approved of doing whatever, and approved of a lot more features, so it's more or less now or never!

Twaha-Rahman commented 4 years ago

more like approved of doing whatever, and approved of a lot more features, so it's more or less now or never!

Haha.... good to know...

cjcanlas01 commented 4 years ago

Any recommendation for learning materials on studying TS?

bradtaniguchi commented 4 years ago

@cjcanlas01 the official docs are the best starting point: https://www.typescriptlang.org/docs/home.html

I'm slowly going through the codebase and refactoring it with TS. Most changes are actually related to the code itself. (typos, use of import/export, adding required type defs)

You can checkout the changes in this branch: https://github.com/bradtaniguchi/discord-bot-test/tree/chore/55/migrate-to-ts

edit Should move the postinstall script to something recommended here: https://devcenter.heroku.com/articles/nodejs-support#heroku-specific-build-steps