How TypeScript Compilation Works ?
In this article, we will try to understand how TypeScript compilation works (like how a TypeScript code or a program compiles and produces an output in the browser’s console).
Let’s understand how TypeScript compilation works?
- Whenever any code is written using the TypeScript language is kept in a file that is named anything followed by a suffix containing “.ts” at the end.
- This suffix indicates to the compiler that the file has a program or a code that is written in TypeScript language and thus compiler takes care of that fact and accordingly compiles the code.
Now that we have understood in detail the compilation of TypeScript let us understand all the facts using a coding example which is listed below:
Example: In this example, we will first create a TypeScript file (with suffix being kept as “.ts”) containing some logic or results which we need to output in the browser’s console.
Output: The output of both the code snippet would remain the same which is thus illustrated below.
1 - Aman - CSE
Please Login to comment...