TypeScriptis very essential to write code in Angular 4 and other higher versions. In this Article, you can understand about TypeScript. To know more about Angular 4, Please visit our main website - Angular Latest Topics.
What is TypeScript?
· TypeScript is Strongly Typed Language which means you have to be specific with Variable type.
· TypeScript doesn’t run in the browser. We need to compile it to JS to run.
Features of TypeScript:
· Due to the static typing, code written in TypeScript is more predictable and is generally easier to debug.
· Makes it easier to organize the code base for very large and complicated apps with the help of modules, namespaces and strong OOP support.
· You can use TypeScript for other JS libraries Because TS compiles plain JS.
· TS is platform Independent.
· TypeScript doesn’t need any dedicated VM or a specific runtime environment to execute.
· The file extension of TypeScript is “.ts”.
· The TSC (TypeScript Compiler) is a source-to-source compiler (transcompiler / transpiler).
· The TSC generates the equivalent JS code from the source TS code. This process is termed as transpilation.
· tsc first.ts This will create a new file named first.js in the same location. Keep in mind that if you already had a file named first.js, it would be overwritten.
Benefits of TypeScript:
TypeScript has many benefits, here are the few,
· Static Type checking
· Supports pure OOPS
· ES6 Feature support
· Mostly the syntax related to JAVA and .net