mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
7b86fa2b79
Summary: Changelog: [General][Fixed] - Improved Flow type inference in Animated `.interpolate()` Improves the ergonomics of `.interpolate()` by allowing Flow to infer the correct type for `outputRange`. This is achieved by adding a new type parameter `OutputT` to `interpolate()` (and `Animated.Interpolation` and `InterpolationConfigType`), which Flow infers as either `number` or `string` based on usage. Admittedly, at the call site, this is not that much safer compared to something like `outputRange: $ReadOnlyArray<number | string>`, but it does document the intent of the API a bit better and provide some downstream type safety. For example, we can now express `Animated.Number` (D35869375) more precisely by excluding string-valued interpolation nodes. Reviewed By: javache Differential Revision: D35869725 fbshipit-source-id: e03ec22e9b3368ee196b392af011062ac99d8bb9