DEV Community ๐Ÿ‘ฉโ€๐Ÿ’ป๐Ÿ‘จโ€๐Ÿ’ป

DEV Community ๐Ÿ‘ฉโ€๐Ÿ’ป๐Ÿ‘จโ€๐Ÿ’ป is a community of 963,503 amazing developers

We're a place where coders share, stay up-to-date and grow their careers.

Create account Log in
Cover image for Why Should We Use TypeScript
Shamaz saeed
Shamaz saeed

Posted on

Why Should We Use TypeScript

  • Typescript makes code easier to read and understand
  • Typescript has ability to add static types to Javascript code
  • Typescript is open source
  • Typescript simplifies Javascript code
  • Typescript is Javascript with additinal features
  • Typescript support ES5 and ES6
  • Typescript do Compile-Time checking
  • Typescript helper classes are available to reduces code
  • Typescript code is more readable as compared to Javascript
  • Typescript provide compiler that convert Javascript code to TS
  • Typescript reduces bugs like null handling,undefined etc
  • This is my first post on dev. Follow me for more content.

    Top comments (15)

    Collapse
     
    jwp profile image
    John Peters

    Many Javascript people hate Typescript. Yet is is so similar to C# that solutions using Asp.Net Core for Backend essentially have an isomorphic development environment.

    Yes, Typescript is an excellent tool especially for Intellisense. This gives instant API discoverability. It's everything Javascript plus a lot more.

    Collapse
     
    sanderdebr profile image
    sanderdebr

    How is TypeScript code more readable than plain JS? I think it makes your code more bloated and puts less focus on the actual logic, more on just type checking. However I've not done so much in TypeScrip yet!

    Collapse
     
    hakimio profile image
    Tomas Rimkus • Edited on

    It helps you structure your code better by giving you better tools. OOP, SOLID, many language features vanilla JS is missing like decorators, optional chaining, nullish coalescing and many other features. IntelliSense/auto-completion makes you more productive and helps you avoid typos.

    Collapse
     
    jonrandy profile image
    Jon Randy

    Optional chaining and nullish coalescing are built into JS

    Thread Thread
     
    hakimio profile image
    Tomas Rimkus

    ...but not supported by all browsers.

    Thread Thread
     
    patarapolw profile image
    Pacharapol Withayasakpunt
    Collapse
     
    patarapolw profile image
    Pacharapol Withayasakpunt • Edited on

    TypeScript is both helpful and fake.

    It doesn't provide run type checking. And sometimes typings are wrong!

    Most famously, Array[n+1] and Record<string, any>['non-key'].

    Collapse
     
    athomsfere profile image
    Austin French

    Yes, I prefer Typescript, by thousands of times. But, I have also seen weird bug produced a couple times because TS can't really predict everything someone might do with objects.

    Collapse
     
    shamaz332 profile image
    Shamaz saeed Author

    Not agree with this

    Collapse
     
    jonrandy profile image
    Jon Randy

    TypeScript is a crutch for developers who can't stomach dynamically typed languages and the advantages they bring

    Collapse
     
    hakimio profile image
    Tomas Rimkus

    More like disadvantages and security issues they bring.

    Collapse
     
    shamaz332 profile image
    Shamaz saeed Author

    hahaha yes, you're right.

    Collapse
     
    rishitkhandelwal profile image
    Rishit Khandelwal

    We can compile code from X syntax to Y syntax or readable to unreadable code

    Collapse
     
    shamaz332 profile image
    Shamaz saeed Author

    hahahhah

    Collapse
     
    im6h profile image
    Vu

    Typescript is OOP
    Typescript is FP

    justforfun

    This post blew up on DEV in 2020:

    js visualized

    ๐Ÿš€โš™๏ธ JavaScript Visualized: the JavaScript Engine

    As JavaScript devs, we usually don't have to deal with compilers ourselves. However, it's definitely good to know the basics of the JavaScript engine and see how it handles our human-friendly JS code, and turns it into something machines understand! ๐Ÿฅณ

    Happy coding!