Skip to content

Usage with hxtsdgen #91

@fullofcaffeine

Description

@fullofcaffeine

I currently have a fork of hxgenjs that integrates hxdtsgen (plan to submit a PR soon) to generate more complete d.ts files for each of the generated js classes. I'm using those to consume Haxe classes from TS. See: https://community.haxe.org/t/gist-sample-ts-haxe-bridge-fullstack-app-using-hxgenjs/1704 and https://github.com/haxe-boilerplate/pwa-ts-haxe-sample.

  1. I'm wondering if haxe-modular would work well with hxdtsgen. I assume it would fail as the post-processor would not be aware of the main.d.ts file?

What I'd like to do is to experiment using haxe-modular with hxtsdgen, maybe through haxe-webpack-loader, and be able to do something like this:

import * as hx from "app.hxml"; 

// Have ts type hints here
var classFoo = new hx.package.ClassFoo()
var classBar = new hx.anotherpackage.ClassBar()

EDIT:
2) Also, as a side-question, hxgenjs allows me to transparently target nodejs and the browser, in fact, hxgenjs doesn't care about that, it just outputs the js files, and I separate them per package (client and server), see here: https://github.com/haxe-boilerplate/pwa-ts-haxe-sample/blob/master/build.hxml. Webpack then processes the client files and typescript does its job with the server files (ts and js files).

Would that be feasible to reproduce when using haxe-modular or is it only geared towards the browser only?

Any insights appreciated :)

Thanks in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions