Closed Antriel closed 2 years ago
This is more of an oversight. The Haxe compiler supplies comments for generation if they start with /**
and in case of anonymous types only in their "long form". But they were not being generated for typedefs and anonymous types. I just fixed the generation in fcbd3cd2638bc9d30392213df0a820dfe29bd969, so this should work (although the formatting could use some work):
// slash-slash comments are ignored
typedef A = {
/** this won't end up in the generated files either, it's the "short" notation */
prop: String
}
/** this should be there */
typedef B = {
/** and this */
var prop: String;
}
That was fast! I knew about the Haxe issues, and your fix does export the comments successfully, but VSCode doesn't show me the documentation.
I think the issue is that VSCode doesn't look into type
for documentation, so having
export type Config = {id?: null | string, name?: null | string, /**
Defaults to the last instanced project.
*/
project?: null | Project}
won't help here. Which brings me back to the idea of generating interfaces instead of type
declarations.
This would seem to be caused by the formatting issues :) With proper newlines (102ac271119a5884d5f47c1582bb75f036f71f32) typescript picks up the comments
Awesome, that works, thanks! :)
I have a Haxe
typedef
, which exports as TS'stype = { ... }
, which is great, but that format doesn't seem to support comment docs.I could change my Haxe
typedef
to aninterface
(as long as I don't actually use it from Haxe, as I want to keep using it as anonymous object). But then I lose@:optional
. Which could be fixed by adding?
, forNull<T>
types, to the name in the generated d.ts files.Possibly better approach would be to (optionally?) generate correct interfaces directly for Haxe's
typedef
. Would that make sense, or am I missing something?