pixi-viewport icon indicating copy to clipboard operation
pixi-viewport copied to clipboard

Unable to add Viewport to Stage (TS Type Definition)

Open ktwrd opened this issue 2 years ago • 2 comments

When trying to add PIXI Viewport to an applications stage when using typescript. It seems like it's very similar to the error in #348 which is

src/engine.ts:124:41 - error TS2345: Argument of type 'Viewport' is not assignable to parameter of type 'DisplayObject'.
  Property '_maskRefCount' is missing in type 'Viewport' but required in type 'DisplayObject'.

124         this.Application.stage.addChild(this.Viewport)

The dependencies used are;

"dependencies": {
    "events": "^3.3.0",
    "pixi-viewport": "^4.34.4",
    "pixi.js": "^6.2.2"
},
"devDependencies": {
    "@types/events": "^3.0.0",
    "@types/offscreencanvas": "^2019.6.4",
    "typescript": "^4.6.4"
}

The code can be found at eplengine/tree/pixi-viewport.

ktwrd avatar May 06 '22 03:05 ktwrd

@ktwrd I had this issue, and it was because my Pixi dependencies were not updating properly. For me, in node modules there was pixi.js and @pixi. Look at the package.json files in pixi.js and @pixi/core and make sure the versions are what you are expecting.

kurtwaldowski-echelon avatar May 18 '22 17:05 kurtwaldowski-echelon

@ktwrd Did you get this resolved?

kurtwaldowski-echelon avatar Jun 01 '22 16:06 kurtwaldowski-echelon

May I ask what target version of pixi.js is the current release (4.35.0)? I am also getting this error and I'm trying to trackdown all the correct dependencies.

Currently I have

{
  "dependencies":
    "@pixi/filter-adjustment": "^4.2.0",
    "@pixi/filter-glow": "^4.2.0",
    "@pixi/filter-multi-color-replace": "^4.2.0",
    "pixi-viewport": "^4.35.0",
    "pixi.js": "^6.5.1",
}

JeffBaumgardt avatar Aug 17 '22 18:08 JeffBaumgardt

@kurtwaldowski-echelon Sorry for the late response, yes this did fix the problem. Thank you very much!! <3

ktwrd avatar Aug 22 '22 14:08 ktwrd