feathersui-openfl icon indicating copy to clipboard operation
feathersui-openfl copied to clipboard

Any plans to generate TypeScript types definitions?

Open CrazyFlasher opened this issue 2 years ago • 5 comments

I love Feathers since early Starling versions. Using openfl haxe version for some pet-projects. Currently looking forward to do some frontend stuff with TypeScript and it would be cool if there is a TS version of Feathers (I see, that there is a repo with JS version)

CrazyFlasher avatar Feb 06 '22 21:02 CrazyFlasher

I would like to create type definitions for TypeScript, which could be used with the JS build, but I need to find a way to generate them automatically. I have not had time to figure that out yet.

joshtynjala avatar Feb 07 '22 17:02 joshtynjala

There are basically two libs available:

  • https://lib.haxe.org/p/hxtsdgen/ - this will produce definitions.
  • https://lib.haxe.org/p/genes/ - this will generate Haxe modules as ES6 modules and definitions as well. If you go all in with TS/JS tooling, this might be a better fit. You can compile the whole library (without DCE) and then your bundler will do treeshaking and what not.

back2dos avatar Feb 09 '22 06:02 back2dos

I played around a bit with Genes a couple of weeks ago because I wanted to see if I could use dynamic imports to achieve code splitting, but I was having some difficulty getting a basic OpenFL hello world app working. I found that I had to manually adjust one of the JS files generated by Genes because it was putting imports in an invalid location. Even after I manually fixed that, I was having trouble figuring out the startup sequence for Lime/OpenFL when using an ES module context. I think that I was mixing calls to global script context with calls to things in a module context, and I hadn't quite figured out how to stay entirely in the module context. I plan to give it a try again eventually.

Note that I was not trying to use any kind of bundler. I figured that it would be easier to start testing with raw ES modules, and then add a bundler later.

joshtynjala avatar Feb 09 '22 16:02 joshtynjala

Hi Josh, any news on this?

We're considering Feathers UI for a web game, but we're bothered by many external libs. So we thought using TypeScript or even pure JS. OpenFL allows it, but not Feathers right?

alamboley avatar Jul 27 '22 09:07 alamboley

@alamboley There are no TypeScript definitions, but you can use pure JS with the npm package:

https://www.npmjs.com/package/feathersui-openfl

Note that OpenFL on npm hasn't been updated since 8.9.6, so it won't have the latest features and bug fixes. Hopefully, we can get an updated npm OpenFL release in the future. However, there are some issues that need to be resovled first.

joshtynjala avatar Jul 27 '22 14:07 joshtynjala