Skip to content

Commit

Permalink
types: allow SpringValue<any[]> for animated arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
aleclarson committed Aug 16, 2019
1 parent 419119f commit 5ce760c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion targets/web/src/animated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,14 @@ type AnimatedStyle<T> = [T, T] extends [infer T, infer DT]
: [DT] extends [never]
? never
: DT extends object
? { [P in keyof DT]: AnimatedStyle<DT[P]> }
? AnimatedObject<DT>
: DT | AnimatedLeaf<T>
: never

type AnimatedObject<T extends object> =
| { [P in keyof T]: AnimatedStyle<T[P]> }
| (T extends ReadonlyArray<number | string> ? SpringValue<T> : never)

// An animated value that is not an object
type AnimatedLeaf<T> = [T] extends [object]
? never
Expand Down

0 comments on commit 5ce760c

Please sign in to comment.