Add TypeScript definitions with --types
masterUse the --types flag to generate a type-safe JSX component. This allows you to define a GLTFResult type that maps the nodes and materials from the GLTF file to specific Three.js types.
type GLTFResult = GLTF & {
nodes: { robot: THREE.Mesh; rocket: THREE.Mesh }
materials: { metal: THREE.MeshStandardMaterial; wood: THREE.MeshStandardMaterial }
}
export default function Model(props: JSX.IntrinsicElements['group']) {
const { nodes, materials } = useGLTF<GLTFResult>('/model.gltf')