koolamusic / ts_labs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Intro to TS

Mosh TS | TS Version 2.3.4 | Youtube Video Link

what is typescript

Typescript is a superset of javascript, therefore any valid js code is also valid ts code

Benefits
  • typescript uses Strong Typing (using this feature is optional)
  • OOP Features (classes, interfaces, access modifiers || public, private)
  • Typescript allows you to catch errors at compile time and not runtime.
  • Great tooling/plugin support for typescript
  • Typescript needs to be transpiled into Javascript to run on the browser
  • You can write the same js code in TS, at least it will always give you warning at compile time.

Traversy Media | TS

  • Typescript provides static type checking (numbers, strings, boolean, etc)

  • TS allows to leverage on the capability of Class Based Objects, which exists in languages like PHP, C# etc. -TS is a SuperSet of Javascript as Objective C is a superset of C

  • TS gives us the power of modules and ES6 Features too

  • TS uses a syntax closer to Java, Scala and other high level languages

  • TS types are String, Number, Boolean, Array, Any, Void, Null, Tuple, Enum, Generics

    • Any : can be any kind of type
    • Void : No type returned
    • Null : or undefined
    • Tuple : An array with a fixed number of elements
    • Enum : Enumerated values
    • Generics : Type of Constrain
  • TS allows to use Classes in an OOP way without the Prototype based objects model in Javascript.

About


Languages

Language:TypeScript 46.4%Language:JavaScript 41.9%Language:HTML 7.0%Language:CSS 4.7%