JavaScript developer, technology passionate, Ubuntu evangelist, ex mountain guide, active football player, inactive surfer, professional backpacker and hitchhiker.
JavaScript developer, technology passionate, Ubuntu evangelist, ex mountain guide, active football player, inactive surfer, professional backpacker and hitchhiker.
I have to admit that reading your code brought me some kind of satisfaction.
Let's agree (or not) that being my first time trying TS I was not that bad, I guess. 😅
Also in my defense I didn't invest too much time in other parts of the code but sir, let's be honest here, your version rocks!
By the way, may I ask you one question?
I have noticed the way you created the cancellation token and I would like to know it the approach below is also right because I have been using it since always. I mean, regarding good practices.
I never meant it as a challenge. I know that using TS is hard and wanted to show alternative approach.
Regarding cancel question: theoretically provided code can go wrong because of asynchronous functions, but probably in practice you will never see problems. In your code TS will complain about cancel being used before assignment (probably)
JavaScript developer, technology passionate, Ubuntu evangelist, ex mountain guide, active football player, inactive surfer, professional backpacker and hitchhiker.
Please, don't get me wrong. It was not a challenge at all.
I really just wanted to report my first experience with TS but I think it is important to highlight the alternative you provided, for people like me who are giving the first steps with the language. For example, I'll surely use it as a reference and probably other people too.
Thanks for the explanation about the cancelling token. Until now I have had no problems but considering changing the way I use it. :)
I have learned a lot from the example you provided! Thanks for that.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I like the title and the cover image.
TypeScript can do type inference, so you don't need to provide types everywhere.
This will work the same:
Also I would not use separate file for interface, just place it in the top of the component (it will make your life a bit easier)
Thanks a lot for your comment and insights. :)
I will definitively adopt your approach and also refactor the code following your suggestions.
What could I say? You definitively nailed it! 👏
I have to admit that reading your code brought me some kind of satisfaction.
Let's agree (or not) that being my first time trying TS I was not that bad, I guess. 😅
Also in my defense I didn't invest too much time in other parts of the code but sir, let's be honest here, your version rocks!
By the way, may I ask you one question?
I have noticed the way you created the cancellation token and I would like to know it the approach below is also right because I have been using it since always. I mean, regarding good practices.
Thanks again for participating, I really appreciate it! 🙏
I never meant it as a challenge. I know that using TS is hard and wanted to show alternative approach.
Regarding cancel question: theoretically provided code can go wrong because of asynchronous functions, but probably in practice you will never see problems. In your code TS will complain about
cancel
being used before assignment (probably)Please, don't get me wrong. It was not a challenge at all.
I really just wanted to report my first experience with TS but I think it is important to highlight the alternative you provided, for people like me who are giving the first steps with the language. For example, I'll surely use it as a reference and probably other people too.
Thanks for the explanation about the cancelling token. Until now I have had no problems but considering changing the way I use it. :)
I have learned a lot from the example you provided! Thanks for that.