-
-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
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
Return typings of TaskCalback require an async task to either always succeed or always fail #22
Comments
This issue has been marked as stale because it has been inactive for more than 21 days. Please reopen if you still need help on this issue |
Can you please create a PR to fix the return type? |
mini-bomba
added a commit
to mini-bomba/cliui
that referenced
this issue
Mar 11, 2025
7 tasks
sure, created #23 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Package version
6.4.2
Describe the bug
The current typings of TaskCallback require that a promise either always returns
string
or always returns{ isError: true; message: string; }
.This basically means that any async task submitted to the task manager cannot sometimes succeed or sometimes fail without an error thrown - it must always either return a string on an error object, it cannot return an union type of both options. This unnecessarily limits the possibilities for TS users in a way that simply does not make sense.
A simple script that shows the issue (using deno for simplicity of setup, but it can also be reproduced in node with typescript)
Typechecking with
deno check
(...or typescript LSP, or tsc) fails with the following errorReproduction repo
No response
The text was updated successfully, but these errors were encountered: