Skip to content

Commit

Permalink
fix: infer SpringValue types only from the from prop when it exists
Browse files Browse the repository at this point in the history
  • Loading branch information
dbismut committed Apr 2, 2021
1 parent 140038b commit eaf473f
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions packages/core/src/types/props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -314,10 +314,11 @@ export type PickAnimated<Props extends object, Fwd = true> = unknown &
: [object] extends [Props]
? Lookup
: ObjectFromUnion<
| FromValues<Props>
| (TransitionKey & keyof Props extends never
? ToValues<Props, Fwd>
: TransitionValues<Props>)
Props extends { from: infer From } // extract prop from the `from` prop if it exists
? ObjectType<From>
: TransitionKey & keyof Props extends never
? ToValues<Props, Fwd>
: TransitionValues<Props>
>)

/**
Expand All @@ -330,10 +331,3 @@ type ToValues<Props extends object, AndForward = true> = unknown &
? ForwardProps<[To] extends [object] ? To : Partial<Extract<To, object>>>
: never
: unknown)

/**
* Pick the values of the `from` prop.
*/
type FromValues<Props extends object> = ForwardProps<
Props extends { from?: infer From } ? ObjectType<From> : object
>

0 comments on commit eaf473f

Please sign in to comment.