-
Notifications
You must be signed in to change notification settings - Fork 1
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
Feat/typescript d #15
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this would make this a little nicer.
* A function that will be called with an error that may be thrown | ||
* This function may return a promise | ||
*/ | ||
type ErrorHandler = (error: Error) => any |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The return type of this should be void
no?
* (ie. node and script name are not passed) | ||
* This function may return a promise | ||
*/ | ||
type AsyncMain = (...args: string[]) => any |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The return type of this should be void
no?
* If you don't provide an error handler a default one will be used which merely logs the error | ||
* using `console.error()` | ||
*/ | ||
declare function am(main: AsyncMain, errorHandler?: ErrorHandler): Promise<ReturnType<AsyncMain>>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should just be Promise<void>
since AsyncMain
's return type doesn't change.
@userpixel looks good, just had a few comments. |
A simplified version of #13 which doesn't rewrite the codebase