import { FluidValue, deprecateInterpolate } from '@react-spring/shared' import { Constrain, OneOrMore, Animatable, ExtrapolateType, InterpolatorConfig, InterpolatorFn, } from '@react-spring/types' import { Interpolation } from './Interpolation' /** Map the value of one or more dependencies */ export const to: Interpolator = (source: any, ...args: [any]) => new Interpolation(source, args) /** @deprecated Use the `to` export instead */ export const interpolate: Interpolator = (source: any, ...args: [any]) => ( deprecateInterpolate(), new Interpolation(source, args) ) /** Extract the raw value types that are being interpolated */ export type Interpolated> = { [P in keyof T]: T[P] extends infer Element ? Element extends FluidValue ? U : Element : never } /** * This interpolates one or more `FluidValue` objects. * The exported `interpolate` function uses this type. */ export interface Interpolator { // Tuple of parent values , Output>( parents: Input, interpolator: (...args: Interpolated) => Output ): Interpolation // Single parent value ( parent: FluidValue | Input, interpolator: InterpolatorFn ): Interpolation // Interpolation config ( parents: OneOrMore, config: InterpolatorConfig ): Interpolation> // Range shortcuts ( parents: OneOrMore> | FluidValue, range: readonly number[], output: readonly Constrain[], extrapolate?: ExtrapolateType ): Interpolation> }