I am new to angular 2 and studying Typescript in order to build simple apps in angular 2.
And I found that we can use classes, interfaces, modules etc with typescript to build applications.
But as far as I studied javascript I know that javascript doesn't support classes, interfaces, modules etc.
Below shown are some of the concepts which I encountered while my study.
Interfaces
Interfaces are used to type-check whether an object fits a certain structure. By defining an interface we can name a specific combination of variables, making sure that they will always go together.
"When translated to JavaScript, interfaces disappear - their only purpose is to help in the development stage." In the below example we define a simple interface to type-check a function's arguments:
"The order of the properties does NOT matter. We just need the required properties to be present and to be the right type. If something is missing, has the wrong type, or is named differently, the compiler will warn us."
Classes
When building large scale apps, the object-oriented style of programming is preferred by many developers.
TypeScript offers a class system, including inheritance, abstract classes, interface implementations, setters/getters, and etc."
Here is a class
Modules
A module can export any number of functions, classes or variables. By default, the objects are exported with their original names. We can change this if required. A module can have a default exported member as well.
Following snippet shows examples of different export statements:
As typescript is being compiled down to javascript how are these classes, interfaces, modules etc are being transpired?



