https://github.com/athrocks/typescript-course
https://github.com/athrocks/typescript-course
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/athrocks/typescript-course
- Owner: athrocks
- License: mit
- Created: 2025-02-21T12:33:07.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2025-02-21T12:39:32.000Z (3 months ago)
- Last Synced: 2025-02-21T13:34:59.857Z (3 months ago)
- Language: TypeScript
- Size: 0 Bytes
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# TypeScript Project Setup
This repository contains a basic TypeScript setup with compilation and execution using Node.js.
## Prerequisites
- Install [Node.js](https://nodejs.org/) (includes npm)
- Install TypeScript globally:
```sh
npm install typescript -g
```## Initialize TypeScript Project
To set up a TypeScript project, initialize it with:
```sh
tsc --init
```
This creates a `tsconfig.json` file where you can configure TypeScript settings.## Writing TypeScript Code
Create a `src` folder and add a TypeScript file `src/index.ts`:
```ts
const message: string = "Hello, TypeScript!";
console.log(message);
```## Compiling TypeScript
To compile the TypeScript file manually, run:
```sh
tsc
// or tsc fileName
```
This generates a JavaScript file in the same directory.## Watch Mode (Automatic Compilation)
To automatically compile TypeScript files on changes, use:
```sh
tsc --watch
```
This keeps watching for changes and recompiles automatically.## Running the Compiled JavaScript File
Once compiled, run the JavaScript output using Node.js:
```sh
node fileName.js
```
(Modify the path based on your `tsconfig.json` output directory.)## License
This project is open-source and available under the MIT License.