You Can Become A
๋ฆ๊ฒ ์์ํด๋ ๋๊ตฌ๋ ์ง ๋ ธ๋ ฅํ๋ฉด ๊ฐ๋ฐ์๊ฐ ๋ ์ ์์ด์ !
์ฝ๋ฐฑ void
๐ ๊ฐ์ฒด๋ฅผ ํ์ ์ผ๋ก ๋ณํ - keyof / typeof ์ฌ์ฉ๋ฒ
ํ์ ์คํฌ๋ฆฝํธ - keyof / typeof typeof ์ฐ์ฐ์ typeof : ๊ฐ์ฒด ๋ฐ์ดํฐ๋ฅผ ๊ฐ์ฒด ํ์ ์ผ๋ก ๋ณํํด์ฃผ๋ ์ฐ์ฐ์ ์๋์ ์ฝ๋์ obj๋ ๊ฐ์ฒด์ด๊ธฐ ๋๋ฌธ์, ๋น์ฐํ ๊ฐ์ฒด ์์ฒด๋ฅผ ํ์ ์ผ๋ก ์ฌ์ฉํ ์ ์๋ค. ๊ทธ๋์ ๋ง์ผ ๊ฐ์ฒด์ ์ฐ์ธ ํ์ ๊ตฌ์กฐ๋ฅผ ๊ทธ๋๋ก ๊ฐ์ ธ์ ๋ ๋ฆฝ๋ ํ์ ์ผ๋ก ๋ง๋ค์ด ์ฌ์ฉํ๊ณ ์ถ๋ค๋ฉด, ์์ typeof ํค์๋๋ฅผ ๋ช ์ํด์ฃผ๋ฉด ํด๋น ๊ฐ์ฒด๋ฅผ ๊ตฌ์ฑํ๋ ํ์ ๊ตฌ์กฐ๋ฅผ ๊ฐ์ ธ์ ์ฌ์ฉํ ์ ์๋ค. const obj = { red: 'apple', yellow: 'banana', green: 'cucumber', }; // ์์ ๊ฐ์ฒด๋ฅผ ํ์ ์ผ๋ก ๋ณํํ์ฌ ์ฌ์ฉํ๊ณ ์ถ์๋ type Fruit = typeof obj; /* type Fruit = { red: string; yellow: string; gree..