We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
result
In changes my WIT definition from:
create-program: func(options: compiler-options) -> program;
to return a result:
create-program: func(options: compiler-options) -> result<program, string>;
but the generated .d.ts from bunx jco types wit -o . still has:
.d.ts
bunx jco types wit -o .
export function createProgram(options: CompilerOptions): Program;
I was hoping that it would show up as:
export function createProgram(options: CompilerOptions): Result<Program, string>;
I'm not exactly sure where Result would be defined, but I see a it defined a couple of times in preview-2shim as:
Result
export type Result<T, E> = { tag: 'ok', val: T } | { tag: 'err', val: E };
The text was updated successfully, but these errors were encountered:
Just like top-level optionals become possibly nullish, top-level results utilize the JS error itself.
So if you want to create an error result you can do throw 'error-string'.
throw 'error-string'
We could possibly have a customization option to turn this off, but it's also useful to be able to interop with JS error handling paths.
We should also have proper documentation of the type conversions like this, this is still tracking in #418.
Sorry, something went wrong.
No branches or pull requests
In changes my WIT definition from:
to return a
result
:but the generated
.d.ts
frombunx jco types wit -o .
still has:I was hoping that it would show up as:
I'm not exactly sure where
Result
would be defined, but I see a it defined a couple of times in preview-2shim as:The text was updated successfully, but these errors were encountered: