Aug 31, 2024
What is TypeScript?
Why do we need TypeScript?
How is it different from vanilla JavaScript?
Static Typing:
Editor Support:
Future JavaScript Features:
Install Node.js:
Install TypeScript Compiler:
npm install -g typescript
Verify Installation:
tsc -v
Code Editor:
hello-world
).ts
extension (e.g., index.ts
)console.log('Hello World')
)tsc index.ts
tsc --init
to create a tsconfig.json
filetsconfig.json
:
tsconfig.json
by setting sourceMap
to truenumber
, string
, boolean
, null
, undefined
, and object
any
, unknown
, never
, enum
, tuple
any
type usage for type safetynumber[]
)readonly
modifier to prevent modificationsnumber | string
)draggable & resizable
)50 | 100
)null
and undefined
in strict mode