It is superset to Javascript. This is not a Javascript library. It just extends the core Javascript principles. It adds static typing to Javascript. Javascript is dynamically typed.
To use TypeScript, use the following commands.
- npm init -y
- npm i typescript
Typescript does not run in the browser, it compiles then converts to Javascript. To run the TypeScript compiler, run the following command.
- npx tsc
If you did not configure the project, you have to direct the compiler to a file.
- npx tsc with-typescript.ts
This command will compile the TypeScript file and convert it into a Javascript file so it can be used in the browser by your project.