pmndrs / use-cannon

👋💣 physics based hooks for @react-three/fiber
https://cannon.pmnd.rs
2.76k stars 155 forks source link

[TypeScript] Improve set and subscribe API #285

Closed bjornstar closed 3 years ago

bjornstar commented 3 years ago

There is a very small functional change here where we pass the type of the subscription back from the worker with the result.

This allows us to be certain of the type of the value that will be passed to the callback.

Would love some help with the final piece of the puzzle, getting TypeScript to accept actually calling the callback.

vercel[bot] commented 3 years ago

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/pmndrs/use-cannon/AAg4avCehFogKuwtFSy4E53jtYEX
✅ Preview: https://use-cannon-git-fork-bjornstar-subscribe-any-pmndrs.vercel.app