Skip to content

Conversation

@hannojg
Copy link
Contributor

@hannojg hannojg commented Jan 29, 2026

Summary

Warning

100% vibe coded. Let me know if you feel like this needs any human changes somewhere! So far from my tests this seems to work fine!

When using createAnimatedComponent with useAnimatedProps, props that are provided through animatedProps now become optional on the component itself.

This fixes the TypeScript error where required props would still be required on the component even when they were being provided via animatedProps.

Example:

interface ViewProps {
  requiredBorderRadius: number;
}
function MyComp(props: ViewProps) {}
const AnimatedComp = Animated.createAnimatedComponent(MyComp);

const animatedProps = useAnimatedProps(() => ({
  requiredBorderRadius: sharedValue.get()
}));

// Previously errored, now works correctly
<AnimatedComp animatedProps={animatedProps} />

Changes:

  • AnimatedProps<Props, AP> now takes optional second type parameter
  • useAnimatedProps preserves exact return type for better inference
  • AnimatedComponentType uses overloads to infer animatedProps type
  • Added AnimatedPropsWithInference helper type

Test plan

I let the AI add test cases to verify this is working correctly.

When using createAnimatedComponent with useAnimatedProps, props that are
provided through animatedProps now become optional on the component itself.

This fixes the TypeScript error where required props would still be required
on the component even when they were being provided via animatedProps.

Example:
```tsx
interface ViewProps {
  requiredBorderRadius: number;
}
function MyComp(props: ViewProps) {}
const AnimatedComp = Animated.createAnimatedComponent(MyComp);

const animatedProps = useAnimatedProps(() => ({
  requiredBorderRadius: sharedValue.get()
}));

// Previously errored, now works correctly
<AnimatedComp animatedProps={animatedProps} />
```

Changes:
- AnimatedProps<Props, AP> now takes optional second type parameter
- useAnimatedProps preserves exact return type for better inference
- AnimatedComponentType uses overloads to infer animatedProps type
- Added AnimatedPropsWithInference helper type

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant