https://github.com/liteobject/typescript-tutorial
https://github.com/liteobject/typescript-tutorial
javascript typescript
Last synced: 7 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/liteobject/typescript-tutorial
- Owner: LiteObject
- Created: 2023-09-04T16:51:02.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-09-04T16:54:30.000Z (over 2 years ago)
- Last Synced: 2025-06-11T18:26:23.874Z (8 months ago)
- Topics: javascript, typescript
- Language: TypeScript
- Homepage:
- Size: 9.77 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Basic TypeScript Tutorial
>TypeScript is a syntactic superset of JavaScript which adds static typing.
## Data Types
- `boolean`
- `number` (Whole numbers and floating point values)
- `string`
- `bigint` (Whole numbers and floating point values, but allows larger negative and positive numbers than the `number` type.)
- `symbol` (To create a globally unique identifier)
- `any` (A special type that disables type checking and effectively allows all types to be used)
- `unknown` (A safer alternative to `any`)
- `never` (Effectively throws an error whenever it is defined)
- `undefined` & `null` (These special types refer to the JavaScript primitives `undefined` and `null` respectively.)
## Basic Commands
### How to install `TypeScript`
- `npm install typescript --save-dev`
- The compiler is installed in the `node_modules` directory and can be run with: `npx tsc`
- `npm i -g typescript`
- The compiler is available globally, so `npx` is not necessary
### How to initialize a TypeScript project
- `tsc --init`
- This command will generate a `tsconfig.json` file
### How to use `tsc` to compile a file
- `tsc index.ts`
### How to use `node` cli to run js file
- `node index`