this post was submitted on 08 Sep 2023
52 points (69.1% liked)
Programming
17313 readers
341 users here now
Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!
Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.
Hope you enjoy the instance!
Rules
Rules
- Follow the programming.dev instance rules
- Keep content related to programming in some way
- If you're posting long videos try to add in some form of tldr for those who don't want to watch videos
Wormhole
Follow the wormhole through a path of communities [email protected]
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
How is that related to TS? Aside from the fact that your comment might have just started a civil war (no, vanilla JS is not "good enough", they created libraries for a reason) this isn't about using libraries / frameworks. It's about needing some system to handle type annotations to avoid falling in the bottomless pit of:
Uncaught TypeError: Cannot read property of undefined
I literally don’t know what TypeScript is, lol. But the video says that Vanilla is an alternative to TS and I am a happy user of it. I thought it was some enterprise language that compiles to JavaScript for people who cannot handle
document.getElementById("")
but will happily add an abstraction layer on the wonky HTML-CSS-JS mess, just to have the compiler create really weird undecipherable minified JS... But I already said I'm inexperienced – don't take advice from a$
hater whose biggest working website is this.then perhaps you should learn about it before you offer your opinion
Then I guess this is what you get for talking about something without knowing what it is lol.
As another user pointed out, TypeScript is a different language (.ts extension) that extends JavaScript, meaning JS code is valid TS code, but TS adds various language features for type checking. Your editor is then able to interpret your code according to these type structures and warn you if you are making any stupid type errors like this one:
The problem many people have with TS (such as the "big projects" mentioned by Fireship) is that sometimes you end up having code that works but still have to do some weird type gymnastics to please the TS compiler and have it remove any errors and warnings.
That being said, frameworks that "create really weird undecipherable minified JS" do have their place, as they allow you to seamlessy do things that would be either very inelegant and verbose or significantly more complex in vanilla JS, but I won't bore you with an excessively long wall of text.
PS: I love your Czech flag website. Had me jump on my chair when the music started blasting through my headphones.
Typescript is basically JavaScript with variable typing. That is, you have to explicitly declare that your variable is a string, int, float, etc.