restrict()
Restricts the type of objects that can be added to this list.
restrict<R extends T>(ObservableObjectClass: {
new (...args: any[]): R;
}): ObservableList<R>;Summary
This method can be used to limit the type of objects that can be added to the list: all new objects should inherit from the specified class, otherwise they can’t be added.
Parameters
- ObservableObjectClass — The class that all objects in this list should inherit from
Return value
The list itself, typed using the specified class.
Errors
This method throws an error if the list currently already contains any objects that don’t inherit from the specified class.
Related
class ObservableList
A data structure that contains an ordered set of observable objects.
