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

Unwrap promises #42575

Merged
merged 1 commit into from
Feb 25, 2020
Merged

Unwrap promises #42575

merged 1 commit into from
Feb 25, 2020

Conversation

jablko
Copy link
Contributor

@jablko jablko commented Feb 23, 2020

Reopen #41960

// even through a double promise.
(async () => {
  const browser = await puppeteer.launch();
  const page = await browser.newPage();
  await page.evaluate(() => Promise.resolve(document.body.innerHTML)).then(s => {
    console.log('body html has length', s.length);
  });
});

Before

page.evaluate() returned a Promise<Promise<string>>

Error in puppeteer
Error: /home/travis/build/DefinitelyTyped/DefinitelyTyped/types/puppeteer/puppeteer-tests.ts:554:43
ERROR: 554:43  expect  TypeScript@next compile error: 
Property 'length' does not exist on type 'Promise<string>'.
ERROR: 626:10  expect  TypeScript@next compile error: 

After

It returns a Promise<string> ✔️

  • Use a meaningful title for the pull request. Include the name of the package modified.
  • Test the change in your own code. (Compile and run.)
  • Add or edit tests to reflect the change. (Run with npm test.)
  • Follow the advice from the readme.
  • Avoid common mistakes.
  • Run npm run lint package-name (or tsc if no tslint.json is present).

@typescript-bot typescript-bot added Popular package This PR affects a popular package (as counted by NPM download counts). Awaiting reviewer feedback Unmerged The author did not merge the PR when it was ready. labels Feb 24, 2020
@typescript-bot
Copy link
Contributor

typescript-bot commented Feb 24, 2020

@jablko Thank you for submitting this PR!

🔔 @marvinhagemeister @cdeutsch @ksm2 @SimonSchick @serbanghita @JasonKaz @davecardwell @angrykoala @karol-majewski - please review this PR in the next few days. Be sure to explicitly select Approve or Request Changes in the GitHub UI so I know what's going on.

If no reviewer appears after a week, a DefinitelyTyped maintainer will review the PR instead.

@typescript-bot
Copy link
Contributor

After 5 days, no one has reviewed the PR 😞. A maintainer will be reviewing the PR in the next few days and will either merge it or request revisions. Thank you for your patience!

@sheetalkamat sheetalkamat merged commit 8fb86da into DefinitelyTyped:master Feb 25, 2020
@typescript-bot
Copy link
Contributor

I just published @types/[email protected] to npm.

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Popular package This PR affects a popular package (as counted by NPM download counts). Unmerged The author did not merge the PR when it was ready.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants