react-three-renderer-fiber icon indicating copy to clipboard operation
react-three-renderer-fiber copied to clipboard

Auto-generating descriptors from @types/three .d.ts files?

Open johnrees opened this issue 7 years ago • 6 comments

I think you might be able to generate descriptors (or anything really) by walking the AST of the @types/three .d.ts files. They'll probably still need extra 'human work' but maybe it could be a good starting point?

This is an extremely fragile proof of concept that can quickly spit out files like https://github.com/johnrees/three-parser/blob/master/descriptors/geometries/sphereGeometry.ts. Its current major shortcomings are -

  • it doesn't yet recursively look for parent classes or shared interfaces etc
  • I'm cheating by using a static template rather than generating proper Typescript with the Typescript compiler

What do you think @toxicFork? Would it be useful if I worked on this?

johnrees avatar Oct 25 '17 18:10 johnrees

I also had a very quick look at extracting properties from the docs html, but there are some inconsistencies because they're manually curated https://github.com/johnrees/three-docs-parser/blob/master/index.js

johnrees avatar Oct 25 '17 18:10 johnrees

This is awesome!!

On Wed, Oct 25, 2017, 19:04 John Rees [email protected] wrote:

I also had a very quick look at extracting properties from the docs html, but there are some inconsistencies because they're manually curated https://github.com/johnrees/three-docs-parser/blob/master/index.js

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/toxicFork/react-three-renderer-fiber/issues/36#issuecomment-339417979, or mute the thread https://github.com/notifications/unsubscribe-auth/AA0iLQOqV6abgz7c-X3MyEGDMC-ZMwuGks5sv3fBgaJpZM4QGafP .

toxicFork avatar Oct 25 '17 18:10 toxicFork

And yes it'd be very useful to work on this. Let's do that together? :)

toxicFork avatar Oct 26 '17 02:10 toxicFork

Fantastic, yes that would be great! Not sure the best way to tackle this but I started a PR with some info here https://github.com/toxicFork/react-three-renderer-fiber/pull/38/commits/0569dda386b8714ac841730bda01988a9e37f56f#diff-370a1a3a7683bd722dc6d74ff5984f61

I guess it makes sense to keep the work in the main repository. Although it should go to a new topic branch rather than master https://github.com/toxicFork/react-three-renderer-fiber/pull/38

johnrees avatar Oct 26 '17 10:10 johnrees

The README is garbage and probably doesn't make a great deal of sense haha I was just spewing out what was in my head 😬

johnrees avatar Oct 26 '17 10:10 johnrees

Great work :) I'm going to take a break for a few days but when I come back this is the first thing I'll look at!

toxicFork avatar Oct 26 '17 11:10 toxicFork