jco icon indicating copy to clipboard operation
jco copied to clipboard

Are TypeScript definitions generated by transpile supposed to include comments from the WIT file?

Open blaine-arcjet opened this issue 11 months ago • 4 comments

I found https://github.com/bytecodealliance/jco/pull/94 which fixed the TypeScript generation and it mentions comments, but I can't seem to get the comments I defined in my .wit file to actually show up when I use jco transpile. Is this something that is supported?

blaine-arcjet avatar Mar 07 '24 19:03 blaine-arcjet

Yes TypeScript output includes the comments from WIT. If you have an example of what specific doc comments are being missed in translation that would be great to track.

guybedford avatar Mar 09 '24 02:03 guybedford

Interesting! I'm not getting any comments but the current stuff isn't open source. Let me create a reproduction.

blaine-arcjet avatar Mar 11 '24 15:03 blaine-arcjet

I think I may just have run into this too, perhaps due to https://github.com/bytecodealliance/cargo-component/issues/229? Is there any way of pointing transpile to the original WIT file to get the comments back, since they're not included in the WASM right now?

sd2k avatar Oct 10 '24 21:10 sd2k

Huh, well I found a workaround: after running jco transpile I can run jco types and point it at the original WIT file to get the types with doc comments. For anyone finding this, if you have imports you'll need to add the corresponding WIT files to a deps directory next to the main WIT file, too.

sd2k avatar Oct 10 '24 21:10 sd2k