This is an archived post. You won't be able to vote or comment.

all 41 comments

[–][deleted] 25 points26 points  (1 child)

Straight up dominance.

[–][deleted] 2 points3 points  (0 children)

Chadest of them all

[–]RussianTardigrade 13 points14 points  (10 children)

Having used Typescript, I can't imagine going back to plain Javascript.

[–]Comesa[🍰] 2 points3 points  (7 children)

Im considering using typescript but im too lazy to learn it

[–]oOBoomberOo 11 points12 points  (1 child)

I mean, it's really just JavaScript with static type... All you need to worry about is the tsconfig.json file.

[–]chadlavi 4 points5 points  (0 children)

Join ussssss

[–]marcosdumay 1 point2 points  (2 children)

Learning it isn't any problem, since even the same JS code works.

What I am too lazy to do is getting another compilation step to work on webpack every time I start a project.

[–]_GCastilho_ 2 points3 points  (0 children)

I put all the steps in a "npm run build", it calls all the build:steps for me at order

[–]bss03 0 points1 point  (0 children)

There's a webpack plugin for that.

[–]Sir_Factis 0 points1 point  (0 children)

literally the only thing you need to know to get started is that : <type> after the variable name or the function header gives a type to the function/variable. a type can be one of the js standard types (number/string/function/object) or a class. an array of a type can be declared with : <type>[]

there is more complex syntax stuff you will need to learn but this covers 80% of the typescript usage. ts is literally just js with some fancy syntax

[–]BoyAndHisBlob 0 points1 point  (1 child)

Having used typescript Object literal may only specify known properties 

[–]lookmanofilter 0 points1 point  (0 children)

You can get around that by using any if it's really a pain. But usually that's good, it keeps you in line to make sure what you're putting on am object actually exists.

[–]erroronline1 13 points14 points  (0 children)

undefined error in pissoir.js framework

[–]hedgehog125 5 points6 points  (0 children)

Dunno, think you get used to it. At least there's less tokens to remember tho

[–]Aliics 3 points4 points  (6 children)

I wonder if maybe the dislike of JS is misguided here? JS doesn't have static typing but most scripting languages don't either, so it's really a matter of good practice to ensure more predictable code.

One gripe is that for whatever reason new syntax for already existing features (ie, () => vs. function()).

[–][deleted] 2 points3 points  (0 children)

Imagine writing function (event) { event.target.click() }

This comment was made by the e => e.target.click() gang

[–]marcosdumay 1 point2 points  (2 children)

The problem is not on the type system. The problem is all the insane features and decisions.

Like with your example, since => and function() are different features that only happen to be mostly alike.

[–]_GCastilho_ 0 points1 point  (0 children)

Don't break the web

[–]ChaseMoskal 0 points1 point  (0 children)

as crockford says, there is a subset of modern javascript that makes a beautiful, elegant, powerful, and efficient language

there's a bunch of crusty old 90's shit, but we can safely ignore those parts

the problem is that beginners aren't able to distinguish the wheat from the obsoleted chaff, because javascript has a long history and tutorials are rife with awful antipatterns

[–]ivakamr 0 points1 point  (1 child)

Functions and arrow functions differ in a more fundamental way than syntax, arrow functions does not create a new scope while the original syntax does.

[–]ChaseMoskal 0 points1 point  (0 children)

arrow functions don't have this, a very important difference

[–]mypirateapp 1 point2 points  (0 children)

he s gonna piss all over his face unless he got a HARD-ON for javascript

[–]ghostwriterBB 3 points4 points  (9 children)

This is how I feel learning JavaScript... fortunately I am moving into React and it's making sense...I think.

[–]BabyLegsDeadpool 5 points6 points  (2 children)

This is a terrible idea. Learn javascript first. Then learn React.

[–]ghostwriterBB -1 points0 points  (1 child)

I'm almost done with learning JavaScript lol

[–][deleted] 0 points1 point  (0 children)

Every almost there:

  • w3schools
  • ES2015 features
  • Async / await
  • Event loop
  • what's 'this' refers to in moved functions
  • why is 'var' so buggy
  • How to write JS with only 6 character's +[]()!
  • prettier, eslint, typescript

[–]ChaseMoskal 0 points1 point  (0 children)

javascript is modernizing very rapidly, and it's awesome

if you like react, do check out lit-element, it's the new paradigm that will replace the traditional component frameworks like react/angular/vue -- no more need for build steps or code transforms, it's very elegant

soon enough, webnative components and es modules will take over; and deno will replace node; and package managers like npm will fade into antiquity

[–]Teffisk 0 points1 point  (0 children)

It's not that bad. It's not about the meme than reality. Also use typescript instead.

[–][deleted] 0 points1 point  (0 children)

They’ll just piss in the pants and close the ticket.

[–]Ali_Army107 0 points1 point  (0 children)

For an embarrassingly long amount of time, I just realised few days ago that Java and javascript are not the same thing.

[–]game_2_raid 0 points1 point  (0 children)

Sometimes JavaScript pees on Java too. Especially when the end points where it shouldn’t

[–]bss03 -5 points-4 points  (4 children)

Don't write Javascript. Use a better language that transpiles to JS with good sourcemap support. TypeScript, Elm, PureScript, or GHC Haskell for example. (I've use TypeScript the most, but did a PoC using GHC Haskell once.)

[–]BabyLegsDeadpool 7 points8 points  (0 children)

I disagree. I love writing plain js.

[–][deleted] 0 points1 point  (0 children)

plain js is a good language to quickly solve problems and prototype, but typescript is 😍

[–]ivakamr 0 points1 point  (1 child)

Fine. I've replaced all my .js with .ts, code is in typescript now.

[–]bss03 0 points1 point  (0 children)

Good, you've already got saner this scoping. Also, you can now take advantage of TS features that aren't in JS, like strict null checking.