pixijs / pixi-react

Write PIXI apps using React declarative style
https://pixijs.io/pixi-react/
MIT License
2.42k stars 180 forks source link

Bug: Container Types #399

Closed josegamboa closed 1 year ago

josegamboa commented 1 year ago

Current Behavior

Hi, It seems like there is an issue with the example provided on the docs:

I have just created a project with :

` import { BlurFilter } from 'pixi.js'; import { Stage, Container, Sprite, Text } from '@pixi/react'; import { useMemo } from 'react';

export const MyComponent = () => { const blurFilter = useMemo(() => new BlurFilter(4), []);

return (

); };

export default MyComponent;

`

And it is having a TypeScript issue with the Container component:

Type '{ children: Element; x: number; y: number; }' is not assignable to type 'IntrinsicAttributes & Partial<Omit<Container<DisplayObject>, P | ReadonlyKeys<Container<DisplayObject>>> & WithPointLike<...>> & InteractionEvents & { ...; }'. Property 'children' does not exist on type 'IntrinsicAttributes & Partial<Omit<Container<DisplayObject>, P | ReadonlyKeys<Container<DisplayObject>>> & WithPointLike<...>> & InteractionEvents & { ...; }'.ts(2322)

If I do remove the container it works

Expected Behavior

Compile example as it is on the docs

Steps to Reproduce

Create a new react typescript project and copy and paste the example from the docs

Environment

Possible Solution

Update documentation

Additional Information

No response

baseten commented 1 year ago

Many thanks for posting the issue, I believe it's a dupe of https://github.com/pixijs/pixi-react/issues/350 - closing in favour of that issue.