Markdown Demo
A demo of all the markdown elements that can be used and how they look.
When starting a new TypeScript project, it helps to begin with the smallest possible program:
files/hello.ts const a = 1; // this code block has a file name
const b = 2;
const c = 3; // this code block has a very long line which overflows and makes a scrollbar appear
const b = 2; // this code block's first line overflows, shift the copy button so we can read it fully
const c = 3;
A small working example is often more useful than a large unfinished one.
Setting Up the Project
First, create a new directory and initialize your project. Keep the initial setup simple so that you can understand each dependency you add.
Why Use TypeScript?
TypeScript adds static type checking to JavaScript. This can make your code safer and easier to maintain, especially as a project grows.
It is also useful for catching mistakes before your program runs.
Normal JavaScript is still valid in most TypeScript files.
TypeScript does not replace JavaScript. It builds on top of it.
Installation Steps
Follow these steps to create the project:
- Create a new project directory.
- Initialize a package manager.
- Install TypeScript.
You may also want to add:
- A formatter
- A linter
- A test runner
npm install --save-dev typescript
For more information, read the TypeScript documentation.
Project Files
| Syntax | Description |
|---|---|
| Header | Title |
| Paragraph | Text |
At one time, you might have believed that TypeScript requires a complicated setup. For a basic project, only a few files are necessary.