如何从TypeScript接口的'data'键属性中提取属性?

时间:2019-05-18 14:19:28

标签: typescript

我有以下代码:

export interface ISubjectData {
  goal: IGoal,
  subjects: ISubject[]
}

export interface IChapterData {
  subject: ISubject
  chapters: IChapter[]
}

export interface ISubjectChapterData {
  type: string,
  data: ISubjectData | IChapterData
}

如何从以上界面中提取data.subjects

0 个答案:

没有答案