pmndrs / gltfjsx

🎮 Turns GLTFs into JSX components
https://gltf.pmnd.rs
MIT License
4.5k stars 293 forks source link

[BUG] Wrong call to useGLTF when using the --types flag #48

Closed AndrewPrifer closed 3 years ago

AndrewPrifer commented 3 years ago

With the --types flag, gltfjsx generates code that calls useGLTF like this:

const { nodes, materials } = useGLTF<GLTFResult>('/stuff.gltf');

This is incorrect because useGLTF accepts 0 type arguments. The fix is either to modify useGLTF to accept a GLTF-compatible type argument, or to modify the call to the following:

const { nodes, materials } = useGLTF('/stuff.gltf') as GLTFResult;
drcmda commented 3 years ago

would you make a pr for this?

AndrewPrifer commented 3 years ago

@drcmda sure, for the second solution?

drcmda commented 3 years ago

i have no informed opinions about either, pick what you think is best for all.

AndrewPrifer commented 3 years ago

Alright, I like the second solution better, if there is a language feature for it, let's use it :)