react-flip-move icon indicating copy to clipboard operation
react-flip-move copied to clipboard

Using FlipMove with TypeScript functional components

Open borgdrone7 opened this issue 3 years ago • 3 comments

Hi, I am rendering form elements which are functional components and trying to use FlipMove with them like this:

        <FlipMove>
          {components_length ? getComponents(components, dispatch):null}
        </FlipMove>

However I am getting this error:

TS2769: No overload matches this call.   Overload 1 of 2, '(props: FlipMoveProps | Readonly<FlipMoveProps>): FlipMove', gave the following error.     Type '{ children: FormComponent[] | null; }' has no properties in common with type 'IntrinsicAttributes & IntrinsicClassAttributes<FlipMove> & Readonly<FlipMoveProps>'.   Overload 2 of 2, '(props: FlipMoveProps, context: any): FlipMove', gave the following error.     Type '{ children: FormComponent[] | null; }' has no properties in common with type 'IntrinsicAttributes & IntrinsicClassAttributes<FlipMove> & Readonly<FlipMoveProps>'

Components are dynamic and very complex and I couldn't make example for functional components in read me work in my case. Anyone knows how to solve this issue?

borgdrone7 avatar Jun 08 '22 20:06 borgdrone7

I solved add the "children?: React.ReactNode" on FlipMoveProps:

image

thank's @douglasg14b (https://github.com/joshwcomeau/react-flip-move/issues/269)

matheusinfo avatar Jun 21 '22 00:06 matheusinfo

I didn't understand. Where and what should be added?

Disolm avatar Dec 01 '22 16:12 Disolm

I didn't understand. Where and what should be added?

in any *.d.ts file

thNel avatar Apr 06 '23 06:04 thNel