Documentation

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

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