Skip to content

Commit 6a64fa2

Browse files
committed
types: remove Readonly from "AnimationResult" type
But keep it readonly in the "OnRest" and "AsyncResult" types
1 parent 13c4fbd commit 6a64fa2

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

packages/core/src/runAsync.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { AnimationResult } from './types/animated'
1111
import { matchProp, DEFAULT_PROPS } from './helpers'
1212
import { PendingProps, SpringValue } from './SpringValue'
1313

14-
export type AsyncResult<T = any> = Promise<AnimationResult<T>>
14+
export type AsyncResult<T = any> = Promise<Readonly<AnimationResult<T>>>
1515

1616
export type RunAsyncProps<T = any> = unknown &
1717
Merge<

packages/core/src/types/animated.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,17 @@ export type OnStart<T = unknown> = (spring: SpringValue<T>) => void
2727
export type OnChange<T = unknown> = (value: T, source: SpringValue<T>) => void
2828

2929
/** Called once the animation comes to a halt */
30-
export type OnRest<T = unknown> = (result: AnimationResult<T>) => void
30+
export type OnRest<T = unknown> = (result: Readonly<AnimationResult<T>>) => void
3131

3232
/** The object passed to `onRest` props */
33-
export type AnimationResult<T = any> = Readonly<{
33+
export type AnimationResult<T = any> = {
3434
value: T
3535
spring?: SpringValue<T>
3636
/** When falsy, the animation did not reach its end value. */
3737
finished?: boolean
3838
/** When true, the animation was cancelled before it could finish. */
3939
cancelled?: boolean
40-
}>
40+
}
4141

4242
/** `SpringProps` without `to` or `from` */
4343
export interface AnimationProps<P extends string = string> {

0 commit comments

Comments
 (0)