items
Define default behavior for items in the list.
Property
By defining an items
property, this will supply a
default behavior for items in the list.
Setting the wildcard is useful when items should be converted to a particular type.
import { ObservableArray, ObservableObject, type } from "can/everything";
class Person extends ObservableObject { /* ... */ }
class People extends ObservableArray {
static items = type.convert(Person);
}
let scientists = new People([
{ first: "Ada", last: "Lovelace" },
{ first: "John", last: "McCarthy" }
]);
console.log(scientists[0] instanceof Person);
// -> true