AddChild in DisplayObject doesn't allow spreading anymore
See original GitHub issueHello, after updating to 6.2.0 I’m experiencing this behavior.
Expected Behavior
When using a spread operator to add to a DisplayObject like
const containers = [new Container(), new Container()]
a.stage.addChild(...containers)
I expect no ts issues
Current Behavior
Currently getting A spread argument must either have a tuple type or be passed to a rest parameter.ts(2556)
Possible Solution
Possibly it is due to this change in addChild
addChild<T extends DisplayObject>(…children: [T, …DisplayObject[]]): T; (6.2.0) addChild<T extends DisplayObject[]>(…children: T): T[0]; (6.1.3)
Steps to Reproduce
Environment
pixi.js
version: 6.2.0- OS & Version: Mac OS Big Sur
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
addChild(): How can I know when a DisplayObject is actually ...
I've got a large (4096x4096) image loaded into memory, but when I try to use addChild, there is a long delay before it...
Read more >Quick Way to Set Props on a New Instance - gskinner blog
A quick way to set multiple properties on new instances, and a related AS3 feature request.
Read more >DisplayObjectContainer - Adobe ActionScript® 3 (AS3 ) API ...
Calling the new DisplayObjectContainer() constructor throws an ArgumentError exception. DisplayObjectContainer. addChild(child:DisplayObject):DisplayObject.
Read more >Flash - senocular.com
Loader is a Sprite-like display object which, like Sprite, has no timeline, but is designed specifically to facilitate the loading of external display ......
Read more >Phaser.Rope - 2.6.1 - Learn
Working in radians is slightly faster as it doesn't have to perform any ... The lifespan allows you to give a Game Object...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This is the workaround for the type error.
In this case, because we tweaked the typing slightly, you need to be explicit about the type for
containers
.Thanks, I’m aware of the workarounds, I will be waiting for something more succinct.