Docs (4.0.0)
class ManagedList method

restrict

Restricts the type of objects that can be added to this list.

restrict<R extends T>(ManagedObjectClass: {
    new (...args: any[]): R;
}): ManagedList<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

  • ManagedObjectClass — 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