three-nebula icon indicating copy to clipboard operation
three-nebula copied to clipboard

Typescript Support?

Open tvytlx opened this issue 3 years ago • 6 comments

tvytlx avatar Sep 01 '21 03:09 tvytlx

Would happily accept PRs for this, I will not have the time.

rohan-deshpande avatar Sep 01 '21 05:09 rohan-deshpande

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.

alexpineda avatar Feb 17 '22 19:02 alexpineda

Any progress on adding types?

vitalymind avatar Jun 30 '22 06:06 vitalymind

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.

murl-digital avatar Jan 01 '23 09:01 murl-digital

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

murl-digital avatar Jan 01 '23 16:01 murl-digital

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.

Cosmitar avatar Feb 22 '23 14:02 Cosmitar