TypeScript에서 복잡한 객체

객체는 내부에 어떤 중첩 구조도 가질 수 있으며, 이 구조는 객체 선언 시 또는 인터페이스에서 설명될 수 있습니다.

예를 들어, 사용자를 설명하는 다음과 같은 인터페이스를 만들어 보겠습니다:

typescriptinterface User {
  name: string,
  age: number,
  parents: {
    mother: string,
    father: string
  }
}

이 인터페이스를 구현하는 객체를 만들어 봅시다:

typescriptlet user: User = {
  name: 'john',
  age: 30,
  parents: {
    mother: 'jane',
    father: 'eric'
  }
}
Задание 1

다음 객체가 주어졌습니다:

typescriptlet event = {
  name: 'my new event',
  time: {
    start: '2025-11-01',
    finish: '2025-12-31'
  }
};

이 객체의 구조를 설명하는 인터페이스를 만드세요.

Задание 2

다음 객체가 주어졌습니다:

typescriptlet employee {
  name: 'andrew',
  potision: {
    name: 'programmer'
    salary: 1000,
  }
  addr: {
    country: 'belarus',
    city: 'minsk'
  }
};

이 객체의 구조를 설명하는 인터페이스를 만드세요.