Closed ctaggart closed 1 day ago
Code is here: https://github.com/cataggar/StarlingMonkey15/tree/jco530
User error. I needed to pass the wit
directory.
~/ms/StarlingMonkey15> bunx jco types --help
Usage: jco types <wit-path> -o <out-dir>
Generate types for the given WIT
Arguments:
wit-path path to a WIT file or directory
Options:
--name <name> custom output name
-n, --world-name <world> WIT world to generate types for
-o, --out-dir <out-dir> output directory
--tla-compat generates types for the TLA compat output with an async $init promise export
-I, --instantiation [mode] type output for custom module instantiation (choices: "async", "sync", preset: "async")
-q, --quiet disable output summary
--feature <feature> enable one specific WIT feature (repeatable) (default: [])
--all-features enable all features
-h, --help display help for command
~/ms/StarlingMonkey15> bunx jco types wit/deps/wasi-filesystem-0.2.2/package.wit -o cowsay/src --verbose
error: unknown option '--verbose'
~/ms/StarlingMonkey15> bunx jco types wit -o cowsay/src
Generated Type Files:
- cowsay/src/interfaces/canvas.d.ts 0.32 KiB
- cowsay/src/interfaces/wasi-clocks-wall-clock.d.ts 0.19 KiB
- cowsay/src/interfaces/wasi-filesystem-types.d.ts 20.8 KiB
- cowsay/src/interfaces/wasi-io-error.d.ts 0.41 KiB
- cowsay/src/interfaces/wasi-io-poll.d.ts 1.36 KiB
- cowsay/src/interfaces/wasi-io-streams.d.ts 9.01 KiB
- cowsay/src/wit.d.ts
It would be nice if the wit
directory exists, may be just default to use it. So jco types
would do the equivelent of what jco types wit -o .
does now.
@ctaggart that could be a sensible default actually, basically just if no --wit
arg is provided assume wit
. Would you consider posting a PR?
I need to use the filesystem from my JavaScript component, so I'm trying to import it in
wit/cowsay.wit
:I run
wkg wit fetch
and it downloads the definitions.I then tried to use
jco types
to generate TypeScript types for wasi-filesystem, but here is the error: