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 better type definitions for promises #28

Merged
merged 4 commits into from
Apr 10, 2023

Conversation

aaditmshah
Copy link
Contributor

Here are the changes that I made.

  • Simplified the type definitions of PromiseConstructor and PromiseConstructorLike.
  • Provided better type definitions for Promise#then, Promise#catch, and Promise#finally. Playground Link.
  • Removed PromiseLike<T> from the union T | PromiseLike<T> when the result is awaited, i.e. for allSettled and any.
  • Changed the type of reason of PromiseRejectedResult from any to unknown for better type safety.
  • Removed unmodified properties of Body.

Haven't written test cases for these changes yet. Will add tests later when I get the time to do so.

@uhyo
Copy link
Owner

uhyo commented Apr 9, 2023

Sorry there is a conflict after I pushed a commit that upgrades TS to 5.0 to master. 😭 These should be fixed by rerunning npm run build:diff.

@aaditmshah
Copy link
Contributor Author

aaditmshah commented Apr 9, 2023

Sorry there is a conflict after I pushed a commit that upgrades TS to 5.0 to master. 😭 These should be fixed by rerunning npm run build:diff.

Rebased my changes.

@aaditmshah
Copy link
Contributor Author

@uhyo Added the tests. The PR is now ready for review.

Copy link
Owner

@uhyo uhyo left a comment

Choose a reason for hiding this comment

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

Great, thank you 🥰

@uhyo uhyo merged commit 26a08a1 into uhyo:master Apr 10, 2023
@aaditmshah aaditmshah deleted the feature/promise branch April 10, 2023 12:03
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.

2 participants