File tree Expand file tree Collapse file tree 2 files changed +7
-7
lines changed
Expand file tree Collapse file tree 2 files changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ export let user: userType = {
2323 name : 'dongwoo' ,
2424 age : 30 ,
2525 birthYear : 2000 ,
26-
26+ // ์ค๋ก์ง score์์ ์ ํด์ง ์ ์๋ง ์ฌ์ฉ์ด ๊ฐ๋ฅํ๋ค.
2727 1 : 'A' ,
2828 2 : 'B' ,
2929 3 : 'A' ,
Original file line number Diff line number Diff line change 1+ //grade๋ฅผ ๋ฌธ์์ด๋ก ์ ์ธํ๊ธฐ์๋ ๋๋ฌด ๊ด๋ฒ์ํ๋ค. ๊ทธ๋์ ์ด๋ฅผ ๋ฌธ์์ด ๋ฆฌํฐ๋ด ๋ฐฉ์์ผ๋ก ํ์
์ ํ๋ ์ ์ธ ํด๋ณด๋ฉด ์๋์ ๊ฐ๋ค.
2+
3+ type Score = 'A' | 'B' | 'C' | 'F' ;
4+ //type์ ์ ํํ ์ด๋ค ๊ฒ์ธ๊ฐ?
5+
16export interface userType {
27 name : string ,
38 age : number ,
49 // ๋ค์ "?"๊ฐ ์๋ ๊ฒ์ ์ต์
๋๋ก gender๋ฅผ ์
๋ ฅ์ ํด๋ ๋๊ณ ์ํด๋ ๋๋ ๋ฐฉ์์ด๋ค.
510 gender ?: string ,
611 readonly birthYear : number ,
712 //key value ๋ฐฉ์์ ์ธ๋ฑ์ค ์๊ทธ๋์ฒ (ํ๋กํผํฐ) ์ ์ธ
8- [ grade : number ] : string ;
13+ [ grade : number ] : Score ;
914}
10-
11- //grade๋ฅผ ๋ฌธ์์ด๋ก ์ ์ธํ๊ธฐ์๋ ๋๋ฌด ๊ด๋ฒ์ํ๋ค. ๊ทธ๋์ ์ด๋ฅผ ๋ฌธ์์ด ๋ฆฌํฐ๋ด ๋ฐฉ์์ผ๋ก ํ์
์ ํ๋ ์ ์ธ ํด๋ณด๋ฉด ์๋์ ๊ฐ๋ค.
12-
13- type Score = 'A' | 'B' | 'C' | 'F' ;
14- //type์ ์ ํํ ์ด๋ค ๊ฒ์ธ๊ฐ?
You canโt perform that action at this time.
0 commit comments