| TypeScript | JavaScript |
| A typed language that catches compilation errors early on | You can find out errors during runtime |
| Suitable for large projects as it improves code maintainability and readability | As more code is added, becomes difficult to test and debug, thus JS is suitable for small projects |
| Superset of JS, i.e., features like object-orientation, type-checking, and more | A scripting language that supports dynamic web content creation |
| Requires compiler installation and configuration setup | No need for any installation; JS code can be directly written in a browser using <script> tag |
| All .ts files are converted to .js files before execution; known as trans-compilation | Developers can directly include .js files within HTML files for execution using <src> tag. |
| Powerful and intuitive with rich features like modules, generics, interfaces | Suitable for simple web applications that do not require advanced features |
| Used for server-side and client-side scripting | Easy to use for client-side scripting, but becomes heavy and complex for server-side scripting |
| Takes time to execute because of the compilation step | No compilation is required hence faster execution |
| Supports both static and dynamic typing | Supports only dynamic typing |
We can specify type annotation as:var feeling: string = “happy”; | Type annotations cannot be specified as we cannot define types. |