react-spring
react-spring copied to clipboard
[bug]: config.ease throws a type error when used in a Controller, but works fine when used in useSpring
Which react-spring target are you using?
- [X]
react-spring
What version of react-spring are you using?
9.4.5
What's Wrong?
config.ease throws a type error when used in a Controller, but works fine when used in useSpring
To Reproduce
import { easings, Controller} from 'react-spring';
const animation = new Controller({
from: { projectionMatrix: [] as number[] },
to: { projectionMatrix: [] as number[] },
config: {
precision: 0.0001,
duration: 1000,
ease: easings.easeOutExpo,
},
});
Gives the following error:
(property) EasingDictionary.easeOutExpo: (t: number) => number
Type '{ precision: number; duration: number; ease: (t: number) => number; }' is not assignable to type 'Partial<AnimationConfig> | ((key: "projectionMatrix") => Partial<AnimationConfig>)'.
Object literal may only specify known properties, and 'ease' does not exist in type 'Partial<AnimationConfig> | ((key: "projectionMatrix") => Partial<AnimationConfig>)'.ts(2322)
props.d.ts(167, 5): The expected type comes from property 'config' which is declared here on type 'ControllerUpdate<{ projectionMatrix: number[]; }, undefined>'
Other config props that I have tried are working as expected.

Expected Behaviour
If I use the same config in the useSpring hook it works as expected.
import { easings, useSpring } from 'react-spring';
const Camera = () => {
const [, animation] = useSpring(() => ({
from: { projectionMatrix: [] as number[] },
to: { projectionMatrix: [] as number[] },
config: {
precision: 0.0001,
duration: 1000,
ease: easings.easeOutExpo,
},
}));
}
Link to repo
NA
am i mistaken, or should the property be easing in both cases?
Yep it should be easing not ease