[๐ฆ] interface & type
ํ์ ์คํฌ๋ฆฝํธ์์ ํ์ ์ ์ ์ธํ๋ ๋ฐฉ์์ธ interface์ type. interface๋ ์ฌ๋ฌ ํ ๋น์ด ๊ฐ๋ฅํ๋ค.ํ์ง๋ง ์ํ์์๊ฐ ์์ผ๋ฉฐ ์์ฃผ ์ฐ์ด์ง๋ ์๋ ๋ฏ ํ๋ค.interface Todo { id: string; title: string; completed: boolean;};interface Todo { timestamp: number;}; ์์ ๊ฐ์ด interface๋ ์ฌ๋ฌ ํ ๋น์ด ๊ฐ๋ฅํ๋ค.์ด๋ฐ ์์ผ๋ก ํ ๋นํ๊ฒ ๋๋ฉด ๊ฒฐ๊ตญ Todo์๋ 4๊ฐ์ ํ์ ์ด ๊ฐ๋ฅํ๋ค. ํ์ธ์ ์๋ ์ฌ์ง์์ ๋ณผ ์ ์๋ฏ์ด todo. ์ ์ฐ์ผ๋ฉด ๋ด๋ถ ํ์ ํ์ธ์ด ๊ฐ๋ฅํ๋ฉฐ timestamp ํ์ ์ ํฌํจํ๊ณ ์๋ค. ๋ค๋ง, ์ด๋ ๊ฒ ์ฐ์ธ๋ค๋ฉด Todo ์์ฒด์ ํ์ ์ด ๋ณํ๊ฒ ๋๋ค.์ฆ, ์ฒ์ ํ ๋นํ {id, title, comp..
Language/Typescript
2025. 3. 10. 16:28