Skip to content

Update act type signature#2444

Merged
JoviDeCroock merged 1 commit intopreactjs:masterfrom
ddayguerrero:define-promise-types-for-act
Apr 8, 2020
Merged

Update act type signature#2444
JoviDeCroock merged 1 commit intopreactjs:masterfrom
ddayguerrero:define-promise-types-for-act

Conversation

@ddayguerrero
Copy link
Copy Markdown
Contributor

What am I trying to achieve?

Resolves #2441

Updating act's typings
1- Callback return type can still be function or explicitly, return a promise (if async ideally)
2- Return type to be Promise<void>

What approach did I use?

🔍 Digging Preact's code base to learn

  • TIL act supports async

📚 Mostly following Preact's contribution guidelines:

@davidje13
Copy link
Copy Markdown
Contributor

Looks good. Should anything be added to the typescript tests for this? (there doesn't seem to be much so far so maybe the answer is no)

Copy link
Copy Markdown
Member

@JoviDeCroock JoviDeCroock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, this looks good to me. I'm going to make a note so we don't forget about TS next time 😅

Thank you so much for your contribution

@ddayguerrero ddayguerrero marked this pull request as ready for review April 7, 2020 13:15
@ddayguerrero
Copy link
Copy Markdown
Contributor Author

ddayguerrero commented Apr 7, 2020

I'm going to make a note so we don't forget about TS next time

Sounds like a good idea!

act sync and async always returns a promise, also allow for promise generating callback
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.

Typescript definition for act does not account for promises

3 participants