Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Moving from JavaScript to Typescript

Moving from JavaScript to Typescript

Building scalable and maintainable software requires good coding principles and tools that make that possible, TypeScript is that kind of language that can help us achieve that.

Olumide Ogundele

February 15, 2020
Tweet

More Decks by Olumide Ogundele

Other Decks in Programming

Transcript

  1. Created by Brendan Eich in 10 days!, you can imagine

    what that means - some bugs and quirks were not properly handled and there is nothing we can do about them today just to live with them.
  2. What is TypeScript ? JavaScript that scales. TypeScript is a

    typed superset of JavaScript that compiles (I call it transpile sometimes) to plain JavaScript. It adds extra features for us like interfaces, enums, decorators etc.. Read more here
  3. Why Should you move from writing JavaScript to TypeScript ?

    Due to the gotchas we get when writing JavaScript, Check out the JSF*ck website to know more about this.
  4. Why Should you move from writing JavaScript to TypeScript ?

    Due to the gotchas we get when writing JavaScript, Check out the JSF*ck website to know more about this. Typescript helps to avoid these gotchas and enhance JavaScript Software Engineers.
  5. Why Should you move from writing JavaScript to TypeScript ?

    Due to the gotchas we get when writing JavaScript, Check out the JSF*ck website to know more about this. Typescript helps to avoid these gotchas and enhance JavaScript Software Engineers. The TypeScript programming language (http:/ / www. typescriptlang. org) was created by Microsoft and was later open sourced under the Apache 2.0 license. The source code of the language is available on GitHub over at https:/ / github. com/ Microsoft/ TypeScript.
  6. • Type Inference, which gives some of the benefits of

    types, without actually using them • Access to ES6 and ES7 features, before they become supported by major browsers
  7. • Type Inference, which gives some of the benefits of

    types, without actually using them • Access to ES6 and ES7 features, before they become supported by major browsers • The ability to compile down to a version of JavaScript that runs on all browsers
  8. • Type Inference, which gives some of the benefits of

    types, without actually using them • Access to ES6 and ES7 features, before they become supported by major browsers • The ability to compile down to a version of JavaScript that runs on all browsers • Great tooling support with IntelliSense
  9. • Type Inference, which gives some of the benefits of

    types, without actually using them • Access to ES6 and ES7 features, before they become supported by major browsers • The ability to compile down to a version of JavaScript that runs on all browsers • Great tooling support with IntelliSense • Optional static typing (the key here is optional)
  10. TypeScript does not aim to replace JavaScript; instead, it aims

    to improve the lives of developers by providing a more powerful language that generates clean and simple JavaScript code. In a way, you could consider TypeScript as a code quality checker for JavaScript on steroids.
  11. TypeScript does not aim to replace JavaScript; instead, it aims

    to improve the lives of developers by providing a more powerful language that generates clean and simple JavaScript code. In a way, you could consider TypeScript as a code quality checker for JavaScript on steroids. TypeScript definitely will help you discover bugs earlier and it will help you to better organize and structure your code, whether you're working on a small application or a large project.
  12. There is no new definition to be made but I

    will reference a good response I found on stackoverflow https://stackoverflow.com/questions/1517582/what-is-the-difference-betwe en-statically-typed-and-dynamically-typed-languages
  13. A language is statically typed if the type of a

    variable is known at compile time. For some languages this means that you as the programmer must specify what type each variable is (e.g.: Java, C, C++); other languages offer some form of type inference, the capability of the type system to deduce the type of a variable (e.g.: OCaml, Haskell, Scala, Kotlin) The main advantage here is that all kinds of checking can be done by the compiler, and therefore a lot of trivial bugs are caught at a very early stage. Examples: C, C++, Java, Rust, Go, Scala
  14. A language is statically typed if the type of a

    variable is known at compile time. For some languages this means that you as the programmer must specify what type each variable is (e.g.: Java, C, C++); other languages offer some form of type inference, the capability of the type system to deduce the type of a variable (e.g.: OCaml, Haskell, Scala, Kotlin) The main advantage here is that all kinds of checking can be done by the compiler, and therefore a lot of trivial bugs are caught at a very early stage. Examples: C, C++, Java, Rust, Go, Scala A language is dynamically typed if the type is associated with run-time values, and not named variables/fields/etc. This means that you as a programmer can write a little quicker because you do not have to specify types every time (unless using a statically-typed language with type inference). Examples: Perl, Ruby, Python, PHP, JavaScript
  15. I write codes in JavaScript, Typescript, Python, Go and some

    little bit of Rust so if I am to add to all these, I love Statically Typed language because, when I write tests, I don’t worry to much about validating the data type passed to a function or anywhere data is expected because the compiler will do all that for me. I enjoy both worlds but enjoy statically typed world more.