Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typescript - DropshadowFilter does not overlap with PIXI.Filter #459

Open
win-chen opened this issue Apr 30, 2024 · 1 comment
Open

Typescript - DropshadowFilter does not overlap with PIXI.Filter #459

win-chen opened this issue Apr 30, 2024 · 1 comment

Comments

@win-chen
Copy link

win-chen commented Apr 30, 2024

Hi there, I'm using Typescript in my project and I'm running into the error:

Conversion of type 'DropShadowFilter' to type 'Filter' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
  Type 'DropShadowFilter' is missing the following properties from type 'Filter': antialias, _state, blendRequired, gpuProgram, and 18 more.ts(2352)

Reproduce with:

import * as PIXI from "pixi.js";
import { DropShadowFilter } from '@pixi/filter-drop-shadow';

const dropshadow = new DropShadowFilter({
  distance: 2, 
  blur: 5, 
  color: 0
});

function concatFilter(obj: PIXI.Sprite, filter: PIXI.Filter) {
	obj.filters = [(obj.filters || [])].flat().concat(filter);
}

const sprite = new PIXI.Sprite();

concatFilter(sprite, dropshadow) // <-- error

Dependency versions:
"@pixi/filter-drop-shadow": "^5.2.0",
"pixi.js": "^8.0.4",

@win-chen win-chen changed the title cccccctrrlcebeegbbkifjevnvrkvlkvhgjufengrugh Typescript - DropshadowFilter does not overlap with PIXI.Filter Apr 30, 2024
@bigtimebuddy
Copy link
Member

You should use the pixi-filters package @ v6 and import the filter "pixi-filters/drop-shadow". All the @pixi/filter-* are v7 only.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants