brianzinn / react-babylonjs

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

Observables Strong Typing #258

Closed dennemark closed 1 month ago

dennemark commented 1 year ago

As mentioned in a discussion, this issue should keep track of adding stronger typings to observables.

Original discussion:

Is my assumption right, that observables are updated properly?

https://github.com/brianzinn/react-babylonjs/blob/daa6605d1702f282365d797a7b1ab3bc0cb89db8/packages/react-babylonjs/src/UpdateInstance.ts#L54

When writing it as property, it is missing proper typing though. Would this be easy to solve? Image shows typing when getting pointerDragBehaviour via create and the missing types when it is set as prop.

image

Originally posted by @dennemark in https://github.com/brianzinn/react-babylonjs/discussions/255

brianzinn commented 1 month ago

Right now I just put any as the type. No plans currently to implement. It would require more work in the code-gen to link directly to the types themselves. It's not an insane amount of work, but ts-morph can be time consuming to debug. Since nobody has requested this before I am going to close this issue, but if it's important then open his up as a feature request and I can look at making some time there to add more type-safety across observables and perhaps some other "any" props.