About Me

  • Senior Web Developer at 8 Securities
  • Working with Ionic2/Angular2
  • Using typescript since 0.8 (Feb 2013 ☺)

@valter_s_matos

linkedin.com/in/valtermatos

github.com/ValterSantosMatos

Part 1/3

Why?

Do you know what "WAT" means?

WAT is [] + []

WAT is [] + {}

WAT is {} + []

WAT is "string" - 1

""
"[object Object]"
0
NaN

https://www.destroyallsoftware.com/talks/wat

Javascript books

javascript the good parts

vs

javascript the definitive guide

Why Typescript?

  • can make the code easier to maintain
  • can make code more readable
  • can allow for reliable refactoring
  • can allow for generally better IDE support
  • can catch errors early

Part 2/3

What is Typecript

  • Superset of javascript
  • Transpiles to plain javascript
  • Let us use features from ES7 and ES6 today
  • Created in 2012 by Microsoft
  • Current version: 1.8
  • Open source

Typescript is...

Types

  • boolean
  • number
  • string
  • array
  • tuple
  • enum
  • any
  • void

Classes

Inheritance

Generics

Unions and Type Guards 

Interfaces

Modules

Namespaces

Decorators

more...

Declaration files

To get the type information of an external JavaScript library we can use a type declaration file (.d.ts).

Part 3/3

Epilogue

Comparison - my opinion!

  • ​Typescript vs. CoffeeScript

    • Not experienced in CoffeeScript but the trend in the next chart is clear!
  • ​Typescript vs. ES6

    • Typescript is ES6 plus a type-checker. Both need a transpiler (generally Babel in case of ES6).
  • TypeScript vs. Dart / Elm / PureScript

    • Typescript is Javascript while the others aren't.
  • TypeScript vs. Flow (type checker by facebook)

    • Not enough experience with flow, although the ecosystem of typescript is way bigger.

Comparison - google trends

Should I use a Typescript?

Initial effort to add typescript is low, but it will require some time to learn typescript.

 

  • No if your project is really simple
  • No if your project will have a short life

 

  • Yes if there is a chance you will have to refactor it
  • Yes if its very important for your company
  • Yes if people enter or leave the team frequently
  • Yes if you will use Angular2

THANK YOU!

Questions

 

@valter_s_matos

Made with Slides.com