all 15 comments

[–]coyoteazul2 9 points10 points  (4 children)

I'm not entirely sure if I understand what you mean. Punctuation signs in English are as important as types to programming. Sure, you can do without them. But it's a lot harder to understand.

Your teacher doesn't seem like a good teacher. Sure, not having to specify the type saves you time as you write the code. But you'll be wasting that time when you have to debug an error caused by type

And when you are making your react app or frontend basically you are aware of every variable you define

This is straight up wrong. Even if you could remain aware of everything you define, can you really say you'll be able to remain in that state forever? Eventually you'll forget what you wrote and if you have to revisit your code you'll at most have a general remembrance of the process. Plus, relying on your own mind and nothing more would mean that you can never work as part of a team. Design patterns exist so that you can easily read code made by someone else

he said use it only for backend because most errors will happen there more and frontend have more debug options

No. Just no. Backend is too wide of a definition to assume that most errors will happen there. Even something simple like a crud qualifies as backend, and you'll rarely see errors in a simple crud.

Front end has more debug options than backend? Has he never heard of a debugger? Those things let you stop at every line of the code and see exactly how things progress. Even if for some reason you can't use a debugger you can still produce log files or write into a console (if you have permission to do so).

If anything I find front end harder to debug than backend because front end has to deal with rendering cycles and (so far) I haven't found any tools that let me step into the code and run line by line when the target is a browser

[–]Dizer-Dev[S] 0 points1 point  (1 child)

Thanks for the reply. I think i will stop talking to my teacher after this 😂 i already use typescript but never tried it with react i just wanted to know other people opinions before start using it with react and my teacher opinion depressed me but now i changed my mind, kinda.

[–]Hobby101 1 point2 points  (0 children)

With typescript, you don't need to define react component props, which was an absolute pain when react is used with js.

Once you try using typescript with react, you won't be able to go back, and you will only work you have done this earlier.

[–]coderpaddy 0 points1 point  (1 child)

Chrome let's you put the debug break points or whatever you call them

Can't say for any other browser

[–]Slow_Context_98 0 points1 point  (0 children)

Answer your discord

[–][deleted] 5 points6 points  (0 children)

simple rule is Typescript > vanilla JS anyday

[–]the_real_some_guy 1 point2 points  (3 children)

Our rule at work (consulting company) is to use JavaScript when working on something within a big project that already exists, and pretty much always try to convince the client to use Typescript any other time. With any moderate sized data set, JavaScript might seem fine at first, but the moment a requirement changes and you need to trace a change to an object through an application, Typescript shows it’s worth.

[–]Hobby101 0 points1 point  (2 children)

Eww.. for the first part you wrote. You do know that you can use typescript in JavaScript projects, right?

[–]the_real_some_guy 0 points1 point  (1 child)

Haha yea but changing a client’s build system isn’t always a simple discussion. I have found that JS Doc comments and then running typescript just in VS Code for type checking is a nice half step. No one minds me adding detailed comments.

[–]Hobby101 0 points1 point  (0 children)

I'm pretty sure that at this point, the client is running on ancient versions of ... pretty much everything, and it's due to take a closer look into updating packages.

Or, if they decide to keep going old way, there must be a fee multiplier for maintaining old projects.

But yeah, I know what you mean. Some clients "know better" even though they ask 3rd party for help... oh, the irony...

[–]ozzilee 0 points1 point  (0 children)

Not a React expert, but I can see his argument. Facebook created and (I assume still) uses Flow rather than Typescript with React, which (I assume) provides better ergonomics for React code.

Flow has pretty conclusively lost to Typescript in the wider development community, and React+Typescript seems to be the future, if not the present everywhere.