Rich-Harris / svelte-cubed

Svelte ❤️ Three
svelte-cubed.vercel.app
MIT License
1.19k stars 76 forks source link

Type 'Material | Material[]' is not assignable to type 'Material'. #34

Open tonyketcham opened 2 years ago

tonyketcham commented 2 years ago

three.js meshes can accept an array of materials, but the svelte-cubed Mesh wrappers are typed to only allow a single one.

Passing an array of materials to an SC.Mesh works, for example, but throws a type error.

Myrmod commented 2 years ago

I created a small fix in my cloned repository: https://github.com/Myrmod/svelte-cubed/blob/mesh-material-typing/src/lib/components/objects/Mesh.svelte#L10

Can you check if this would solve the issue for you? For me it did.

Best regards

Joxtacy commented 2 years ago

I created a small fix in my cloned repository: https://github.com/Myrmod/svelte-cubed/blob/mesh-material-typing/src/lib/components/objects/Mesh.svelte#L10

Can you check if this would solve the issue for you? For me it did.

Best regards

Maybe you can submit a pull request with this fix? :) I'm sure a lot of people would be happy.

Myrmod commented 2 years ago

I might if the repository is being actively developed again. For now I focus on svelte-babylon.