Quick fix for yarn type:generate command failing#2908
Merged
Conversation
piaskowyk
approved these changes
Feb 2, 2022
yiheyang
pushed a commit
to yiheyang/taro-reanimated
that referenced
this pull request
Feb 3, 2022
## Description `InterpolateConfig` interface is [declared here](https://github.com/software-mansion/react-native-reanimated/blob/7820ec095de7a719150dc5021561f0b8b0b10f38/src/reanimated2/Colors.ts#L768-L773) as follows: ```ts export interface InterpolateConfig { inputRange: readonly number[]; outputRange: readonly (string | number)[]; colorSpace: ColorSpace; cache: SharedValue<InterpolateRGB | InterpolateHSV>; // <-- Shared value of non-null type! } ``` few lines below it is being used: ```ts export function useInterpolateConfig( inputRange: readonly number[], outputRange: readonly (string | number)[], colorSpace = ColorSpace.RGB ): SharedValue<InterpolateConfig> { return useSharedValue({ inputRange, outputRange, colorSpace, cache: makeMutable(null), // <-- returns shared value of null type }); } ``` This caused `yarn type:generate` command to fail (it is launched by `createNPMPackage` script):  ## Changes * Modify `InterpolateConfig` interface, so `cache` is of type: `SharedValue<InterpolateRGB | InterpolateHSV | null>` ```ts export interface InterpolateConfig { inputRange: readonly number[]; outputRange: readonly (string | number)[]; colorSpace: ColorSpace; cache: SharedValue<InterpolateRGB | InterpolateHSV | null>; } ``` ## Test code and steps to reproduce Run ``` yarn type:generate ``` and see it fails ## Checklist - [x] Included code example that can be used to test this change - [x] Updated TS types - [ ] Added TS types tests - [ ] Added unit / integration tests - [ ] Updated documentation - [ ] Ensured that CI passes
aeddi
pushed a commit
to aeddi/react-native-reanimated
that referenced
this pull request
Mar 22, 2022
## Description `InterpolateConfig` interface is [declared here](https://github.com/software-mansion/react-native-reanimated/blob/7820ec095de7a719150dc5021561f0b8b0b10f38/src/reanimated2/Colors.ts#L768-L773) as follows: ```ts export interface InterpolateConfig { inputRange: readonly number[]; outputRange: readonly (string | number)[]; colorSpace: ColorSpace; cache: SharedValue<InterpolateRGB | InterpolateHSV>; // <-- Shared value of non-null type! } ``` few lines below it is being used: ```ts export function useInterpolateConfig( inputRange: readonly number[], outputRange: readonly (string | number)[], colorSpace = ColorSpace.RGB ): SharedValue<InterpolateConfig> { return useSharedValue({ inputRange, outputRange, colorSpace, cache: makeMutable(null), // <-- returns shared value of null type }); } ``` This caused `yarn type:generate` command to fail (it is launched by `createNPMPackage` script):  ## Changes * Modify `InterpolateConfig` interface, so `cache` is of type: `SharedValue<InterpolateRGB | InterpolateHSV | null>` ```ts export interface InterpolateConfig { inputRange: readonly number[]; outputRange: readonly (string | number)[]; colorSpace: ColorSpace; cache: SharedValue<InterpolateRGB | InterpolateHSV | null>; } ``` ## Test code and steps to reproduce Run ``` yarn type:generate ``` and see it fails ## Checklist - [x] Included code example that can be used to test this change - [x] Updated TS types - [ ] Added TS types tests - [ ] Added unit / integration tests - [ ] Updated documentation - [ ] Ensured that CI passes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
InterpolateConfiginterface is declared here as follows:few lines below it is being used:
This caused
yarn type:generatecommand to fail (it is launched bycreateNPMPackagescript):Changes
InterpolateConfiginterface, socacheis of type:SharedValue<InterpolateRGB | InterpolateHSV | null>Test code and steps to reproduce
Run
and see it fails
Checklist