-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathts4.ts
More file actions
42 lines (35 loc) · 730 Bytes
/
ts4.ts
File metadata and controls
42 lines (35 loc) · 730 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
39
40
41
42
// objects
let User:{
id:number,
name:string
}={
id:1,
name:'mohammad'
}
// برای ساخت یک نوع تایپ
type User_2 = {
id:number,
name:string,
life:boolean
}
let M:User_2 = {id:1,name:'sana',life:true}
let S:User_2 = {id:2,name:'mohammad',life:true}
// برای استفاده از متد داخل آبجکت
let User_3:{
id:number,
name:string,
FullName : (b:string)=>void
}={
id:1,
name:'mohammad',
FullName: enam => console.log(this.eame)
}
// برای اینکه پراپرتی های آبجکت غیر قابل تغیر باشند
let User_4:{
id:number,
readonly name:string
}={
id:1,
name:'mohammad'
}
// User_4.name = 'tt' ==> Error