gergelyszabo94 / csgo-trader-extension

CSGO Trader Browser Extension to help with CS:GO item trading, marketing and much more
https://csgotrader.app
GNU General Public License v3.0
213 stars 42 forks source link

[FEATURE REQUEST] typescript #394

Closed hexiro closed 3 years ago

hexiro commented 3 years ago

Would it be possible to start migrating to typescript? (i have no idea how this would work with building an extension, but I imagine it's very doable)

This would make it:

Migrating to ts can start off slow, but start to be more strict with types as time goes on.

if you're unfamiliar with typescript, read more here.

gergelyszabo94 commented 3 years ago

I have never worked with typescript so I don't know how this should be approached but the idea is good.

hexiro commented 3 years ago

Ill do some research about typescript for extensions and see how it works. coding in javascript vs typescript isn't very different, you just have to be a little more type safe.

"TypeScript is a strongly typed programming language which builds on JavaScript giving you better tooling at any scale." - https://www.typescriptlang.org

Looskie commented 3 years ago

I have never worked with typescript so I don't know how this should be approached but the idea is good.

maybe i could help 👀

hexiro commented 3 years ago

if possible, whenever you're back from vacation, can you provide me with some types? Would make my life easier as apposed to trying to dig around in the extension.

hexiro commented 3 years ago

I've actually been able to fetch data with chrome.storage.local.get outside of the extension which I didn't know I could do. I should be good for now, but I'll let you know if I have any major hiccups.

hexiro commented 3 years ago

I believe I just finished the entire components section, but I still have much more to do. I haven't really made any logic changes, but I was planning on contributing after this and replacing most of these callbacks with async / await based code. So if you're alright with that I could either do it inside of this pr, or make a separate one after the typescript stuff.

gergelyszabo94 commented 3 years ago

That is great, I think the async/await refactor should be a separate PR.

hexiro commented 3 years ago

will do. I am planning on using axios, but we can talk more when the time comes.

hexiro commented 3 years ago

taking a break for now. some of these types need to be fixed up before fitting into typescript, and at that point I might as well just work on async / await. If I do start async/await changes I'll try and keep it as close to the original as possible, with more robust code, and I'll properly test it.

gergelyszabo94 commented 3 years ago

How much extra work do I create for you if I make changes on master? I am planning fixing a couple of bugs and adding small features then make a realease.

hexiro commented 3 years ago

not too much work, but since the file extensions are changed from .js to .ts I just need to re-implement your changes in the typescript file. don't worry about me though, I'll just reimplement your changes before I finish the pull request.

hexiro commented 3 years ago

closing for now. will reopen if i start to work on this again.