react-spring icon indicating copy to clipboard operation
react-spring copied to clipboard

Typescript error for useTransition

Open danfri86 opened this issue 7 years ago • 3 comments

I'm using React with Typescript and getting typing errors for useTransition:

const items = [{id: 1}, {id: 2}];
const transitions = useTransition(items, item => item.id, {
  from: { opacity: 0 },
  enter: { opacity: 1 },
  leave: { opacity: 0 },
})

Resulting in "Expected 1 arguments, but got 3." I'm not sufficient enough in writing types, would be nice if someone can add them.

danfri86 avatar Feb 07 '19 09:02 danfri86

Dude you are on 7.x.x and trying 8.x.x example. or using 8.x beta where the wrong typing for 7.x was there

JasCodes avatar Feb 07 '19 09:02 JasCodes

The typing is off, but i'm looking at these types and don't understand what i would have to change. If any of you want to submit a pr, they're super welcome!

That's the file: https://github.com/react-spring/react-spring/blob/master/types/web.d.ts

drcmda avatar Feb 07 '19 10:02 drcmda

Much appreciated @brunolemos 🙏🏻

danfri86 avatar Feb 07 '19 12:02 danfri86