Skip to content

Instantly share code, notes, and snippets.

@vielhuber
Created February 7, 2019 22:28
Show Gist options
  • Select an option

  • Save vielhuber/b3c3ecaa57f79e1d4cc5e22a869b9386 to your computer and use it in GitHub Desktop.

Select an option

Save vielhuber/b3c3ecaa57f79e1d4cc5e22a869b9386 to your computer and use it in GitHub Desktop.
typescript #js

TypeScript

intro

  • JavaScript: Duck typing (“When I see a bird that walks like a duck and swims like a duck and quacks like a duck, I call that bird a duck.”)
  • static type checking: check before compiling (String s = new String())
  • dynamic type checking: check at runtime (s = "foo")
  • strong type checking: "Zahl"+str(3)
  • weak type checking: "Zahl"+3
  • JavaScript chooses worst of both worlds: dynamic and weak

reasons for typescript

  • type checking
  • get new javascript features for free

tipps

  • js code is ts code
  • typescript is not a library or api
  • always enable strict mode
  • use "public" etc. in classes
  • use interfaces for objects
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment