I have following code:
class Student extends Backbone.Model {
// id, lastname, firstname, birthdate
}
class StudentList extends Backbone.Collection {
model = Student;
...
}
I get always an error like this.
Type of overridden member 'model' is not subtype of original member defined by type 'Collection' ...
In an official example is nearly the same code. There it works (Todo->TodoList). The declaration of Collection in my backbone.d.ts is this.
...
model:Model;
...
Any ideas?
You’re setting the value of the var
modelto the typeStudentwithmodel = Student;To override the variable you would need
model:Student;and to set the value you would needmodel:Student = nameOfSomeInstanceOfClassStudent;(or justmodel = nameOfSomeInstanceOfClassStudent;) or, if you’re initializing it with a new student,model:Student = new Student();