Skip to content

$eval and $$eval TypeScript return types incorrectly wrap all values in ElementHandle #54

@FeldrinH

Description

@FeldrinH

The return value of $eval and $$eval should only be wrapped in an ElementHandle when they are of type Element.
However, the TypeScript return types of these functions indicate that all return values are wrapped in ElementHandles, regardless of their types.

The problems seems to come from this line:
https://github.com/lucacasonato/deno-puppeteer/blob/14.1.1/vendor/puppeteer-core/puppeteer/common/EvalTypes.d.ts#L66

In the upstream puppeteer repo this line correctly checks if the type extends Element before wrapping it in an ElementHandle (https://github.com/puppeteer/puppeteer/blob/v14.1.1/src/common/EvalTypes.ts#L75), but in this deno port, the type Element is replaced with the type any, causing the aforementioned bug.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions