Anarios / return-youtube-dislike

Chrome extension to return youtube dislikes
https://returnyoutubedislike.com/
GNU General Public License v3.0
12.34k stars 548 forks source link

Add TypeScript #960

Open AminoffZ opened 9 months ago

AminoffZ commented 9 months ago

Extension or Userscript?

Both

Request or suggest a new feature!

After having looked at the codebase and tried to understand where and how things happen to fix #954, I felt like many contributors could benefit from a refactor.

The main thing for this refactor would be adding TypeScript. The second thing I propose would be a small restructuring of the src/ folder. What I mean here is we could, first of all have types.ts if we need them, but also break up some of the larger files and end up with something like:

└── src
    ├── api.ts
    ├── selectors
    │   ├── desktop.ts
    │   └── mobile.ts
    └── types
        └── index.ts
    ...

This would be alot of work but it would, ideally, make the code more maintainable.

Ways to implement this!

Adding typescript, ts-loader and @types/chrome to dev-dependencies as well as modifying the webpack config.

I have a WIP branch where I have played around with implementing these changes.

Can you work on this?

Will you be available for follow-up questions to help developers implement this?

Yes

UPDATE: I completed adding TypeScript, wasn't too bad. There are certainly things that need work. An obvious example is the typing from the API. Other than that, it could be stricter in places but works as normal.