pixijs / pixi-react

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

Typescript error when add children to a Container component (may be related with React 18) #341

Closed dcaminos closed 2 years ago

dcaminos commented 2 years ago

Description

I'm getting a typescript error only when add children to any Container

Screen Shot 2022-05-06 at 08 54 13

Steps to reproduce

  1. Just add any kind of children to a Container component

Posible solution

Replace export const Container: React.FC<_ReactPixi.IContainer>; for export const Container: React.FC<PropsWithChildren<_ReactPixi.IContainer>>; on this line: https://github.com/inlet/react-pixi/blob/05babb2e684905364794af861acd15e0d64ec9de/index.d.ts#L359

inlet commented 2 years ago

Are you using React 18 types? as they removed children props in FC

dcaminos commented 2 years ago

Yes I'm @types/react": "^18.0.8"

inlet commented 2 years ago

Yes that's causing the issue, we're working on a React 18 implementation

inlet commented 2 years ago

If you switch back to React 17 this will work

inlet commented 2 years ago

I'll close this issue as this is related to #338. Once react-pixi is working with React 18 this should also be fixed