You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Are TypeScript definitions generated by transpile supposed to include comments from the WIT file? #397
I found #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?
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.
I think I may just have run into this too, perhaps due to bytecodealliance/cargo-component#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?
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.
wasm-tools.exe component new ./target/wasm32-unknown-unknown/release/quarto.wasm -o ./dist/quarto.wasm
Transpile into JavaScript
npm run jco -- transpile ./dist/quarto.wasm -o dist/quarto-bindings --map math=./quarto-imports.js
At this point the resulting TypeScript interfaces are missing documentation comments. But if I run the types command seperatly, I can work around this...
Rebuild the types including documentation comments
npm run jco -- types wit/quarto.wit -o dist/quarto-bindings
Activity
guybedford commentedon Mar 9, 2024
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.
blaine-arcjet commentedon Mar 11, 2024
Interesting! I'm not getting any comments but the current stuff isn't open source. Let me create a reproduction.
sd2k commentedon Oct 10, 2024
I think I may just have run into this too, perhaps due to bytecodealliance/cargo-component#229? Is there any way of pointing
transpileto the original WIT file to get the comments back, since they're not included in the WASM right now?sd2k commentedon Oct 10, 2024
Huh, well I found a workaround: after running
jco transpileI can runjco typesand 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 adepsdirectory next to the main WIT file, too.oovm commentedon Dec 25, 2024
Missing comment
dgendill commentedon Oct 9, 2025
I'm also seem to be missing doc comments. Here's my workflow
Embed WIT into wasm file
Create a Web Assembly Component
Transpile into JavaScript
At this point the resulting TypeScript interfaces are missing documentation comments. But if I run the
typescommand seperatly, I can work around this...Rebuild the types including documentation comments
I'm on jco 1.15 and wasm-tools 1.239.0