ui icon indicating copy to clipboard operation
ui copied to clipboard

types: Add generic types to Container-like views

Open CatchABus opened this issue 1 year ago • 1 comments
trafficstars

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

You are welcome to create this PR ;)

CyberDex avatar Jul 30 '24 12:07 CyberDex

Closed via #191

CatchABus avatar Oct 10 '24 13:10 CatchABus