three-nebula
three-nebula copied to clipboard
Typescript Support?
Would happily accept PRs for this, I will not have the time.
There are packages that use the jsdoc to create types. eg. https://github.com/abalabahaha/eris
https://www.typescriptlang.org/docs/handbook/declaration-files/dts-from-js.html
I'll play around with this later as I'd like to use nebula in my TS project in the near future.
Any progress on adding types?
i sat down to take a look at this (i have my own project which would benefit from having type declarations). from what i can tell so far is there's potentially a lot of work in store to appease the compiler. i'll probably have an update soon with what i've done.
alrght, here's where i'm at:
i attempted to generate types with just jsdocs and leaving everything unmodified, and there were problems. specifically, src/zone/SphereZone
and src/debug/Debug
, both of which stemming from typescript getting fussy over imports. this is also the case if i run against the build. the best way i can think of solving this is just converting everything to typescript which is relatively easy to do. while poking around i did notice some strangeness going on with core/three, as the types pulled from there aren't being read properly due to how properties are being declared. i also do think it's worth discussing including three as a dependency and using treeshaking to only import what we need
Hi! It seems this fork has types (https://github.com/creativelifeform/three-nebula/commit/58c81437796ae1c2cf1028c23bd75f9eb898843b). I've just installed it as a dependency from my package.json, apparently it works fine and the types are properly displayed in the IDE.