brianzinn / react-babylonjs

React for Babylon 3D engine
https://brianzinn.github.io/react-babylonjs/
817 stars 105 forks source link

Type errors for fromInstance and source props #101

Closed nturley closed 3 years ago

nturley commented 3 years ago

It looks like I'm getting props type errors for fromInstance, and source. The code executes just fine so I assume it's just a typing issue and not a functional issue.

Issue seems to be present in version 2.3.1 even though fromInstance support was added around 2.2.8 and instancedMesh was added around 2.2.7.

I'm guessing these props are missing from generatedProps.ts?

I'm happy to contribute a PR but I was having a hard time understanding how the codegen works. If you point me in the right direction, I could take a crack at it.

Screenshots

image image image

Minimal Example

https://stackblitz.com/edit/react-ts-wxuhxh?file=index.tsx

brianzinn commented 3 years ago

hi @nturley thanks for reporting. I think it's outside of the codegen. Type intersection on the props for each type with CustomProps is done, so it should have been added there and that should be cleaned up to be more restrictive actually :) https://github.com/brianzinn/react-babylonjs/blob/40412ad5056b51d96aef2386f2cd649d53d899f0/src/CreatedInstance.ts#L27

That will include it automatically in the JSX intrinsic elements everywhere :)