Skip to content

泛型

构造函数中使用泛型

接口中使用

ts
interface ArticleInterface<T, D> {
  title: string
  isLock: T
  comments: D
}
interface CommentType {
  content: string
  author: string
}

const article: ArticleInterface<boolean, CommentType> = {}