firtoz / react-three-renderer-fiber

Porting R3R to use React Fiber
MIT License
94 stars 10 forks source link

Add lathe geometry #51

Closed johnmarinelli closed 6 years ago

johnmarinelli commented 6 years ago

I'm having a strange issue here - notice on line 24, I have to convert the points array from an array of Vector2's to Vector3's. According to the THREE.js docs, points is an array of Vector2. However, if I remove line 24, I get a compiler error:

ERROR in [at-loader] ./src/core/renderer/hostDescriptors/descriptors/geometries/latheGeometry.ts:25:7                                                                                
    TS2345: Argument of type 'Vector2[]' is not assignable to parameter of type 'Vector3[]'.                                                                                         
  Type 'Vector2' is not assignable to type 'Vector3'.                                                                                                                                
    Property 'z' is missing in type 'Vector2'. 

Do you have any insight into this? With line 24 it works, but it's kind of hacky. Also, changing the type from Array<THREE.Vector2> to Array<THREE.Vector3> on line 8 results in the expected type error.

Let me know what you think.

johnmarinelli commented 6 years ago

changed points to any type and removed line 24

toxicFork commented 6 years ago

Ah I didn't man to change the interface, you can just pass it in e.g. Func(someArg, otherArg as any, anotherArg), interface should still declare Vector2[] :)

On Sun, Jan 14, 2018, 13:26 John Marinelli notifications@github.com wrote:

changed points to any type and removed line 24

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/toxicFork/react-three-renderer-fiber/pull/51#issuecomment-357511810, or mute the thread https://github.com/notifications/unsubscribe-auth/AA0iLcvyLk8yE-_sZR0T9Feq7A1E-6l1ks5tKgB5gaJpZM4RdPKt .

johnmarinelli commented 6 years ago

ah, I see! no worries, fix soon

toxicFork commented 6 years ago

Cool :D