ooni / explorer

OONI Explorer: uncover evidence of internet censorship worldwide
https://explorer.ooni.org
BSD 3-Clause "New" or "Revised" License
64 stars 37 forks source link

Proposal: Migrate to TypeScript #853

Open chidexebere opened 1 year ago

chidexebere commented 1 year ago

Reasons

I have gone through a reasonable amount of the codebase and I have seen that there is a need to improve the development experience and code quality. TypeScript is better suited for building and managing large-scale applications with multiple teams.

Proposal

hellais commented 1 year ago

Ah yes this does indeed sound like a very good idea. As a matter of fact for newer projects we have started building them in typescript from the beginning.

If you would like to take a stab at starting the migration to typescript that would be fantastic!

chidexebere commented 1 year ago

I wanted to share my plan for the migration.

  1. Set up TypeScript: Install TypeScript and Create a tsconfig.json file to configure TypeScript.
  2. Rename the .js files to .tsx. I will start with the components folder and move to others.
  3. Update dependencies: Some third-party libraries have TypeScript typings available. I will Install these typings (e.g., @types/package-name). If typings are not available, I may need to create custom type definitions or leverage TypeScript's any type for those libraries.
  4. Type annotations and interfaces: Gradually add type annotations to the codebase using interfaces or type aliases.
  5. Compile and test: Run tests to ensure the migration hasn't introduced any regressions or bugs.
  6. Refactor and optimize.
  7. Iterate and repeat from step 2 as I move from one folder to another. Push code with migration done per folder.