pixijs / pixi-react

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

`key` typecheck error #494

Closed sergioisidoro closed 5 months ago

sergioisidoro commented 5 months ago

Current Behavior

Adding key to a component will return type error. eg

error TS2322: Type '{ children: Element[]; key: number; }' is not assignable to type 'Omit<PixiOptionsType<ContainerOptions<ContainerChild>>, "children"> & { children?: ReactNode; } & { ...; } & EventHandlers & DrawCallback'.
  Property 'key' does not exist on type 'Omit<PixiOptionsType<ContainerOptions<ContainerChild>>, "children"> & { children?: ReactNode; } & { ...; } & EventHandlers & DrawCallback'.

159           <pixiContainer key={i}>
                             ~~~

Expected Behavior

No type error

Steps to Reproduce

{someArray.map....
  <pixiContainer key={i}>
    <Rectangle
      x={year.worldStart}
      y={0}
      width={year.worldEnd - year.worldStart}
      height={baseHeight}
      lineColor='0xCCCCCC'
    />
  </pixiContainer>
 }

Environment

trezy commented 5 months ago

Fixed in 8.0.0-dev.9db4138.