DEV Community

Discussion on: No, TypeScript is not OOP version of JavaScript

Collapse
 
macsikora profile image
Pragmatic Maciej

Yes they are. But the article is not about what means OOP, or about every element of it in JS, it's about the bit where the misconception came from

Collapse
 
lucaguada profile image
Luca Guadagnini

I think this article is a bit misleading then. There's nothing wrong with saying Typescript is OOP and there's nothing wrong with saying Typescript is FP, what it is really wrong from the quoted statement is:
«TypesScript is an Object oriented programming language whereas JavaScript is a scripting language»
This is not a false statement, this is a misconstrued statement. For starters what's a scripting paradigm? What kind of paradigm is that? OOP is a paradigm, not a language, Java is a language that implements OOP paradigm, C is a language that implements imperative paradigm. But none of them implement pure paradigms, for example it's not possible (or rather feasible) to implement OOP paradigm without imperative paradigm (look at C++) as much as it's not possible to introduce FP without OOP after more than 30 years of OOP programming.

Then the question is: is Javascript OOP? Yes it is implemented with prototyping. So again I think in my humble opinion the statement is wrong about Javascript, not about Typescript.

Thread Thread
 
macsikora profile image
Pragmatic Maciej

The statement is horrible. Both parts are wrong, as it's has vs form. This is OOP and this is not. Scripting is totally different thing than paradigm.

But to be clear it's only example. There are in the community all the time such opinions that TS is only for OOP, like you want OOP you don't use JS but TS. But truth is you want static type system you choose TS, it has nothing to do if you will do OOP or not.

The mainstream of developers sees OOP as classes and interfaces, as both ale in TS from beginning then TS is by many considered more OOP.

Fact is that OOP is not about only classes but about message passing, but I focused on the differences in class based OOP as this is always the main point.

Js is multi-paradigm and TS follows that.