ํ๋ผ๋ฏธํฐ ํ์ ๋ค ์ ์ํ๊ธฐ
parameter, return value๋ฑ์ ๋ํด ๋ฐ๋ก ๋นผ์ interface๋ type์ผ๋ก ์ ์ํด์ ์ฌ์ฉํ๋ฉด ๋๋ค.
Event type
1
2
3
4
5
6
7
function initEvents() {
list.addEventListener('click', handleListClick);
}
async function handleListClick(event: any) {
// ...
}
์์ click ์ด๋ฒคํธ์ด๋ฏ๋ก MouseEvent๋ก ๋ฐ๊ฟ ์ ์๋ค.
1
2
3
async function handleListClick(event: MouseEvent) {
// ...
}
์ด๋ฒคํธ ํ์ ์ event์์ ๋ง์ฐ์ค๋ฅผ ์ฌ๋ฆฌ๋ฉด ์ ์ ์๋ค.

Axios
Promise๋ฅผ ๋ฆฌํดํ๋ ํจ์๋ Promise<AxiosResponseยซย Typeย ยป ์ผ๋ก ์ ์ํด์ฃผ๋ฉด ๋๋ค.
TS๊ฐ์๋ฅผ ๋ค์ผ๋ฉฐ ์ ๋ฆฌํ ๋ด์ฉ์ ๋๋ค.