creativelifeform / three-nebula

WebGL based particle system engine for three.js
https://three-nebula.org/
MIT License
937 stars 76 forks source link

Typescript Support? #179

Open tvytlx opened 3 years ago

rohan-deshpande commented 3 years ago

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

alexpineda commented 2 years ago

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.

vitalymind commented 2 years ago

Any progress on adding types?

murl-digital commented 1 year ago

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 commented 1 year ago

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

Cosmitar commented 1 year ago

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.