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

Typescript types a little wrong #6162

Closed
patrickjh opened this issue Jul 5, 2020 · 1 comment
Closed

Typescript types a little wrong #6162

patrickjh opened this issue Jul 5, 2020 · 1 comment

Comments

@patrickjh
Copy link

Steps to reproduce

Tell us about your environment:

  • Puppeteer version: ^5.0.0 @puppeteer/types ^3.0.1
  • Platform / OS version: Windows
  • URLs (if applicable):
  • Node.js version: 12.16.3

What steps will reproduce the problem?

Using typescript types from @types/puppeteer
You are missing the frame() method on the ExecutionContext interface that you receive from ElementHandle.executionContext().
But the frame() method exists in the code base and documentation and it works. I am having to cast ExecutionContext to any and then call the frame() method and cast that to Frame, which is not great Typescript

Please include code that reproduces the issue.

  1. const element = await this.page.waitFor('.whatever')
    
    element.executionContext().frame() //this last method frame() is marked as not a property in typescript.
    // When I examine the index.d.ts, typescript is correct it is not there

What is the expected result?
There should be a frame() method on the ExecutionContext declaration in typescript as it is in your docs and it works. Should be on the index.d.ts file around line 865.

Should say something like:

/** The class represents a context for JavaScript execution. */
export interface ExecutionContext extends JSEvalable {
frame(): Frame | null; // this is missing
queryObjects(prototypeHandle: JSHandle): Promise;
}

What happens instead?
Typescript throws an error and underlines it.

@jackfranklin
Copy link
Collaborator

Hi,

Thanks for the bug report. We don't maintain @types/puppeteer and we're currently working on shipping our own built in types (see #6124). So hopefully once we ship that (hopefully in a not-too-distant-future release) this should be resolved.

In the mean time I'm going to mark this as closed as we don't maintain the 3rd party types.

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

No branches or pull requests

2 participants