What is TypeStript

TypeScript is an extension of JavaScript. It compiles into Javascript. Any JavaScript file is also a valid TypeScript file and it's compilation makes no change to the code.

How to use TypeScript

Developing in typescript is tested on VisualStudio Code.

  1. npm install typescript -g Install TypeScript globally.
  2. tsc --watch Compiles every ts file in project instantly and whenever a file is saved.
  3. node app.js

If you are using Visual Studio Code

We use VSCode and everything is set up.

  1. npm install typescript -g Install TypeScript globally.
  2. hit F5 to start debugging.

What are .d.ts files?

.d.ts files contain only declarations, that provide type checking and autocomplete for you. However it does not contein any runnable code.

some exmaples of including declaration file:

import { Addon } from "../ClientV2";
import "./node.d.ts";