標題可能不是最好的,改進將不勝感激! 我的意思其實很簡單的問題: 說我有一個包含Student s表示有Notebook秒的數組的數組School類,我想引用我School所有Notebook小號 public class School{
students: Student[];
}
public class Student{
notebooks: Notebook[]
我試圖創建一個有兩個類型參數,其中一種類型的參數使用另一個爲打字稿函數的值時,編譯錯誤TS2322誤差爲行const wrapper: W = { value: val };: test.ts(6,11): error TS2322: Type '{ value: T; }' is not assignable to type 'W'.
然而,如W延伸Wrapper<T>,所分配的值{ val