I recently cloned the code of a very cool mineraft game built with react and three-fiber.
I’m currently trying to transition the original js code into typescript but I’m failing miserably to make the compiler undertand the import of this class from the three/examples/jsm folder.
while it works perfectly with JS, it breaks miserably in my typescript version…
// ...
import { PointerLockControls as PointerLockControlsImpl } from 'three/examples/jsm/controls/PointerLockControls';
extend({ PointerLockControlsImpl });
export const FPVControls = (props) => {
const { camera, gl } = useThree();
const controls = useRef();
//..
return (
<pointerLockControlsImpl
ref={controls}
args={[camera, gl.domElement]}
{...props}
/>
Would anyone know how to properly import classes from this /examples folder into a typescript react app?