5

Someone explain typescript to me , I still don't get why we need it?

Comments
  • 6
    Basically, it fulfills the role of a linter like eslint but with more thorough checking.
    It checks your static typing across the code before the code running.

    Unit testing is better to catch errors.

    But checking static typing can be important too at least at big code base for additional testing coverage percent.
  • 6
    Looking at TypeScript as independent language is another problem. Don't get it wrong - TypeScript wasn't intended (because it cannot) fix runtime issues of JavaScript itself.

    It's an ecosystem. I can't imagine serious big ass libraries today without TypeScript typings. Community can create typings separately from the main package and enjoy the type safety.

    TypeScript doesn't hold you back, when you place operators that you supposedly know what to do with them, and neither does it hold you by hand and tell you what conventions should be followed in the project. But we need it to make JavaScript a little bit sane. Let JS in the wild, and it will definitely shoot you in the leg.
  • 0
    @darkwind honest question, do you know of any linters that will tell you wether or not the parameters you're passing into a function have the type expected by the function?
  • 3
    Use TypeScript when @jsdoc is not enough for type hints, auto complete suggestions and warnings in the IDE.
  • 1
    @black-kite I am more of a python ecosystem
    Quite fresh to js, but regardless if to Google
    "JavaScript static type checker"
    It yields Flow instrument, besides recommendation to use typescript

    https://ageek.dev/static-type-check...
    Perhaps to try Flow, especially if u a using react. Flow is Facebookish invention
  • 2
    typescript looks after some of javascript's shortcomings. one that i remember is the variable scope issue
  • 2
    It tries to make a static representation of JavaScript and does it well.

    I can not count how many times TypeScript has saved me when doing refactoring work.
  • 6
    we need TypeScript because JavaScript's (non-existent) handling and enforcement of types is horrible, just like most of JavaScript is.

    we shouldn't use TypeScript, because it disables basically the only upside of JavaScript.

    yes, i know what i just said.
Add Comment