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

Add PromiseValue type #75

Merged
merged 6 commits into from
Feb 6, 2020
Merged

Add PromiseValue type #75

merged 6 commits into from
Feb 6, 2020

Conversation

resynth1943
Copy link
Contributor

Boom.

Closes #42.

source/promise-value.d.ts Outdated Show resolved Hide resolved
@resynth1943
Copy link
Contributor Author

@fregante How about now?

@fregante
Copy link
Collaborator

fregante commented Feb 1, 2020

Looks better. How about we drop the asyncFunction mention though? This would let the user focus on this type and nothing else.

@resynth1943
Copy link
Contributor Author

resynth1943 commented Feb 1, 2020

Do you mean the import bit?

@fregante
Copy link
Collaborator

fregante commented Feb 1, 2020

I meant ReturnType, the example should not include ReturnType<typeof asyncFunction> but just PromiseValue<somePromise>

As discussed earlier, it seems that every example of PromiseValue is exactly that PromiseValue<ReturnType<typeof asyncFunction>>, suggesting that this type is useless on its own (as opposed to just having AsyncReturnType<typeof asyncFunction>).

Is it the case? Can you have an example of PromiseValue without using ReturnType? Because once #49 is added, then this example would be "obsolete"

@resynth1943
Copy link
Contributor Author

resynth1943 commented Feb 4, 2020

Thanks for your comment, @fregante. I'll say thanks for your contribution, however I'd still like to see this Promise-unpacking type implemented as a separate module to the variant that unpacks the return value from functions. Moreover, I still believe this type has uses on its own.

Thank you for mentioning the asyncFunction fragment of the code though, I'll be sure to modify that to something that doesn't talk about what's basically AsyncReturnType.

@fregante
Copy link
Collaborator

fregante commented Feb 5, 2020

Moreover, I still believe this type has uses on its own.

Right, I’m not disagreeing, I’m just asking to show a real use in the examples as well.

@resynth1943
Copy link
Contributor Author

/cc @fregante

source/promise-value.d.ts Outdated Show resolved Hide resolved
@resynth1943
Copy link
Contributor Author

resynth1943 commented Feb 5, 2020

Looking good?
/cc @sindresorhus

@sindresorhus sindresorhus merged commit 7fe70fd into sindresorhus:master Feb 6, 2020
@sindresorhus
Copy link
Owner

Looks good 👍

@resynth1943
Copy link
Contributor Author

Thanking you. How about we go for AsyncReturnType on top of this? ♥️

@sindresorhus
Copy link
Owner

👍

@resynth1943
Copy link
Contributor Author

Let's do it.

@sindresorhus sindresorhus mentioned this pull request Feb 16, 2020
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.

3 participants