TypeScript is a statically typed superset of JavaScript that transpiles to JavaScript, making code more reliable and easier to maintain.
- Adds static typing and modern language features.
- Detects errors during development.
- Improves code quality and developer productivity.

"Hello, World!" Program in TypeScript
A "Hello, World!" program is the simplest way to get started with any programming language. Hereâs how you can write one using TypeScript.
In Browser (via Compilation)
Create a file hello.ts:
// This is our first TypeScript program
let message: string = "Hello, World!";
console.log(message);
Now compile it into JavaScript using:
npx tsc hello.tsThis will generate a hello.js file, which can then be included in your HTML.
<html>
<body>
<h1>
Check the console for the message!
</h1>
<script src="hello.js">
</script>
</body>
</html>
In Node.js Console: Simply run the compiled JavaScript:
node hello.jsOutput:
Hello, World!Comments
Comments are notes in your code that the TypeScript interpreter ignores. Theyâre great for explaining what your code does or for testing purposes.
- Single-line comment: Starts with //
// This is a single-line comment
- Multi-line comment: Enclosed in /* */
/* This is a multi-line comment
spanning multiple lines */
Client Side and Server Side Nature of TypeScript
TypeScriptâs flexibility extends to both the client-side and server-side, allowing developers to create complete, scalable applications. Hereâs how it functions in each environment:

Client-Side
- Used for controlling the browser and its DOM (Document Object Model).
- Handles user events like clicks, form inputs, and rendering dynamic content.
- Angular, React, Vue, Next.js, Remix, Astro, and other modern frameworks provide excellent TypeScript support.
Server-Side
- Used for interacting with databases, handling APIs, file manipulation, and generating responses.
- Node.js with TypeScript, along with frameworks like Express, Nest.js, Fastify is widely used to build type-safe backend applications.
- Type definitions help catch errors early and make server-side code more reliable and maintainable.
Must Read: JavaScript Vs TypeScript