re: Is 2019 the year of TypeScript? VIEW POST

FULL DISCUSSION
 

I really hope not..

Typescript, has its usecases, but without native support it is almost pointless to me.
Too much setup.

The easier debugging is nice however.

My main gripe is problably that it tends to promote large corp style OOP with bajillions of pointless interfaces and classes.

Which in my experience leads to state soup and lack of code-mutability.

 

For sure it can promote large corp style OOP. Perhaps, and I have no data for this, just my musings, is that Angular promoted this once they adopted TypeScript. DI, classes, decorators etc...

I've been using TypeScript in React and browser extensions and almost never use OOP. The only time I've really used classes in React was for components that required state. Aside from that rarely, and now that hooks are stable and able, function components would be the way to go for new work.

Having said that, OOP is not a bad thing. Just like anything, people can do bad things 😉

 

I am mostly against OOP, for a number of reasons that would longwinded and off topic. :)

I my world, the TS gains do not outweigh the layers of complexity added to all parts of the developing process from developer skills to the libraries and build systems we use today.

It is unnecessary for most things, so why bother with it?

I don't think Typescript does anything more OOP than JavaScript (ES2015+) does, besides Interfaces (which also appear in functional languages).

Typescript supports all the same functional concepts that JavaScript does, including being able to type higher-order functions. It also includes other functional concepts that aren't in JavaScript, like union types, or even better, discriminated unions.

I am talking about complexity, and the way I see the language generally used in practice.

TS has more features, that is the entire point of the language.

Exampletime,
Just yesterday I was debugging a TS npm library, all I wanted was add to poke the source with a few console logs.

But because it was a TS library it came in 5 different ES versions, had a slew of typings I had to see through, and the actual source was not included because npm is for JS.

This would have forced me to get the source code, hook it up to my npm dependencies and then build it with my few debug changes.

Is there a better way to debug, problably yes, I could have explored the map in the browser and addd breakpoints, or use some other tool.

Had this been a JS library I would have spend a few minutes looking over the source.

Now, imagine a junior wanting to do this.

Complexity comes at cost, it is the entire point of functional programming, but centered around the problem of state management.

Toting TS as a good tool for functional programming is like saying eating children is a good way to prevent hunger.

It overlooks the actual problem.

Yeah, that all makes sense. It's definitely a different workflow.

I'm used to other languages that don't ship source code in packages, so this is nothing new to me.

Npm package authors could include source if they wanted - so the lack of it seems more like a personal choice on the part of the author.

Also, the issues you noted about all the transpiled variations of JavaScript for that Typescript authored lib ... those appear with JavaScript libraries too!

If a js lib author uses Babel to support older versions of Node or browsers, they will include transpiled versions of their js code.

This seems to be more an issue of the JavaScript tooling ecosystem still needing to mature.

In .NET/C# I can make a package that has compiled code only, but includes a hash to a git commit. When I'm debugging, my IDE pulls the repo code down to my machine and lets me debug into it live. It's a great developer experience.

I think the JavaScript community will come up with similar creative solutions.

Lack of tools is not really the problem, quite the opposite the way I see it.

Tools should make us more productive, not be a nessesary thing to be productive at all.

The fact that we are even talking about solving the problem with more IDE tools suggests a flaw in the system.

We need something that will reduce complexity at this point. Otherwise the frontend community will end up fragmenting into completely unessesary domains of knowledge based on frameworks and what kind of transpilation we do.

More so than it already has.

Came across this today. I rarely use classes myself, but I thought this was pertinent to the convo.

 

I tend to agree. I have to use it at work and I understand the arguments in favour; but to me it still feels like a ball-and-chain compared to vanilla JS. I do understand some of the benefits; but there are also some downsides:

  • junior devs coming from type-safe languages can get a false sense of security: e.g. not doing proper type-checking on data coming from a back-end
  • assuming that private really means private
  • not getting a proper understanding of JS. ((synctatic) sugar is bad for you)

But yes - mainly my problem is that it can encourage a classic OOP approach to coding when IMO one of the big strengths of JS is that it facilitates some really effective functional approaches.

code of conduct - report abuse