Above error is gone since abandoning aforementioned React tooling. To avoid clutter, I will recycle this thread.
The TypeScript interface files generated by jco's transpiler include things like:
export namespace MyNamespaceStuffMyComponent {
export { MyResourceType };
}
export class MyResourceType {
...
}
When I import this file, I see errors. E.g., with Parcel
@parcel/transformer-js: ESM-style module declarations are not permitted in a namespace.
A quick search suggests the above TypeScript code is indeed invalid. Have I missed anything?
Hey Leon -- glad you were able to solve some issues with the webpack setup!
I think it's worth filing a bug for that on the jco with an example WIT interface and how you were planning on using it.
As far as building components, rollup has been used successfully before to put stuff together
There's also the new jco guest-types
command, that will specifically not generate a namespace but rather a declare module
statement
I think it's worth filing a bug for that on the jco with an example WIT interface and how you were planning on using it.
will do, although I still think I'm missing something since this makes it impossible for me to transpile any non-trivial components and I think this issue should have come up long before
As far as building components, rollup has been used successfully before to put stuff together
Interesting. I also tried bundling using Vite, which runs into a Rollup error for presumably the same reason.
Interesting -- here's an example that hopefully should help:
https://github.com/wasmCloud/typescript/tree/main/examples/components/http-password-checker
Full disclosure I work for Cosmonic which develops CNCF wasmCloud, but I made that repo as an example of how components should work with node based resolution, TS, and bundling
It doesn't have the nice new jco guest-types
usage yet, so it's actually still using namespaces (awkwardly), but hopefully it's a reasonable starting point.
Looks like a good example, thanks! I will have a closer look hopefully soon.
Last updated: Feb 27 2025 at 23:03 UTC