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

TypeScript Error when adding children

Open lancesnider opened this issue 2 years ago • 5 comments

Here's all that's going on in my .tsx:

const stuff = [1, 2, 3]

  return (
    <FlipMove>
      {stuff.map((item) => {
        return (
         <div key={item}>some div</div>
        );
      })}
    </FlipMove>
  );

I get the following TS error:

[{
	"resource": "xxx.tsx",
	"owner": "typescript",
	"code": "2769",
	"severity": 8,
	"message": "No overload matches this call.\n  Overload 1 of 2, '(props: FlipMoveProps | Readonly<FlipMoveProps>): FlipMove', gave the following error.\n    Type '{ children: Element[]; duration: number; staggerDurationBy: number; staggerDelayBy: number; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<FlipMove> & Readonly<FlipMoveProps>'.\n      Property 'children' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<FlipMove> & Readonly<FlipMoveProps>'.\n  Overload 2 of 2, '(props: FlipMoveProps, context: any): FlipMove', gave the following error.\n    Type '{ children: Element[]; duration: number; staggerDurationBy: number; staggerDelayBy: number; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<FlipMove> & Readonly<FlipMoveProps>'.\n      Property 'children' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<FlipMove> & Readonly<FlipMoveProps>'.",
	"source": "ts",
	"startLineNumber": 41,
	"startColumn": 6,
	"endLineNumber": 41,
	"endColumn": 14
}]

I'm using react-flip-move 3.0.4, which is the latest.

lancesnider avatar Jul 10 '22 22:07 lancesnider

Also experiencing this. Seems as though it was "fixed" in 9f17f68, but hasn't been published so doesn't actually fix the issue yet.

cozmo avatar Jul 19 '22 18:07 cozmo

I saw that and was wondering why it wasn't fixing the issues. That makes sense. Thanks @cozmo. @nickjs Do you know when you're change is going to get released?

lancesnider avatar Jul 19 '22 20:07 lancesnider

No idea, I know it got merged, but I'm not sure when the maintainers would want to cut a release. I defer to you, @xcv58!

nickjs avatar Jul 20 '22 17:07 nickjs

Still waiting for response https://github.com/joshwcomeau/react-flip-move/issues/233#issuecomment-1107257677 since I don’t have the npm permission to publish a release.

xcv58 avatar Jul 20 '22 18:07 xcv58

when will this be pushed live?

samstr avatar Aug 31 '22 19:08 samstr

The new version (3.0.5) is published: https://www.npmjs.com/package/react-flip-move

xcv58 avatar Dec 02 '22 04:12 xcv58

Confirmed the type export correctly:

    interface FlipMoveProps {
        /**
         * The children to animate. Each child must have a unique key to work correctly.
         */
        children?: React.ReactNode;

Please feel free to reopen if there is any problem.

xcv58 avatar Dec 02 '22 04:12 xcv58