ui icon indicating copy to clipboard operation
ui copied to clipboard

types: Add generic types to Container-like views

Open CatchABus opened this issue 8 months ago • 1 comments

Please Describe The Problem To Be Solved It would be a nice addition if DisplayObjects were more type-friendly when it comes to handling children. Pixi itself does that with Container.

const container = new Container<Sprite>();
// Now I can manipulate children without casting type

(Optional): Suggest A Solution Example using a List

const list = new List<Graphics>({
    children: [
        new Graphics().beginFill(0x000000).drawRect(0, 0, 50, 50),
        new Graphics().beginFill(0xFFFFFF).drawRect(0, 0, 50, 50),
    ],
 });

console.log(list.children); // Type of Graphics[]

CatchABus avatar Jun 21 '24 17:06 CatchABus