pmndrs / use-cannon

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

Export more types from hooks #113

Closed AlexHayton closed 4 years ago

AlexHayton commented 4 years ago

So that downstream projects can check against these types in their own code.

E.g.

import { usePlane, PlaneProps } from "use-cannon";

export const Plane: FunctionComponent<PlaneProps> = (props) => {
  const [ref] = usePlane(() => ({ mass: 0, ...props }));
  return (
    <mesh ref={ref} receiveShadow>
      {props.children}
    </mesh>
  );
}
AlexHayton commented 4 years ago

For now I've had to create a types.ts and duplicate a lot of the types from hooks.ts to get there... but if the types were simply exported this would be much easier and more maintainable in my project...

codynova commented 4 years ago

Looks good, we should have already been doing this. Merged and released in use-cannon@0.5.2