Skip to content
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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Feat/typescript d #15

wants to merge 2 commits into from

Conversation

alexewerlof
Copy link
Owner

A simplified version of #13 which doesn't rewrite the codebase

Copy link

@OmgImAlexis OmgImAlexis left a 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

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

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>>;

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.

@OmgImAlexis
Copy link

@userpixel looks good, just had a few comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants