Mosh TS | TS Version 2.3.4 | Youtube Video Link
Typescript is a superset of javascript, therefore any valid js code is also valid ts code
- 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.
-
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 ofC
-
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.