-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInfo.txt
More file actions
39 lines (29 loc) · 903 Bytes
/
Info.txt
File metadata and controls
39 lines (29 loc) · 903 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
*********Learn What matters in TypeScript lang(concepts which is maximum used codebase).****************
1. Type annotation
eg :-
let firstName : string = 45;
let firstName : number = 45;
let firstName : boolean = true;
let firstName : undefined
2. Type Any & unknown both used in function (***parameter***)=>{...}
:Any = store any type of data without any type checking by the TypeScript compiler
:unknown = best used when you don't know the type of data being typed. To add a type later
3.TypeScript function
function greet (value: number): string //compulsory// {
console.log("Hello"+ value)
}
greet(12:number) //compulsory//
4. Type Array in TypeScript
eg:
const names : string [ ] = ["a", "b", "c", "d];
5. Type Object in TypeScript
interface CarProps {
type: string
model: string
year: number
}
eg: const car = {
type: "Toyota",
model: "Corolla",
year: 2009
};