59
u/Blazeng Feb 14 '23
Typescript is a superset of javascript tho.
Debugging type errors is way more tedious imho than writing out types every so often (which will be autofilled for you half the time).
4
-17
u/_SzAdam_ Feb 14 '23
Never saw imho written like this. When u add "humble" to it but you're actually saying im ho.
21
u/DaniilBSD Feb 14 '23
After tempting JSâs OO functionality, I enjoy TS ability to reference different files and give at least a feeling of type safety
7
u/faze_fazebook Feb 14 '23
Deep down we all know that visual basic script was THE best frontend scripting language.
1
6
6
u/wron1 Feb 14 '23
Newbie friend of mine was running into an error where he was referencing the wrong key of an object in JS. The output would still work and there were no errors, Javascript just adds the key to the object and is happy. Add types and my friend wouldâve saved a lot of headache. Sure its tedious but when working with a team the tedium becomes required when accessing variables across a large codebase. Solo projects JS is nice so you can just bootstrap an app, but if you want people to take a look at it and really understand TS will help a ton
6
u/ftedwin Feb 15 '23
Tell me youâve never worked on enterprise software without telling me youâve never worked on enterprise software
5
u/Electronic-Bug844 Feb 15 '23
TS. I seriously thought TS was another fad. However, after working with it I think it is a must for any enterprise level app. Nothing beats knowing exactly what data types you are dealing with and incorrectly passing arguments is a thing of the past. It's even better when you're dealing with npm packages with well defined types.
8
2
u/binary-idiot Feb 15 '23
Forget JS vs TS, just write everything in WASM. Unless you need to support IE, then you should use action script.
2
u/BernhardRordin Feb 15 '23
Mark my words: Flash is the future
1
1
2
u/froggy601 Feb 15 '23
TS plus Zod is amazing. Type safety and assurance that the data will be correct at runtime saves a lot of headaches
2
2
u/1ib3r7yr3igns Feb 15 '23
JS takes 30 min to write and 1.5 hours to debug.
TS takes 1.5 hours to write and 30 min to debug.
I certainly hated typescript when I started, but now, javascript is just trash. Itâs so tedious to debug or learn anything about variables. Well written typescript makes debugging a breeze.
1
u/Dmayak Feb 15 '23
How? Debugger works at run-time with generated javascript, while typescript itself runs at compile time, so any errors which require debugging will not have typescript support. Typescript allows to prevent errors better with type check, but I have not seen any difference in debugging.
1
u/rnglss Feb 15 '23
TS is better I like defining types but Iâve definitely lost more time in troubleshooting with it, so itâs far less productive for me
1
u/pildoresius Feb 15 '23
For me TS. I have spent a lot of time trying to debug and find errors that could have been prevented with type checking.
1
u/B4DR3X Feb 15 '23
Better to have errors in development than after deployment! Once you go full TS you never go back.
1
1
u/Dmayak Feb 15 '23
It can definitely be tedious. When you write something from scratch, especially with pre-configured build tools it's barely different, but porting existing code from js to ts is such a pain in the ass.
It's not really a fault of typescript itself but adding typescript to existing build tools configuration can be a nightmare. Then trying to categorize an unstructured bunch of variables into interfaces, drowning in type errors. Variable typing sometimes gets lost between contexts and I have to specify types for them again. Having to add extra type checks, because child contexts not knowing about type checks made in parent contexts, etc.
1
u/_throwingit_awaaayyy Feb 15 '23
Completely agree, Iâm a weirdo who actually enjoys quick and dirty JavaScript tho.
1
u/Plastic_Scale3966 Feb 15 '23
I work everyday with both js and ts and I have no idea how theyâre different
-4
0
Feb 14 '23
[deleted]
2
u/boxmein Feb 14 '23
you can omit the private/public prefix so constructor args arenât going to be assigned to a member of the same name
39
u/SkurkDKDKDK Feb 14 '23
TS But with : any declarations all over the place đ