motion
motion copied to clipboard
refactor(types): Make BezierDefinition readonly for improved usability
fixed #2653
Hello. It seems that changing the currently written tuple type to a readonly type would make it more convenient to use.
If any modifications are needed, please let me know.
AS-IS
import { animate } from 'framer-motion'
// this works
animate(someElement, { rotateY: '180deg' }, { ease: [0.3, 1, 0, 1] })
// this throws type error
const e = [0.3, 1, 0, 1] as const
animate(someElement, { rotateY: '180deg' }, { ease: e })
TO-BE
import { animate } from 'framer-motion'
// this works
animate(someElement, { rotateY: '180deg' }, { ease: [0.3, 1, 0, 1] })
// this also works
const e = [0.3, 1, 0, 1] as const
animate(someElement, { rotateY: '180deg' }, { ease: e })