DEV Community

Discussion on: Typescript vs Javascript : Which one should you use for your next project ?

Collapse
martinmuzatko profile image
Martin Muzatko • Edited on

"No support for compiling additional ES3, ES4, ES5 or ES6 features"

This is plain wrong.
You can use the complete ES3,4,5,6 feature set today in the browser or in nodejs without needing to compile. NodeJS supports .mjs files with package.json property "type" set to "module" which support ES6 modules and in HTML you can mark es6 modules as <script type="module">

Since it is a superset, all the JavaScript libraries, and other JavaScript code works without any changes

Work as in it executes. Not work as in it comes with types for the safity we want. If you are lucky enough, there will be a @types package.

Numbers, Strings are considered as interfaces.

Actually, using Number and String as type is frowned upon. The correct way is the lowercase counterpart number and string (and boolean).
Numbers and Strings exist the same way in TS as in JS. Number.IsFinite exists in both TS and JS, otherwise it wouldn't be JS compatible.

Neat and clean, most suitable for simple web applications

You can abuse any language or framework to do what it should not. Like people create elaborate systems with PHP.
More code has more room for failure, but usually you want safety from the start, not only when the project has grown to 50k loc. (trust me, I know how migrating a large project is like)

No support for modules, generics or interface

Only partially correct.
Modules are supported with .mjs or type=module in the browser.
Interfaces can be written with JSDoc, but they are not as terse and helpful as TS interfaces. Although you can mix TS in jsdoc.

Prototyping support is not there

What does that mean?
The concept of object prototype exists in JS and TS. Otherwise they wouldn't be compatibly.

The community support is still growing and not so huge

All major packages (over 6000 projects have dts files, and many are native TS projects) have type definitions by now. I think adaption is going pretty well

That was a lot of facts to get straight. If you found any errors or have questions, let me know.

Collapse
rsgilbert profile image
Gilbert

I dont understand whose side your on here. Are you rooting for TypeScript or JavaScript?

Collapse
martinmuzatko profile image
Martin Muzatko

I just attempted to correct statements for both JS and TS. No need to be on any side to make objective statements.