Repository: pixijs/pixijs
File: src/scene/container/Container.ts (TypeScript)

Code before:
    /** A view that is used to render this container. */
    public readonly view: T;

    /**
     * An optional bounds area for this container. Setting this rectangle will stop the renderer
     * from recursively measuring the bounds of each children and instead use this single boundArea.
     * This is great for optimisation! If for example you have a 1000 spinning particles and you know they all sit
     * within a specific bounds, then setting it will mean the renderer will not need to measure the
     * 1000 children to find the bounds. Instead it will just use the bounds you set.
     */
    public boundsArea: Rectangle;

    constructor(options: Partial<ContainerOptions<T>> = {})
    {
        super();

        if (options.view)
        {
            this.view = options.view;
            // in the future we could de-couple container and view..
            // but for now this is just faster!
            this.view.owner = this;
            options.view = undefined;
        }

        assignPropertiesFromOptions(this, options, {
            children: true,
            parent: true,
            effects: true,
        });

        options.children?.forEach((child) => this.addChild(child));
        options.effects?.forEach((effect) => this.addEffect(effect));
        options.parent?.addChild(this);
    }

    /**
     * Adds one or more children to the container.
     *
     * Multiple items can be added like so: `myContainer.addChild(thingOne, thingTwo, thingThree)`
     * @param {...Container} children - The Container(s) to add to the container
     * @returns {Container} - The first child that was added.
     */
    public addChild<U extends Container[]>(...children: U): U[0]
    {
        if (!this.allowChildren)
        {
            deprecation(v8_0_0, 'addChild: Only Containers will be allowed to add children in v8.0.0');
        }

        if (children.length > 1)

Review comment (suggestion):
Recommend renaming to `assignWithIgnore`. Since the functionality isn't really about props or options but a generic assign variant.


Code after:

    /** A view that is used to render this container. */
    public readonly view: T;

    /**
     * An optional bounds area for this container. Setting this rectangle will stop the renderer
     * from recursively measuring the bounds of each children and instead use this single boundArea.
     * This is great for optimisation! If for example you have a 1000 spinning particles and you know they all sit
     * within a specific bounds, then setting it will mean the renderer will not need to measure the
     * 1000 children to find the bounds. Instead it will just use the bounds you set.
     */
    public boundsArea: Rectangle;

    constructor(options: Partial<ContainerOptions<T>> = {})
    {
        super();

        if (options.view)
        {
            this.view = options.view;
            // in the future we could de-couple container and view..
            // but for now this is just faster!
            this.view.owner = this;
            options.view = undefined;
        }

        assignWithIgnore(this, options, {
            children: true,
            parent: true,
            effects: true,
        });

        options.children?.forEach((child) => this.addChild(child));
        this.effects = [];
        options.parent?.addChild(this);
    }

    /**
     * Adds one or more children to the container.
     *
     * Multiple items can be added like so: `myContainer.addChild(thingOne, thingTwo, thingThree)`
     * @param {...Container} children - The Container(s) to add to the container
     * @returns {Container} - The first child that was added.
     */
    public addChild<U extends Container[]>(...children: U): U[0]
    {
        if (!this.allowChildren)
        {
            deprecation(v8_0_0, 'addChild: Only Containers will be allowed to add children in v8.0.0');
        }