motiondivision / motion

A modern animation library for React and JavaScript
https://motion.dev
MIT License
25.66k stars 842 forks source link

[BUG] MotionValue does not fit motion/react-m after migrating #2887

Open boar-is opened 5 days ago

boar-is commented 5 days ago

1. Read the FAQs 👇

Read

2. Describe the bug

After migrating from framer-motion to motion, I can't no more pass MotionValue to a component from motion/react-m:

import type { MotionValue } from 'motion/react'
import { div } from 'motion/react-m'

div({
  style: {
    // error here
    x: 5 as unknown as MotionValue<number>,
  },
})

image

TS2322: Type MotionValue<number> is not assignable to type
string | number | CustomValueType | MotionValue<number> | MotionValue<string> | MotionValue<any> | undefined
Type MotionValue<number> is not assignable to type MotionValue<any> with 'exactOptionalPropertyTypes: true'. Consider adding undefined to the types of the target's properties.
Types have separate declarations of a private property current

3. IMPORTANT: Provide a CodeSandbox reproduction of the bug

N/A

4. Steps to reproduce

N/A

5. Expected behavior

No error

6. Video or screenshots

N/A

7. Environment details

"motion": "11.11.17",

feledori commented 16 hours ago

just bumped into this exact issue as well