Closed iskhakgoodmans closed 6 months ago
everything typescript i would need your help, im not good enough to get types right myself.
@drcmda I looked into the types for fiber and drei, and we might need to add more generic types. Will take out some time and try to raise a PR.
But for the time being, a patch could be using as unkown
type coercion. Not ideal, but atleast types won't be broken when generating the file.
const { nodes, materials, animations } = useGLTF("/path") as unknown as GLTFResult
Edit: Also raised a quick PR to patch this: https://github.com/pmndrs/gltfjsx/pull/173
Actually I think this solution is better for this https://github.com/pmndrs/gltfjsx/issues/101#issuecomment-1363432531 does it solve your problem?
This is fixed in Drei since https://github.com/pmndrs/drei/releases/tag/v9.89.1.
three
version: 0.146.0@react-three/fiber
version: 8.9.1@react-three/drei
version: 9.43.3node
version: v14.18.2npm
version: 7.5.6Problem description:
After creating the
tsx
file fromglb
file usinggltfjsx
tool, there was an error with types inuseGTLF
hook.Relevant code:
Here is an example of code in codesandbox (sandbox based on this).