fix `motify()` type definition conflict for `transition` prop
Moti takes over the transition prop to define transition configs, but this might conflict with existing transition props on the original component.
While the implementation simply ignores passing transition to the original component, the type definition tries to merge the type declaration for both props, which sometimes results in impossible type intersections.
This change removes that possibility by omitting any keyof MotiProps from the component's original prop definition.
The latest updates on your projects. Learn more about Vercel for Git ↗︎
| Name | Status | Preview | Comments | Updated (UTC) |
|---|---|---|---|---|
| moti | ❌ Failed (Inspect) | Dec 13, 2024 10:40am |
This should also solve https://github.com/nandorojo/moti/issues/343
Looks reasonable, I assume this fixed it for you?
It does sometimes but I keep running into a TypeScript limitation TS2590: Expression produces a union type that is too complex to represent.
I'm not sure what the best approach to resolving performance issues is.
What if you just manually omit transition?
It still causes the type to blow up in complexity. I can't say for sure, but I think using Omit on Props in general is causing the issue.
In my experience that wouldn't quite be what causes it to blow up, more likely the depth of transition...for example if we removed the generic on the transition prop I wonder what would happen
Also is this the latest TS version
Thanks for digging in btw
I'm not on the latest TypeScript but on a pretty late version 5.3.3.
I think the problem originates from newer react-native and react-native-reanimated versions. I wonder if upgrading those + TypeScript in the moti repo would fix it.
Wrapping other dependencies and their types can be tough...
When I have time, I'd be happy to explore this more.