Open
Description
The following wit
package example:example;
world component {
export foo: func(res: result<string, string>);
}
Produces the following types when used to generate guest-types (though the problem also applies to host types)
declare module 'example:example/component' {
export function foo(res: Result<string, string>): void;
}
The problem here is that there is no definition for the Result type.
When doing the same with an interface
package example:example;
interface foo {
foo: func(res: result<string, string>);
}
world component {
export foo;
}
The generated types are valid and include an inline definition of result
declare module 'example:example/foo' {
export function foo(res: Result<string, string>): void;
export type Result<T, E> = { tag: 'ok', val: T } | { tag: 'err', val: E };
}