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

polyfill for Promise.withResolvers #67

Merged
merged 3 commits into from
Oct 17, 2024
Merged

polyfill for Promise.withResolvers #67

merged 3 commits into from
Oct 17, 2024

Conversation

mattcosta7
Copy link
Member

@mattcosta7 mattcosta7 commented Oct 17, 2024

@mattcosta7 mattcosta7 self-assigned this Oct 17, 2024
@mattcosta7 mattcosta7 marked this pull request as ready for review October 17, 2024 13:11
@mattcosta7 mattcosta7 requested a review from a team as a code owner October 17, 2024 13:11
// eslint-disable-next-line @typescript-eslint/no-explicit-any
reject: (reason?: any) => void
}
out.promise = new Promise<T>((resolve, reject) => {
Copy link
Member Author

Choose a reason for hiding this comment

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

nit - I would new this here, but we call this in tests directly, so haven't done so


export function apply(): void {
if (!('withResolvers' in Promise)) {
Object.assign(Promise, {withResolvers})
Copy link
Member Author

Choose a reason for hiding this comment

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

using Object.assign to avoid type errors from defining withResolvers on Promise

@dgreif dgreif enabled auto-merge October 17, 2024 13:13
@dgreif dgreif merged commit ed36174 into main Oct 17, 2024
5 checks passed
@dgreif dgreif deleted the polyfill-with-resolvers branch October 17, 2024 13:22
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