interface HelloPerson {
  (name: string, age?: number): void; // 이런 형태의 함수로 작성될 것
}

// age? 를 age 로 하면 error 가 난다. 반드시 있어야 하는게 아니기 때문.
// const helloPerson: HelloPerson = function (name: string, age?: number) {
//   console.log(`ㅎㅇ! ${name}입니다. `);
// };

// 실제 함수를 사용할때는 interface 와의 관계가 중요하다.
// 무슨 말이냐 하면
const helloPerson: HelloPerson = function (name: string) {
  console.log(`ㅎㅇ! ${name}입니다. `);
};

// age 가 없어도 interface 와의 관계 덕분에 error 없이 된다.
helloPerson('malza', 29)