pmndrs / gltfjsx

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

"Conversion of type 'GLTF' to type 'GLTFResult' may be a mistake because neither type sufficiently overlaps with the other" #113

Closed TranquilMarmot closed 2 years ago

TranquilMarmot commented 2 years ago

TypeScript is throwing an error on this line:

const { nodes, materials } = useGLTF('/test.glb') as GLTFResult
Conversion of type 'GLTF' to type 'GLTFResult' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
  Type 'import("/home/nate/three-test/node_modules/.pnpm/three-stdlib@2.4.2_three@0.132.2/node_modules/three-stdlib/loaders/GLTFLoader").GLTF' is not comparable to type 'import("/home/nate/three-test/node_modules/.pnpm/@types+three@0.132.1/node_modules/@types/three/examples/jsm/loaders/GLTFLoader").GLTF'.
    Types of property 'parser' are incompatible.
      Property 'createNodeMesh' is missing in type 'import("/home/nate/three-test/node_modules/.pnpm/three-stdlib@2.4.2_three@0.132.2/node_modules/three-stdlib/loaders/GLTFLoader").GLTFParser' but required in type 'import("/home/nate/three-test/node_modules/.pnpm/@types+three@0.132.1/node_modules/@types/three/examples/jsm/loaders/GLTFLoader").GLTFParser'.ts(2352)
GLTFLoader.d.ts(108, 5): 'createNodeMesh' is declared here.
drcmda commented 2 years ago

needs someone with typescript knowledge to fix. what would the correct type be?