6
gitpush
6y

I'm still learning so take it easy on me, I'm trying to learn typescript and Factory pattern, hope I did it correctly this time :)

Link: https://pastebin.com/99AL3qah

Its only one class in hope I got it right so I can continue with the others

Comments
  • 2
    You write beautifully!
    All ready for the industry
  • 1
    In my opinion, this:
    return data.map((item) => {
    should be this instead:
    return data.map(item => {

    Makes it more readable for me at least. Other than that, it's looking great.
  • 1
    Does "this" in typescript static method references to the Class itself?
    Otherwise, swap it with the actual class
  • 0
    @growling not sure if being sarcastic or actually mean lol
  • 0
    @olback note taken thanks man
  • 0
    @perotti it reference the class and vs code added it when I chose the method.

    However; I changed it to regular class instead of static methods, is it ok if I ping you when I'm done fixing it?
  • 1
    Code looks perfect however you might need to add comment tags to tell if it's a function/constructor/generator etc. Also use return tags to tell the reader of its type and description. This should help you - http://usejsdoc.org
  • 1
    Not to mention that the comment above might not be needed for a simple example like this one but would definitely help in a large code base with multiple authors :)
  • 1
    @varundey all feedbacks are appreciated, I will read the link you gave. And I don't really care if the code was for my project or a large project, my goal is to train my self to do it the right way
Add Comment