class Subject {
constructor(public subid: number, public subname: string) {}
}
let chineseSubject = new Subject(100, "语文")
let mathSubject = new Subject(101, "数学")
let englishSubject = new Subject(101, "英语")
let setZhangSanSubject = new Set([chineseSubject, mathSubject])
type setSubjectType = typeof setZhangSanSubject
type ExtractSubjectType<T> = T extends Set<infer S> ? S : unknown
type result = ExtractSubjectType<setSubjectType>